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
c58675a8
Commit
c58675a8
authored
Feb 08, 2019
by
Holger Niemann
Browse files
V3.1.1: bugfixes with versioning of raw data and path building after last update
parent
d63df5db
Changes
1
Hide whitespace changes
Inline
Side-by-side
downloadversionIRdata.py
View file @
c58675a8
...
...
@@ -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.
0
Version: 3.1.
1
(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
"""
...
...
@@ -433,7 +433,7 @@ def download_calibration_raw_files_by_time(port,t_exp,starttime,endtime,frametyp
t0date
=
datetime
.
datetime
.
utcfromtimestamp
((
starttime
-
15e6
)
/
1e9
)
t0date
=
t0date
.
isoformat
()
if
version
==
0
:
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM"
)
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM"
,
t_from
=
starttime
,
t_to
=
endtime
)
larchivepath
=
archivepath
+
"W7X/"
+
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM/V"
+
str
(
version
)
+
"/0/raw"
timest0
=
AKF_2
.
get_time_intervals
(
larchivepath
,
t0date
.
replace
(
"T"
,
" "
),
t1date
.
replace
(
"T"
,
" "
))
t_offset
=
timest0
[
-
1
][
0
]
-
time_t
[
0
]
...
...
@@ -454,7 +454,7 @@ def download_hot_cold_reference_by_times(port,exposure,starttime=150390720000000
larchivepath
=
archivepath
+
"W7X/"
+
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_"
# NUC_parlog=AKF_1.read_restdb_old(archivepath+"PARLOG/V"+str(version)+"/_signal.json?from="+str(starttime)+"&upto="+str(stoptime))
if
version
==
0
:
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM"
)
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM"
,
t_from
=
starttime
)
try
:
res
=
urllib
.
request
.
urlopen
(
larchivepath
+
"PARLOG/V"
+
str
(
version
)
+
"/_signal.json?from="
+
str
(
starttime
)
+
"&upto="
+
str
(
int
(
starttime
+
1e9
)))
signal_list
=
json
.
loads
(
res
.
read
().
decode
(
'utf-8'
))
...
...
@@ -600,7 +600,7 @@ def download_raw_images_by_times(port,starttime,stoptime,version=0,intervalSize=
"""
OP
=
IR_tools
.
get_OP_by_time
(
time_ns
=
starttime
)
if
version
==
0
:
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM"
)
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM"
,
t_from
=
starttime
,
t_to
=
stoptime
)
larchivepath
=
archivepath
+
"W7X/"
+
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM/V"
+
str
(
version
)
+
"/0/raw"
return
download_images_by_times
(
larchivepath
,
starttime
=
starttime
,
stoptime
=
stoptime
,
version
=
version
,
intervalSize
=
intervalSize
,
verbose
=
verbose
-
1
)
...
...
@@ -672,7 +672,7 @@ if fastDL:
stoptime
=
prog
[
1
][
'trigger'
][
'6'
][
0
]
OP
=
IR_tools
.
get_OP_by_time
(
time_ns
=
starttime
)
if
version
==
0
:
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM"
)
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM"
,
t_from
=
starttime
,
t_to
=
stoptime
)
larchivepath
=
archivepath
+
"W7X/"
+
portpathdict
[
OP
][
"AEF"
+
str
(
port
)]
+
"raw_DATASTREAM/V"
+
str
(
version
)
+
"/0/raw"
return
download_images_by_time_via_png
(
larchivepath
,
starttime
,
stoptime
,
time_window
=
time_window
,
threads
=
threads
,
...
...
@@ -1078,7 +1078,7 @@ def download_last_raw_image_by_time(larchivepath,starttime,stoptime,version=0):
"""
"""
try
:
url
=
'{0}/_signal.png?from={1}&upto='
.
format
(
larchivepath
,
starttime
-
10
,
stoptime
)
url
=
'{0}/_signal.png?from={1}&upto=
{2}
'
.
format
(
larchivepath
,
starttime
-
10
,
stoptime
)
res
=
urllib
.
request
.
urlopen
(
url
)
img
=
Image
.
open
(
BytesIO
(
res
.
read
()))
res
.
close
()
...
...
@@ -1724,7 +1724,7 @@ def get_temp_from_raw_by_program(portnr,program,time_window=0,emi=0.8,T_version=
return
False
,[
0
],[
0
],
False
else
:
if
version
==
0
:
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
portnr
)]
+
"raw_DATASTREAM"
)
version
=
get_latest_version
(
portpathdict
[
OP
][
"AEF"
+
str
(
portnr
)]
+
"raw_DATASTREAM"
,
program
=
program
)
larchivepath
=
archivepath
+
"W7X/"
+
portpathdict
[
OP
][
"AEF"
+
str
(
portnr
)]
+
"raw_DATASTREAM/V"
+
str
(
version
)
+
"/0/raw"
if
verbose
>
0
:
print
(
datetime
.
datetime
.
now
(),
"get_temp_from_raw_by_program: raw download start"
)
...
...
@@ -3039,8 +3039,8 @@ if __name__=='__main__':
print
(
"local function calling"
)
#%% temperature download and plotting example
# port=51#"AEF51"
# prog="2018
0925.017
"
# status,time,images,valid=get_temp_from_raw_by_program(port,prog,time_window=[0,0.15],emi=0.82,T_version=2,version=0,threads=4,give_ERROR=False,use_firstframe_as_background=False,verbose=5)
# prog="2018
1010.036
"
# status,time,images,valid=get_temp_from_raw_by_program(port,prog,time_window=[0,0.15],emi=0.82,T_version=2,version=0,threads=4,give_ERROR=False,use_firstframe_as_background=False,verbose=5
0
)
# if status:
# plt.figure()
# plt.imshow(images[-1],vmin=330,vmax=1000,cmap=exJet)
...
...
@@ -3060,9 +3060,9 @@ if __name__=='__main__':
# status,mapping=download_heatflux_mapping_reference(verbose=4)
# test=get_heatflux_profile(20,1605,timepoint=1,program="20171109.008",verbose=4)
#%% loads test
port
=
21
prog
=
"20171114.052"
status
,
time
,
load
,
error
=
download_divertor_load
(
port
,
targetmodule
=
[
'all'
,
'tm1h'
],
program
=
prog
,
verbose
=
5
,
debug
=
True
)
#
port=21
#
prog="20171114.052"
#
status,time,load,error=download_divertor_load(port,targetmodule=['all','tm1h'],program=prog,verbose=5,debug=True)
#%% HDF5 writing test
# bla=get_temp_from_raw_by_program_fullthreads(51,prog,time_window=[0,4],threads=4)
# bla2=get_nuced_raw_by_program_fullthreads(51,prog,time_window=[0,4],threads=4)
...
...
Write
Preview
Supports
Markdown
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