temp probability density plot
parent
d10665fd67
commit
f83a98ffe0
3
Pipfile
3
Pipfile
|
@ -11,6 +11,9 @@ gunicorn = "*"
|
|||
werkzeug = "*"
|
||||
pyyaml = "*"
|
||||
matplotlib = "*"
|
||||
plotly = "*"
|
||||
pandas = "*"
|
||||
scipy = "==1.8.1"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "51ddf9dc7440db9ddfb7bb7b45c97b133b214a6be4a7da1cf7fce0ddaabf6fd2"
|
||||
"sha256": "3428842daebc7c8a255790fde5231377c05479a39d5ce2977f043e58c7c80826"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
@ -413,7 +413,7 @@
|
|||
"sha256:f2f390aa4da44454db40a1f0201401f9036e8d578a25f01a6e237cea238337ef",
|
||||
"sha256:f76025acc8e2114bb664294a07ede0727aa75d63a06d2fae96bf29a81747e4a7"
|
||||
],
|
||||
"markers": "python_version >= '3.8'",
|
||||
"markers": "python_version >= '3.10'",
|
||||
"version": "==1.23.4"
|
||||
},
|
||||
"opencv-python": {
|
||||
|
@ -437,6 +437,39 @@
|
|||
"markers": "python_version >= '3.6'",
|
||||
"version": "==21.3"
|
||||
},
|
||||
"pandas": {
|
||||
"hashes": [
|
||||
"sha256:04e51b01d5192499390c0015630975f57836cc95c7411415b499b599b05c0c96",
|
||||
"sha256:05c527c64ee02a47a24031c880ee0ded05af0623163494173204c5b72ddce658",
|
||||
"sha256:0a78e05ec09731c5b3bd7a9805927ea631fe6f6cb06f0e7c63191a9a778d52b4",
|
||||
"sha256:17da7035d9e6f9ea9cdc3a513161f8739b8f8489d31dc932bc5a29a27243f93d",
|
||||
"sha256:249cec5f2a5b22096440bd85c33106b6102e0672204abd2d5c014106459804ee",
|
||||
"sha256:2c25e5c16ee5c0feb6cf9d982b869eec94a22ddfda9aa2fbed00842cbb697624",
|
||||
"sha256:32e3d9f65606b3f6e76555bfd1d0b68d94aff0929d82010b791b6254bf5a4b96",
|
||||
"sha256:36aa1f8f680d7584e9b572c3203b20d22d697c31b71189322f16811d4ecfecd3",
|
||||
"sha256:5b0c970e2215572197b42f1cff58a908d734503ea54b326412c70d4692256391",
|
||||
"sha256:5cee0c74e93ed4f9d39007e439debcaadc519d7ea5c0afc3d590a3a7b2edf060",
|
||||
"sha256:669c8605dba6c798c1863157aefde959c1796671ffb342b80fcb80a4c0bc4c26",
|
||||
"sha256:66a1ad667b56e679e06ba73bb88c7309b3f48a4c279bd3afea29f65a766e9036",
|
||||
"sha256:683779e5728ac9138406c59a11e09cd98c7d2c12f0a5fc2b9c5eecdbb4a00075",
|
||||
"sha256:6bb391659a747cf4f181a227c3e64b6d197100d53da98dcd766cc158bdd9ec68",
|
||||
"sha256:81f0674fa50b38b6793cd84fae5d67f58f74c2d974d2cb4e476d26eee33343d0",
|
||||
"sha256:927e59c694e039c75d7023465d311277a1fc29ed7236b5746e9dddf180393113",
|
||||
"sha256:932d2d7d3cab44cfa275601c982f30c2d874722ef6396bb539e41e4dc4618ed4",
|
||||
"sha256:a52419d9ba5906db516109660b114faf791136c94c1a636ed6b29cbfff9187ee",
|
||||
"sha256:b156a971bc451c68c9e1f97567c94fd44155f073e3bceb1b0d195fd98ed12048",
|
||||
"sha256:bcf1a82b770b8f8c1e495b19a20d8296f875a796c4fe6e91da5ef107f18c5ecb",
|
||||
"sha256:cb2a9cf1150302d69bb99861c5cddc9c25aceacb0a4ef5299785d0f5389a3209",
|
||||
"sha256:d8c709f4700573deb2036d240d140934df7e852520f4a584b2a8d5443b71f54d",
|
||||
"sha256:db45b94885000981522fb92349e6b76f5aee0924cc5315881239c7859883117d",
|
||||
"sha256:ddf46b940ef815af4e542697eaf071f0531449407a7607dd731bf23d156e20a7",
|
||||
"sha256:e675f8fe9aa6c418dc8d3aac0087b5294c1a4527f1eacf9fe5ea671685285454",
|
||||
"sha256:eb7e8cf2cf11a2580088009b43de84cabbf6f5dae94ceb489f28dba01a17cb77",
|
||||
"sha256:f340331a3f411910adfb4bbe46c2ed5872d9e473a783d7f14ecf49bc0869c594"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.5.1"
|
||||
},
|
||||
"pillow": {
|
||||
"hashes": [
|
||||
"sha256:0030fdbd926fb85844b8b92e2f9449ba89607231d3dd597a21ae72dc7fe26927",
|
||||
|
@ -501,6 +534,14 @@
|
|||
"markers": "python_version >= '3.7'",
|
||||
"version": "==9.2.0"
|
||||
},
|
||||
"plotly": {
|
||||
"hashes": [
|
||||
"sha256:4efef479c2ec1d86dcdac8405b6ca70ca65649a77408e39a7e84a1ea2db6c787",
|
||||
"sha256:52fd74b08aa4fd5a55b9d3034a30dbb746e572d7ed84897422f927fdf687ea5f"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==5.11.0"
|
||||
},
|
||||
"pyparsing": {
|
||||
"hashes": [
|
||||
"sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb",
|
||||
|
@ -517,6 +558,13 @@
|
|||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==2.8.2"
|
||||
},
|
||||
"pytz": {
|
||||
"hashes": [
|
||||
"sha256:335ab46900b1465e714b4fda4963d87363264eb662aab5e65da039c25f1f5b22",
|
||||
"sha256:c4d88f472f54d615e9cd582a5004d1e5f624854a6a27a6211591c251f22a6914"
|
||||
],
|
||||
"version": "==2022.5"
|
||||
},
|
||||
"pyyaml": {
|
||||
"hashes": [
|
||||
"sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf",
|
||||
|
@ -579,6 +627,14 @@
|
|||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==1.16.0"
|
||||
},
|
||||
"tenacity": {
|
||||
"hashes": [
|
||||
"sha256:35525cd47f82830069f0d6b73f7eb83bc5b73ee2fff0437952cedf98b27653ac",
|
||||
"sha256:e48c437fdf9340f5666b92cd7990e96bc5fc955e1298baf4a907e3972067a445"
|
||||
],
|
||||
"markers": "python_version >= '3.6'",
|
||||
"version": "==8.1.0"
|
||||
},
|
||||
"werkzeug": {
|
||||
"hashes": [
|
||||
"sha256:7ea2d48322cc7c0f8b3a215ed73eabd7b5d75d0b50e31ab006286ccff9e00b8f",
|
||||
|
|
|
@ -3,6 +3,8 @@ import numpy as np
|
|||
from ratio_pyrometry import ratio_pyrometry_pipeline
|
||||
import base64
|
||||
import cv2 as cv
|
||||
import plotly.figure_factory as ff
|
||||
from scipy import stats
|
||||
|
||||
app = Flask(
|
||||
__name__,
|
||||
|
@ -18,7 +20,7 @@ def index():
|
|||
def ratio_pyro():
|
||||
f = request.files['file']
|
||||
f_bytes = np.fromstring(f.read(), np.uint8)
|
||||
img_orig, img_res, key = ratio_pyrometry_pipeline(
|
||||
img_orig, img_res, key, ptemps = ratio_pyrometry_pipeline(
|
||||
f_bytes,
|
||||
ISO=float(request.form['iso']),
|
||||
I_Darkcurrent=float(request.form['i_darkcurrent']),
|
||||
|
@ -31,12 +33,34 @@ def ratio_pyro():
|
|||
eqn_scaling_factor=float(request.form['equation_scaling_factor'])
|
||||
)
|
||||
|
||||
# get base64 encoded images
|
||||
img_orig_b64 = base64.b64encode(cv.imencode('.png', img_orig)[1]).decode(encoding='utf-8')
|
||||
img_res_b64 = base64.b64encode(cv.imencode('.png', img_res)[1]).decode(encoding='utf-8')
|
||||
|
||||
# generate prob. distribution histogram & return embed
|
||||
fig = ff.create_distplot(
|
||||
[ptemps],
|
||||
group_labels=[f.name],
|
||||
show_rug=False,
|
||||
show_hist=False,
|
||||
)
|
||||
fig.update_layout(
|
||||
autosize=False,
|
||||
width=800,
|
||||
height=600,
|
||||
)
|
||||
fig.update_xaxes(
|
||||
title_text="Temperature (°C)",
|
||||
)
|
||||
fig.update_xaxes(
|
||||
title_text="Probability (1/°C)",
|
||||
)
|
||||
freq_plot = fig.to_html()
|
||||
|
||||
return render_template(
|
||||
'results.jinja2',
|
||||
img_orig_b64=img_orig_b64,
|
||||
img_res_b64=img_res_b64,
|
||||
legend=key
|
||||
legend=key,
|
||||
freq_plot=freq_plot
|
||||
)
|
||||
|
|
|
@ -13,11 +13,16 @@ def rg_ratio_normalize(
|
|||
ISO,
|
||||
MIN_TEMP,
|
||||
MAX_TEMP,
|
||||
eqn_scaling_factor
|
||||
eqn_scaling_factor,
|
||||
):
|
||||
"""
|
||||
Get normalized G/R -> temperature data + list of all temperatures
|
||||
"""
|
||||
# copy image into new array & chop off alpha values (if applicable)
|
||||
imgnew = imgarr.copy()[:,:,:3]
|
||||
|
||||
positive_temps = []
|
||||
|
||||
for i in range(len(imgarr)):
|
||||
for j in range(len(imgarr[i])):
|
||||
px = imgarr[i][j]
|
||||
|
@ -32,12 +37,14 @@ def rg_ratio_normalize(
|
|||
# remove pixels outside calibration range
|
||||
if (MIN_TEMP != None and temp_C < MIN_TEMP) or (MAX_TEMP != None and temp_C > MAX_TEMP):
|
||||
temp_C = MIN_TEMP
|
||||
elif temp_C > MIN_TEMP:
|
||||
positive_temps.append(temp_C)
|
||||
|
||||
# scale light intensity to calculated temperature
|
||||
pix_i = scale_temp(temp_C, MIN_TEMP, MAX_TEMP)
|
||||
imgnew[i][j] = [pix_i, pix_i, pix_i]
|
||||
|
||||
return imgnew
|
||||
return imgnew, positive_temps
|
||||
|
||||
|
||||
@jit(nopython=True)
|
||||
|
@ -83,7 +90,7 @@ def ratio_pyrometry_pipeline(
|
|||
# read image & crop
|
||||
img_orig = cv.imdecode(file_bytes, cv.IMREAD_UNCHANGED)
|
||||
|
||||
img = rg_ratio_normalize(
|
||||
img, ptemps = rg_ratio_normalize(
|
||||
img_orig,
|
||||
I_Darkcurrent,
|
||||
f_stop,
|
||||
|
@ -91,7 +98,7 @@ def ratio_pyrometry_pipeline(
|
|||
ISO,
|
||||
MIN_TEMP,
|
||||
MAX_TEMP,
|
||||
eqn_scaling_factor
|
||||
eqn_scaling_factor,
|
||||
)
|
||||
|
||||
# build & apply smoothing conv kernel
|
||||
|
@ -126,4 +133,4 @@ def ratio_pyrometry_pipeline(
|
|||
tempkey[temps[i]] = f"rgb({c[2]}, {c[1]}, {c[0]})"
|
||||
|
||||
# original, transformed, legend
|
||||
return img_orig, img_jet, tempkey
|
||||
return img_orig, img_jet, tempkey, ptemps
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{# Temperature Frequency Plot #}
|
||||
<strong>Temperature Distribution</strong>
|
||||
{{freq_plot}}
|
||||
|
||||
<style>
|
||||
.img-table-heading {
|
||||
|
|
Loading…
Reference in New Issue