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
5bbc23ef
Commit
5bbc23ef
authored
Mar 12, 2019
by
Holger Niemann
Browse files
Update to V3.1.2: bug fixes all around, specially with the versioning
parent
826a8ef3
Changes
6
Hide whitespace changes
Inline
Side-by-side
IR_image_tools.py
View file @
5bbc23ef
...
...
@@ -70,6 +70,18 @@ def bestimmtheitsmass_general(data,fit):
else
:
print
(
"bestimmtheitsmass_general: Arrays must have same dimensions"
)
return
R
def
bestimmheitsmass_linear
(
data
,
fit
,
debugmode
=
False
):
R2
=
0
if
len
(
fit
)
==
len
(
data
):
mittel_D
=
np
.
mean
(
data
)
#np.sum(data)/len(data)
mittel_F
=
np
.
mean
(
fit
)
R2
=
quad_abweich_mittel
(
fit
,
mittel_D
)
/
quad_abweich_mittel
(
data
,
mittel_D
)
if
debugmode
:
print
(
mittel_D
,
mittel_F
,
quad_abweich_mittel
(
fit
,
mittel_D
),
quad_abweich_mittel
(
data
,
mittel_D
),
R2
)
else
:
print
(
"bestimmtheitsmass_linear: Arrays must have same dimensions"
)
return
R2
def
quad_abweich_mittel
(
data
,
mittel
):
R
=
0
...
...
downloadversionIRdata.py
View file @
5bbc23ef
...
...
@@ -4,7 +4,7 @@ Created on Wed Oct 25 15:51:46 2017
updated on Tue Aug 21 10:20:00 2018
last update on Fr Nov 23 15:37:00 2018
Version: 3.1.
1
Version: 3.1.
2
(Numbering: #of big changes(OP1.2a download V1, OP1.2b download V2, heatflux V3) . #of updates to add functionalities . #number of updates for bug fixes )
@author: holn
"""
...
...
@@ -96,7 +96,7 @@ def get_latest_version(stream,project="W7X",Test=False,t_from=None,t_to=None,pro
if
program
is
not
None
:
prog
=
get_program_from_PID
(
program
)
if
prog
[
0
]:
t_from
=
prog
[
1
][
'trigger'
][
'
1
'
][
0
]
t_from
=
prog
[
1
][
'trigger'
][
'
0
'
][
0
]
t_to
=
prog
[
1
][
'trigger'
][
'6'
][
0
]
elif
t_from
is
not
None
and
t_to
==
None
:
t_to
=
int
(
t_from
+
100e9
)
...
...
@@ -645,6 +645,8 @@ def download_images_by_times(larchivepath,starttime,stoptime,version=0,intervalS
else
:
try
:
res
=
urllib
.
request
.
urlopen
(
larchivepath
+
"/_signal.json?from="
+
str
(
starttime
-
10
)
+
"&upto="
+
str
(
stoptime
))
if
verbose
>
100
:
print
(
larchivepath
+
"/_signal.json?from="
+
str
(
starttime
-
10
)
+
"&upto="
+
str
(
stoptime
))
signal_list
=
json
.
loads
(
res
.
read
().
decode
(
'utf-8'
))
res
.
close
()
images
=
[
np
.
array
(
ele
,
dtype
=
typo
)
for
ele
in
signal_list
[
'values'
]]
...
...
@@ -705,7 +707,7 @@ if fastDL:
try
:
times
=
AKF_2
.
get_time_intervals
(
larchivepath
,
stdate
.
replace
(
"T"
,
" "
),
enddate
.
replace
(
"T"
,
" "
))
#
except
Exception
as
E
:
print
(
'download_images_by_time_via_png: Error loading times from '
,
larchivepath
)
print
(
'download_images_by_time_via_png: Error loading times from '
,
larchivepath
,
stdate
.
replace
(
"T"
,
" "
),
enddate
.
replace
(
"T"
,
" "
)
)
raise
Warning
(
E
)
return
False
,[
0
],[
0
]
time
=
[]
...
...
@@ -826,7 +828,7 @@ if fastDL:
class
NUC_raw_thread
(
threading
.
Thread
):
def
__init__
(
self
,
larchivepath
,
times
,
resultlist
,
threadID
,
version
=
0
,
background
=
0
,
LUT
=
[[],[],[]],
refT
=
28.5
,
gain
=
0
,
offset
=
0
,
gain_error
=
0
,
offset_error
=
0
,
give_ERROR
=
False
,
FOV
=
0
,
badpixels
=
[]):
give_ERROR
=
False
,
FOV
=
0
,
badpixels
=
[]
,
verbose
=
0
):
threading
.
Thread
.
__init__
(
self
)
self
.
threadID
=
threadID
self
.
times
=
times
...
...
@@ -843,6 +845,7 @@ if fastDL:
self
.
give_ERROR
=
give_ERROR
self
.
FOV
=
FOV
self
.
badpixels
=
badpixels
self
.
verbose
=
verbose
def
run
(
self
):
images
=
[]
time
=
[]
...
...
@@ -2009,7 +2012,7 @@ def get_nuced_raw_by_program_fullthreads(portnr,program,time_window=0,emi=0.8,
if
verbose
>
0
:
print
(
"get_nuced_raw_by_program_fullthreads: Start Thread "
,
i
+
1
)
# p = multiprocessing.Process(target=NUC_raw_thread, args=(portnr,tim[intervalls[i]:intervalls[i+1]],out_q,i,version,background,LUT,refT,gain,offset,gain_error,offset_error,give_ERROR,FOV,badpixels,))
p
=
NUC_raw_thread
(
larchivepath
,
tim
[
intervalls
[
i
]:
intervalls
[
i
+
1
]],
resultdict
,
i
,
version
,
background
,
LUT
,
refT
,
gain
,
offset
,
gain_error
,
offset_error
,
give_ERROR
,
FOV
,
badpixels
)
p
=
NUC_raw_thread
(
larchivepath
,
tim
[
intervalls
[
i
]:
intervalls
[
i
+
1
]],
resultdict
,
i
,
version
,
background
,
LUT
,
refT
,
gain
,
offset
,
gain_error
,
offset_error
,
give_ERROR
,
FOV
,
badpixels
,
verbose
=
verbose
-
1
)
jobs
.
append
(
p
)
p
.
start
()
for
p
in
jobs
:
...
...
plot_heatflux_example.py
View file @
5bbc23ef
...
...
@@ -5,54 +5,55 @@ V3.0.2
@author: holn
"""
import
numpy
as
np
import
downloadversionIRdata
as
IR
import
IR_data_access.
downloadversionIRdata
as
IR
import
matplotlib.pyplot
as
plt
import
datetime
if
__name__
==
'__main__'
:
#%% loading data
print
(
datetime
.
datetime
.
now
(),
"start"
)
status
,
times
,
images
=
IR
.
download_heatflux_by_program
(
20
,
"201
71109.008
"
,
timewindow
=
0.9
,
version
=
1
,
threads
=
1
,
verbose
=
5
)
status
,
times
,
images
=
IR
.
download_heatflux_by_program
(
20
,
"201
81004.012
"
,
time
_
window
=
0.9
,
version
=
1
,
threads
=
1
,
verbose
=
5
)
print
(
'done'
)
#%% plotting data
status2
,
time
,
s
,
q
=
IR
.
extract_heatflux_profile_from_DL
((
np
.
asarray
(
times
)
-
times
[
0
])
/
1e9
,
images
,
profile
=
"TM3h_5_5"
,
timewindow
=
0.5
,
verbose
=
5
)
plt
.
figure
()
plt
.
imshow
(
images
[
-
1
]
/
1e6
)
plt
.
clim
([
0
,
4
])
plt
.
tick_params
(
axis
=
'both'
,
# changes apply to the x-axis
which
=
'both'
,
# both major and minor ticks are affected
bottom
=
'off'
,
# ticks along the bottom edge are off
top
=
'off'
,
# ticks along the top edge are off
left
=
'off'
,
right
=
'off'
,
labelleft
=
'off'
,
labelbottom
=
'off'
)
# labels along the bottom edge are off
c_ax
=
plt
.
colorbar
()
c_ax
.
set_label
(
'q [MW/m2]'
)
plt
.
savefig
(
'20171109.008 - '
+
str
(
round
((
np
.
asarray
(
times
[
-
1
])
-
times
[
0
])
/
1e9
,
2
))
+
' - AEF20IR - in MWm2.png'
,
dpi
=
300
,
bbox_inches
=
'tight'
)
if
len
(
np
.
shape
(
q
))
==
1
or
np
.
shape
(
q
)[
0
]
==
1
:
if
np
.
shape
(
q
)[
0
]
==
1
:
q
=
q
[
0
]
if
status
:
status2
,
time
,
s
,
q
=
IR
.
extract_heatflux_profile_from_DL
((
np
.
asarray
(
times
)
-
times
[
0
])
/
1e9
,
images
,
profile
=
"TM3h_5_5"
,
time_window
=
0.5
,
verbose
=
5
)
plt
.
figure
()
plt
.
plot
(
s
,
q
/
1e6
,
'ko-'
)
plt
.
xlabel
(
"s [m]"
,
fontsize
=
26
)
plt
.
ylabel
(
"q [MW/m2]"
,
fontsize
=
26
)
plt
.
tick_params
(
labelsize
=
26
)
plt
.
title
(
"20171109.008 heat flux profile for TM3, finger 5, profile 5 @1s"
,
fontsize
=
26
)
plt
.
grid
()
plt
.
ylim
(
bottom
=
0
)
plt
.
show
()
elif
len
(
np
.
shape
(
q
))
==
2
:
plt
.
figure
()
X
,
Y
=
np
.
meshgrid
(
time
,
s
)
plt
.
pcolor
(
X
,
Y
,
q
.
swapaxes
(
0
,
1
)
/
1e6
,
vmin
=
0
)
plt
.
xlabel
(
"time [s]"
,
fontsize
=
26
)
plt
.
ylabel
(
"s [m]"
,
fontsize
=
26
)
plt
.
tick_params
(
labelsize
=
26
)
cb
=
plt
.
colorbar
()
cb
.
set_label
(
'heatflux in MW/m²'
,
rotation
=
270
,
labelpad
=
15
,
fontsize
=
26
)
cb
.
ax
.
tick_params
(
labelsize
=
26
)
plt
.
title
(
"20171109.008 heat flux profile for TM3, finger 5, profile 5"
,
fontsize
=
26
)
plt
.
show
()
plt
.
imshow
(
images
[
-
1
]
/
1e6
)
plt
.
clim
([
0
,
4
])
plt
.
tick_params
(
axis
=
'both'
,
# changes apply to the x-axis
which
=
'both'
,
# both major and minor ticks are affected
bottom
=
'off'
,
# ticks along the bottom edge are off
top
=
'off'
,
# ticks along the top edge are off
left
=
'off'
,
right
=
'off'
,
labelleft
=
'off'
,
labelbottom
=
'off'
)
# labels along the bottom edge are off
c_ax
=
plt
.
colorbar
()
c_ax
.
set_label
(
'q [MW/m2]'
)
plt
.
savefig
(
'20171109.008 - '
+
str
(
round
((
np
.
asarray
(
times
[
-
1
])
-
times
[
0
])
/
1e9
,
2
))
+
' - AEF20IR - in MWm2.png'
,
dpi
=
300
,
bbox_inches
=
'tight'
)
if
len
(
np
.
shape
(
q
))
==
1
or
np
.
shape
(
q
)[
0
]
==
1
:
if
np
.
shape
(
q
)[
0
]
==
1
:
q
=
q
[
0
]
plt
.
figure
()
plt
.
plot
(
s
,
q
/
1e6
,
'ko-'
)
plt
.
xlabel
(
"s [m]"
,
fontsize
=
26
)
plt
.
ylabel
(
"q [MW/m2]"
,
fontsize
=
26
)
plt
.
tick_params
(
labelsize
=
26
)
plt
.
title
(
"20171109.008 heat flux profile for TM3, finger 5, profile 5 @1s"
,
fontsize
=
26
)
plt
.
grid
()
plt
.
ylim
(
bottom
=
0
)
plt
.
show
()
elif
len
(
np
.
shape
(
q
))
==
2
:
plt
.
figure
()
X
,
Y
=
np
.
meshgrid
(
time
,
s
)
plt
.
pcolor
(
X
,
Y
,
q
.
swapaxes
(
0
,
1
)
/
1e6
,
vmin
=
0
)
plt
.
xlabel
(
"time [s]"
,
fontsize
=
26
)
plt
.
ylabel
(
"s [m]"
,
fontsize
=
26
)
plt
.
tick_params
(
labelsize
=
26
)
cb
=
plt
.
colorbar
()
cb
.
set_label
(
'heatflux in MW/m²'
,
rotation
=
270
,
labelpad
=
15
,
fontsize
=
26
)
cb
.
ax
.
tick_params
(
labelsize
=
26
)
plt
.
title
(
"20171109.008 heat flux profile for TM3, finger 5, profile 5"
,
fontsize
=
26
)
plt
.
show
()
\ No newline at end of file
upload_heatflux.py
View file @
5bbc23ef
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 21 09:32:29 2018
V3.
0
.2
V3.
1
.2
@author: holn
"""
...
...
@@ -19,21 +19,21 @@ import datetime
port
=
10
program
=
"20171109.008"
#programlist=["20171011.009"]
programlist
=
[
"20180814.024"
,
"20181016.016"
]
#["20171108.018","20171109.040","20171109.045"]
programlist
=
[
"
20171114.038"
]
#"
20180814.024"
]#
,"20181016.016"]#["20171108.018","20171109.040","20171109.045"]
path
=
"F:
\\
tmp
\\
upload_it
\\
"
#"F:\\holn\\Documents\\Doktorarbeit\\RESULTS\\OP1.2a\\Fulldivertor_res\\EJM\\H\\"
outpfad
=
"F:
\\
holn
\\
Documents
\\
Doktorarbeit
\\
DATEN
\\
Mapping
\\
LinesforStacks
\\
"
scenepath
=
""
scenepath
=
"
X:
\\
E4 Diagnostics
\\
QIR
\\
Data
\\
scene_models\OP1.2a
\\
"
project
=
"W7XAnalysis"
group
=
"QRT_IRCAM"
group
=
"QRT_IRCAM
_Test
"
stream
=
"AEF"
+
str
(
port
)
+
"_heatflux"
comment
=
"Test upload"
header
=
{
'code_version'
:
4
,
'alpha_corrected'
:
1
}
stream2
=
"Mapping_reference"
upload_Mapping
=
False
upload_scene_reference
=
False
upload_scene_reference
=
True
#
False
stream_scene
=
"AEF"
+
str
(
port
)
+
"_SceneModel_reference"
scene_reference_time
=
0
#ns timestamp goes here!
scene_reference_time
=
150390720000000000
0
#ns timestamp goes here!
for
program
in
programlist
:
...
...
@@ -214,7 +214,7 @@ for program in programlist:
print
(
datetime
.
datetime
.
now
(),
"starting upload"
)
# IRup.upload_Parlog(url,parobj,versionnumber=1)
print
(
datetime
.
datetime
.
now
(),
"parlog written"
)
IRup
.
upload_images
(
images
,
time
=
time_ns
,
group
=
group
,
stream
=
stream
,
project
=
project
,
version
=
1
,
swapping
=
False
,
Test
=
True
)
#
IRup.upload_images(images,time=time_ns,group=group,stream=stream,project=project,version=1,swapping=False,Test=True)
print
(
datetime
.
datetime
.
now
(),
"data uploaded"
)
del
images
,
alphapic
,
heatpics
,
time_ns
if
upload_Mapping
:
...
...
@@ -254,12 +254,12 @@ for program in programlist:
images3
=
np
.
append
(
images3
,
Ypic3D
,
axis
=
2
)
images3
=
np
.
append
(
images3
,
Zpic3D
,
axis
=
2
)
images3
=
np
.
append
(
images3
,
CID
,
axis
=
2
)
header3
=
{
'Pixel_X'
:
int
(
scene_reference_time
),
'Pixel_Y'
:
int
(
scene_reference_time
+
10
),
'CAD_X'
:
int
(
scene_reference_time
+
20
),
'CAD_Y'
:
int
(
scene_reference_time
+
30
),
'CAD_Z'
:
int
(
scene_reference_time
+
40
),
'Component_ID'
:
int
(
time
t1
+
50
)}
header3
=
{
'Pixel_X'
:
int
(
scene_reference_time
),
'Pixel_Y'
:
int
(
scene_reference_time
+
10
),
'CAD_X'
:
int
(
scene_reference_time
+
20
),
'CAD_Y'
:
int
(
scene_reference_time
+
30
),
'CAD_Z'
:
int
(
scene_reference_time
+
40
),
'Component_ID'
:
int
(
scene_reference_
time
+
50
)}
chanDesc
=
[{
'name'
:
'scene model reference'
,
'physicalQuantity'
:{
'type'
:
'none'
},
'active'
:
1
}]
parobj
=
{
"label"
:
"parms"
,
"description"
:
"scene model reference data for the heat flux"
,
"values"
:[{
"chanDescs"
:
chanDesc
,
'header'
:
header3
,
'comment'
:
comment
}],
"dimensions"
:[
int
(
time_ns_scene
[
0
]),
int
(
time_ns_scene
[
-
1
]
)]
"dimensions"
:[
int
(
time_ns_scene
[
0
]),
-
1
]
}
# url=IR.archivepath+project+"/"+group+"/"+stream2
url
=
archivepath
+
project
+
"/"
+
group
+
"/"
+
stream_scene
...
...
upload_heatflux_folder.py
View file @
5bbc23ef
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 21 09:32:29 2018
V3.
0
.2
V3.
1
.2
@author: holn
"""
...
...
uploadingversionIRdata.py
View file @
5bbc23ef
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 24 11:24:52 2017
Version: 3.1.
0
Version: 3.1.
2
@author: holn
"""
...
...
@@ -281,7 +281,7 @@ def TimeToNs(date,time):
####################################
### START of the UPLOAD ROUTINES ###
####################################
def
upload_meta_stream
(
camera
,
portnum
,
time
,
sensortemp
,
cameratemp
,
framerate
,
exposuretime
,
comment
=
""
,
newversion
=
False
,
reason
=
""
):
def
upload_meta_stream
(
camera
,
portnum
,
time
,
sensortemp
,
cameratemp
,
framerate
,
exposuretime
,
comment
=
""
,
newversion
=
False
,
reason
=
""
,
version
=
0
):
"""
old: sensortemp,cameratemp,framerate,exposuretime
new: channels with names, units and values
...
...
@@ -298,7 +298,7 @@ def upload_meta_stream(camera,portnum,time,sensortemp,cameratemp,framerate,expos
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
...
...
@@ -327,7 +327,7 @@ def upload_meta_stream(camera,portnum,time,sensortemp,cameratemp,framerate,expos
}
upload_fulldataset
(
url
,
parobj
,
dataobj
,
version
)
def
upload_meta_stream_V2
(
camera
,
portnum
,
time
,
channel_names
,
channel_units
,
channel_values
,
comment
=
""
,
newversion
=
False
,
reason
=
""
,
Return
=
False
):
def
upload_meta_stream_V2
(
camera
,
portnum
,
time
,
channel_names
,
channel_units
,
channel_values
,
comment
=
""
,
newversion
=
False
,
reason
=
""
,
Return
=
False
,
version
=
0
):
"""
old: sensortemp,cameratemp,framerate,exposuretime
new: channels with names, units and values
...
...
@@ -345,7 +345,7 @@ def upload_meta_stream_V2(camera,portnum,time,channel_names,channel_units,channe
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
...
...
@@ -376,7 +376,7 @@ def upload_meta_stream_V2(camera,portnum,time,channel_names,channel_units,channe
if
Return
:
return
False
def
upload_raw_data
(
camera
,
portnum
,
time
,
images
,
metadata
=
{},
comment
=
""
,
newversion
=
False
,
reason
=
""
):
def
upload_raw_data
(
camera
,
portnum
,
time
,
images
,
metadata
=
{},
comment
=
""
,
newversion
=
False
,
reason
=
""
,
version
=
0
):
"""
upload_raw_data(camera,portnum,images,time,metadata={},newversion=False,reason="")
(str) camera: string of cameraname "IRCAM" or "INFRATEC", is used for the path
...
...
@@ -409,7 +409,7 @@ def upload_raw_data(camera,portnum,time,images,metadata={},comment="",newversion
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
...
...
@@ -420,7 +420,7 @@ def upload_raw_data(camera,portnum,time,images,metadata={},comment="",newversion
print
(
"writing parlog"
)
upload_Parlog
(
url
,
parobj
,
version
)
#camera,portnum,,"raw"
upload_images
(
images
,
time
,
group
,
datastream_name
,
newversion
,
reason
)
upload_images
(
images
,
time
,
group
,
datastream_name
,
newversion
,
reason
,
version
=
version
)
def
regenerate_timevector
(
time
,
reftrig
=
1
,
tref
=
0
,
toff
=
0
,
give_program
=
False
):
"""
...
...
@@ -451,7 +451,7 @@ def regenerate_timevector(time,reftrig=1,tref=0,toff=0,give_program=False):
return
np
.
asarray
(
time
),
"20000000.000"
def
upload_raw_data_from_H5
(
camera
,
portnum
,
time
,
h5file
,
metadata
=
{},
comment
=
""
,
parlog
=
True
,
rawdata
=
True
,
newversion
=
False
,
reason
=
""
,
del_list
=
[],
temppath
=
""
):
def
upload_raw_data_from_H5
(
camera
,
portnum
,
time
,
h5file
,
metadata
=
{},
comment
=
""
,
parlog
=
True
,
rawdata
=
True
,
newversion
=
False
,
reason
=
""
,
del_list
=
[],
temppath
=
""
,
version
=
0
):
"""
upload_raw_data(camera,portnum,images,time,metadata={},newversion=False,reason="")
(str) camera: string of cameraname "IRCAM" or "INFRATEC", is used for the path
...
...
@@ -477,7 +477,7 @@ def upload_raw_data_from_H5(camera,portnum,time,h5file,metadata={},comment="",pa
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
...
...
@@ -515,7 +515,7 @@ def upload_raw_data_from_H5(camera,portnum,time,h5file,metadata={},comment="",pa
else
:
return
uploadH5_Versioning
(
group
,
datastream_name
,
tmp
,
version
,
True
,
project
=
project
),
parlog_success
def
upload_temperaure_data
(
camera
,
portnum
,
images
,
time
,
metadata
=
{},
comment
=
""
,
newversion
=
False
,
reason
=
""
):
def
upload_temperaure_data
(
camera
,
portnum
,
images
,
time
,
metadata
=
{},
comment
=
""
,
newversion
=
False
,
reason
=
""
,
version
=
0
):
"""
upload_temperaure_data(camera,portnum,images,time,metadata={},newversion=False,reason="")
(str) camera: string of cameraname "IRCAM" or "INFRATEC", is used for the path
...
...
@@ -536,11 +536,11 @@ def upload_temperaure_data(camera,portnum,images,time,metadata={},comment="",new
parlog
=
{
'chanDescs'
:
chanDesc
,
'meta-data'
:
metadata
,
'comment'
:
comment
}
# upload_images(camera,portnum,images,time,"temperature","K",parlog,newversion=False,reason="")
url
=
archivepath
+
"W7X/"
+
group
+
"/"
+
datastream_name
upload_Parlog
(
url
,
parlog
)
upload_images
(
images
,
time
,
group
,
datastream_name
,
newversion
,
reason
)
upload_Parlog
(
url
,
parlog
,
versionnumber
=
version
)
upload_images
(
images
,
time
,
group
,
datastream_name
,
newversion
,
reason
,
version
=
version
)
def
upload_Background_frame
(
camera
,
portnum
,
time
,
texp_filter
,
background
,
parlog
=
True
,
data
=
True
,
newversion
=
False
,
reason
=
""
):
def
upload_Background_frame
(
camera
,
portnum
,
time
,
texp_filter
,
background
,
parlog
=
True
,
data
=
True
,
newversion
=
False
,
reason
=
""
,
version
=
0
):
group
=
"QRT_IRCAM"
#+camera # test part will be removed in final version
# group="QRT_IRCAM_TEST" # test part will be removed in final version
project
=
"W7X"
...
...
@@ -560,7 +560,7 @@ def upload_Background_frame(camera,portnum,time,texp_filter,background,parlog=Tr
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
...
...
@@ -585,7 +585,7 @@ def upload_Background_frame(camera,portnum,time,texp_filter,background,parlog=Tr
def
upload_NUC_ref
(
camera
,
portnum
,
time
,
texp_filter
,
gain
,
offset
,
cold
,
bad
,
gain_e
=
[],
offset_e
=
[],
parlog
=
True
,
data
=
True
,
newversion
=
False
,
reason
=
""
):
def
upload_NUC_ref
(
camera
,
portnum
,
time
,
texp_filter
,
gain
,
offset
,
cold
,
bad
,
gain_e
=
[],
offset_e
=
[],
parlog
=
True
,
data
=
True
,
newversion
=
False
,
reason
=
""
,
version
=
0
):
"""
upload_NUC_ref(gain,offset,hot,cold,bad,gain_e,offset_e,camera,portnum,time,newversion=False)
(str) camera: string of cameraname "IRCAM" or "INFRATEC", is used for the path
...
...
@@ -643,7 +643,7 @@ def upload_NUC_ref(camera,portnum,time,texp_filter,gain,offset,cold,bad,gain_e=[
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
...
...
@@ -665,7 +665,7 @@ def upload_NUC_ref(camera,portnum,time,texp_filter,gain,offset,cold,bad,gain_e=[
upload_fulldataset
(
url
,
parobj
,
dataobj
,
version
,
parlog
,
data
)
def
upload_LUT_tables
(
LUTs
,
LUTref
,
camera
,
portnum
,
time
,
group
=
"QRT_IRCAM"
,
newversion
=
False
,
reason
=
""
,
extra_par
=
None
):
def
upload_LUT_tables
(
LUTs
,
LUTref
,
camera
,
portnum
,
time
,
group
=
"QRT_IRCAM"
,
newversion
=
False
,
reason
=
""
,
extra_par
=
None
,
version
=
0
):
"""
upload_LUT_tables(LUTs,LUTref,camera,portnum,time,newversion=False,reason="")
(numpy.array) LUTs: t x n x 3 array DL,T,T_er, in general t=1, n= number of look-up-tables
...
...
@@ -723,7 +723,7 @@ def upload_LUT_tables(LUTs,LUTref,camera,portnum,time,group="QRT_IRCAM",newversi
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
...
...
@@ -746,7 +746,7 @@ def upload_LUT_tables(LUTs,LUTref,camera,portnum,time,group="QRT_IRCAM",newversi
upload_fulldataset
(
url
,
parobj
,
dataobj
,
version
)
def
upload_hot_cold_reference
(
port
,
path
,
time
=
1503907200000000000
,
newversion
=
False
,
reason
=
""
):
def
upload_hot_cold_reference
(
port
,
path
,
time
=
1503907200000000000
,
newversion
=
False
,
reason
=
""
,
version
=
0
):
"""
uploads the reference hot and cold images
"""
...
...
@@ -805,7 +805,7 @@ def upload_hot_cold_reference(port,path,time=1503907200000000000,newversion=Fals
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
...
...
@@ -835,7 +835,7 @@ def upload_hot_cold_reference(port,path,time=1503907200000000000,newversion=Fals
upload_fulldataset
(
url
,
parobj
,
dataobj
,
version
)
def
upload_scene_model
(
port
,
time_ns
,
path
=
"
\\\\
sv-e4-fs-1
\\
E4-Mitarbeiter
\\
E4 Diagnostics
\\
QIR
\\
Calibrations
\\
scene_models"
,
newversion
=
False
,
reason
=
""
):
def
upload_scene_model
(
port
,
time_ns
,
path
=
"
\\\\
sv-e4-fs-1
\\
E4-Mitarbeiter
\\
E4 Diagnostics
\\
QIR
\\
Calibrations
\\
scene_models"
,
newversion
=
False
,
reason
=
""
,
version
=
0
):
# camera="IRCAM"
project
=
"W7X"
group
=
"QRT_IRCAM_TEST"
#+camera#+"_TEST" # test part will be removed in final version
...
...
@@ -856,13 +856,13 @@ def upload_scene_model(port,time_ns,path="\\\\sv-e4-fs-1\\E4-Mitarbeiter\\E4 Dia
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
version
=
1
else
:
else
:
version
=
ver
structure
=
{}
for
key
in
keylist
:
...
...
@@ -879,28 +879,9 @@ def upload_scene_model(port,time_ns,path="\\\\sv-e4-fs-1\\E4-Mitarbeiter\\E4 Dia
}
upload_Parlog
(
url
,
parobj
,
version
=
version
)
# upload_images(camera,port,framelist,time_ns_list,"scene_model",version)
upload_images
(
framelist
,
time_ns_list
,
group
,
datastream_name
,
newversion
,
reason
)
#def upload_NUC_ref():
# """
#
# """
# print("not ready")
def
download_LUT_tables
(
camera
,
port
,
time
,
texp
=
0
,
emissivity
=
0
,
Filter
=
0
):
"""
(str) camera: string of cameraname "IRCAM" or "INFRATEC", is used for the path
(numpy.array) time: time vector in uint64 ns of length t
(bool) newversion: defines whether a new version is needed
(int) portnum: portnumber as int, example: 10 or 11 etc.
in case of texp=0 and emissivity=0 it will give back all LUTs
"""
print
(
"not ready"
)
return
0
upload_images
(
framelist
,
time_ns_list
,
group
,
datastream_name
,
newversion
,
reason
,
version
=
version
)
def
upload_Parlog
(
url
,
parobj
,
versionnumber
=
0
,
Return
=
False
):
...
...
@@ -974,14 +955,14 @@ def upload_images(images,time,group,stream,newversion=False,reason="",project="W
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
version
=
ver
el
se
:
el
if
version
==
0
:
ver
=
get_latest_version
(
database
+
"/raw/"
+
project
+
"/"
+
group
+
"/"
+
datastream_name
+
"_PARLOG"
)
if
ver
==
None
:
reason
=
"Versioning of Data"
archive_create_stream_version
(
url
,
reason
,
False
,
"n/a"
,
"n/a"
)
version
=
1
else
:
version
=
ver
version
=
ver
try
:
# archive.write_signals(images,time,group,project,names, datastream_name,units,metadata,2,True)
tmp
=
writeH5_images
(
datastream_name
,
images
,
time
,
swapping
=
swapping
)
...
...
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