Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Holger Niemann
IR_data_access
Commits
eb8f2e0f
Commit
eb8f2e0f
authored
Aug 01, 2018
by
Holger Niemann
Browse files
fixes of runtime and futurewarining (3.5, errors in 3.6) in the download code
parent
a0d613e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
IR_image_tools.py
View file @
eb8f2e0f
...
...
@@ -413,13 +413,13 @@ def restore_bad_pixels(frames, bad_pixel, by_list=True, check_neighbours=True, p
def
generate_new_hot_image
(
cold
,
reference_cold
,
reference_hot
):
if
cold
==
None
or
reference_cold
==
None
or
reference_hot
==
None
:
if
cold
is
None
or
reference_cold
is
None
or
reference_hot
is
None
:
raise
Exception
(
"Cannot Calculate new Hot image, if images are missing!"
)
else
:
return
reference_hot
+
(
cold
-
reference_cold
)
def
calculate_gain_offset_image_pix
(
cold_image
,
hot_image
=
None
,
reference_cold
=
None
,
reference_hot
=
None
,
bose
=
1
):
if
hot_image
==
None
:
if
hot_image
is
None
:
hot_image
=
generate_new_hot_image
(
cold_image
,
reference_cold
,
reference_hot
)
if
bose
>
0
:
print
(
"calculate gain and offset"
)
...
...
@@ -432,7 +432,7 @@ def calculate_gain_offset_image_pix(cold_image,hot_image=None,reference_cold=Non
return
Gain_rel
,
Offset_rel
def
calculate_gain_offset_image
(
cold_image
,
hot_image
=
None
,
reference_cold
=
None
,
reference_hot
=
None
,
bose
=
1
):
if
hot_image
==
None
:
if
hot_image
is
None
:
hot_image
=
generate_new_hot_image
(
cold_image
,
reference_cold
,
reference_hot
)
if
bose
>
0
:
print
(
"calculate gain and offset"
)
...
...
@@ -443,7 +443,11 @@ def calculate_gain_offset_image(cold_image,hot_image=None,reference_cold=None,re
# print(cold_image[( np.int( np.shape(hot_image)[0]/2) )-2: (np.int( np.shape(hot_image)[0]/2))+3,np.int((np.shape(hot_image)[1]/2))-2:np.int((np.shape(hot_image)[1]/2))+3 ])
Sh_ref
=
np
.
mean
(
hot_image
[(
np
.
int
(
np
.
shape
(
hot_image
)[
0
]
/
2
)
)
-
2
:
(
np
.
int
(
np
.
shape
(
hot_image
)[
0
]
/
2
))
+
3
,
np
.
int
((
np
.
shape
(
hot_image
)[
1
]
/
2
))
-
2
:
np
.
int
((
np
.
shape
(
hot_image
)[
1
]
/
2
))
+
3
])
Sc_ref
=
np
.
mean
(
cold_image
[(
np
.
int
(
np
.
shape
(
cold_image
)[
0
]
/
2
)
)
-
2
:
(
np
.
int
(
np
.
shape
(
cold_image
)[
0
]
/
2
))
+
3
,
np
.
int
((
np
.
shape
(
cold_image
)[
1
]
/
2
))
-
2
:
np
.
int
((
np
.
shape
(
cold_image
)[
1
]
/
2
))
+
3
])
Gain_rel
=
(
Sh_ref
-
Sc_ref
)
/
(
hot_image
-
cold_image
)
difference_image
=
hot_image
-
cold_image
indexlist
=
np
.
where
(
difference_image
==
0
)
difference_image
[
indexlist
]
=
0.001
Gain_rel
=
(
Sh_ref
-
Sc_ref
)
/
(
difference_image
)
Gain_rel
[
indexlist
]
=
0
Off_h_rel
=
Sh_ref
-
hot_image
*
Gain_rel
Off_c_rel
=
Sc_ref
-
cold_image
*
Gain_rel
Offset_rel
=
(
Off_h_rel
+
Off_c_rel
)
/
2
...
...
downloadversionIRdata.py
View file @
eb8f2e0f
...
...
@@ -504,7 +504,7 @@ def download_background_by_times(port,starttime,stoptime,exposure,camera_filter=
else
:
return
False
,
0
,
0
def
get_NUCed_background_by_times
(
port
,
t0
,
t1
,
t_exp
,
cfilter
,
gain
,
offset
,
version
=
0
,
plot_it
=
Tru
e
):
def
get_NUCed_background_by_times
(
port
,
t0
,
t1
,
t_exp
,
cfilter
,
gain
,
offset
,
version
=
0
,
plot_it
=
Fals
e
):
"OP1.2b function"
exist
,
btime
,
backgroundframes
=
download_calibration_raw_files_by_time
(
port
,
t_exp
,
t0
,
t1
,
frametype
=
1
,
version
=
version
)
camera
=
portcamdict
[
"OP1.2b"
][
"AEF"
+
str
(
port
)]
...
...
plot_IR_data.py
View file @
eb8f2e0f
...
...
@@ -15,7 +15,7 @@ if __name__=='__main__':
#%% loading data
status
,
time
,
images
,
valid
=
downIR
.
get_temp_from_raw_by_program
(
20
,
"201
71207.006
"
,
time_s
=
3
.5
,
emi
=
0.8
,
T_version
=
2
,
version
=
1
,
threads
=
8
,
give_ERROR
=
False
)
status
,
time
,
images
,
valid
=
downIR
.
get_temp_from_raw_by_program
(
20
,
"201
80726.015
"
,
time_s
=
2
.5
,
emi
=
0.8
,
T_version
=
2
,
version
=
1
,
threads
=
4
,
give_ERROR
=
False
)
print
(
'fertig'
)
#%% plotting data
...
...
@@ -33,5 +33,5 @@ if __name__=='__main__':
labelbottom
=
'off'
)
# labels along the bottom edge are off
c_ax
=
plt
.
colorbar
()
c_ax
.
set_label
(
'T [K]'
)
plt
.
savefig
(
'201
71207.006
- 2.2s - AEF20IR - in K.png'
,
dpi
=
300
,
bbox_inches
=
'tight'
)
plt
.
savefig
(
'201
80726.015
- 2.2s - AEF20IR - in K.png'
,
dpi
=
300
,
bbox_inches
=
'tight'
)
plt
.
show
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment