Skip to content

Commit 8019ba0

Browse files
Julian Kates-HarbeckJulian Kates-Harbeck
authored andcommitted
adding tolerance for equilibrium signals not being available before disruption
1 parent ae4463a commit 8019ba0

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

data/signals.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,16 @@ def fetch_nstx_data(signal_path,shot_num,c):
136136
all_machines = [d3d,jet]
137137

138138
profile_num_channels = 64
139-
etemp_profile = ProfileSignal("Electron temperature profile",["ZIPFIT01/PROFILES.ETEMPFIT"],[d3d],causal_shifts=[10],mapping_range=(0,1),num_channels=profile_num_channels)
140-
edens_profile = ProfileSignal("Electron density profile",["ZIPFIT01/PROFILES.EDENSFIT"],[d3d],causal_shifts=[10],mapping_range=(0,1),num_channels=profile_num_channels)
139+
etemp_profile = ProfileSignal("Electron temperature profile",["ZIPFIT01/PROFILES.ETEMPFIT"],[d3d],causal_shifts=[10],mapping_range=(0,1),num_channels=profile_num_channels,data_avail_tolerance=0.02)
140+
edens_profile = ProfileSignal("Electron density profile",["ZIPFIT01/PROFILES.EDENSFIT"],[d3d],causal_shifts=[10],mapping_range=(0,1),num_channels=profile_num_channels,data_avail_tolerance=0.02)
141141

142142
# epress_profile_spatial = ProfileSignal("Electron pressure profile",["ppf/hrts/pe/"],[jet],causal_shifts=[25],mapping_range=(2,4),num_channels=profile_num_channels)
143-
etemp_profile_spatial = ProfileSignal("Electron temperature profile",["ppf/hrts/te"],[jet],causal_shifts=[25],mapping_range=(2,4),num_channels=profile_num_channels)
144-
edens_profile_spatial = ProfileSignal("Electron density profile",["ppf/hrts/ne"],[jet],causal_shifts=[25],mapping_range=(2,4),num_channels=profile_num_channels)
145-
etemp = Signal("electron temperature",["ppf/hrtx/te0"],[jet],causal_shifts=[25])
143+
etemp_profile_spatial = ProfileSignal("Electron temperature profile",["ppf/hrts/te"],[jet],causal_shifts=[25],mapping_range=(2,4),num_channels=profile_num_channels,data_avail_tolerance=0.05)
144+
edens_profile_spatial = ProfileSignal("Electron density profile",["ppf/hrts/ne"],[jet],causal_shifts=[25],mapping_range=(2,4),num_channels=profile_num_channels,data_avail_tolerance=0.05)
145+
etemp = Signal("electron temperature",["ppf/hrtx/te0"],[jet],causal_shifts=[25],data_avail_tolerance=0.05)
146146
# epress = Signal("electron pressure",["ppf/hrtx/pe0/"],[jet],causal_shifts=[25])
147147

148-
q95 = Signal("q95 safety factor",['ppf/efit/q95',"EFIT01/RESULTS.AEQDSK.Q95"],[jet,d3d],causal_shifts=[15,10],normalize=False)
148+
q95 = Signal("q95 safety factor",['ppf/efit/q95',"EFIT01/RESULTS.AEQDSK.Q95"],[jet,d3d],causal_shifts=[15,10],normalize=False,data_avail_tolerance=0.03)
149149

150150
ip = Signal("plasma current",["jpf/da/c2-ipla","d3d/ipspr15V"],[jet,d3d],is_ip=True) #"d3d/ipsip" was used before, ipspr15V seems to be available for a superset of shots.
151151
iptarget = Signal("plasma current target",["d3d/ipsiptargt"],[d3d])

plasma/primitives/data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# self.signals.append(Signal(signal_descriptions[i],signal_paths[i]))
1616

1717
class Signal(object):
18-
def __init__(self,description,paths,machines,tex_label=None,causal_shifts=None,is_ip=False,normalize=True):
18+
def __init__(self,description,paths,machines,tex_label=None,causal_shifts=None,is_ip=False,normalize=True,data_avail_tolerance=0):
1919
assert(len(paths) == len(machines))
2020
self.description = description
2121
self.paths = paths
@@ -26,6 +26,7 @@ def __init__(self,description,paths,machines,tex_label=None,causal_shifts=None,i
2626
self.is_ip = is_ip
2727
self.num_channels = 1
2828
self.normalize = normalize
29+
self.data_avail_tolerance = data_avail_tolerance
2930

3031
def is_ip(self):
3132
return self.is_ip

plasma/primitives/shots.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,19 +394,27 @@ def get_signals_and_times_from_file(self,conf):
394394
assert(len(t.shape) == 1)
395395
assert(len(t) > 1)
396396
t_min = max(t_min,np.min(t))
397-
t_max = min(t_max,np.max(t))
398397
signal_arrays.append(sig)
399398
time_arrays.append(t)
399+
if self.is_disruptive and self.t_disrupt > np.max(t):
400+
if self.t_disrupt > np.max(t) + signal.data_avail_tolerance:
401+
print('Shot {}: disruption event is not contained in valid time region of signal {} by {}s, omitting.'.format(self.number,signal,self.t_disrupt - np.max(t)))
402+
valid = False
403+
else:
404+
t_max = np.max(t) + signal.data_avail_tolerance
405+
else:
406+
t_max = min(t_max,np.max(t))
407+
400408
assert(t_max > t_min or not valid)
401409
#make sure the shot is long enough.
402410
dt = conf['data']['dt']
403411
if (t_max - t_min)/dt <= (2*conf['model']['length']+conf['data']['T_min_warn']):
404412
print('Shot {} contains insufficient data, omitting.'.format(self.number))
405413
valid = False
406414

407-
if self.is_disruptive and self.t_disrupt > t_max:
408-
print('Shot {}: disruption event is not contained in valid time region by {}s, omitting.'.format(self.number,self.t_disrupt - t_max))
409-
valid = False
415+
# if self.is_disruptive and self.t_disrupt > t_max+conf['data']['data_avail_tolerance']:
416+
# print('Shot {}: disruption event is not contained in valid time region by {}s, omitting.'.format(self.number,self.t_disrupt - t_max))
417+
# valid = False
410418

411419

412420
if self.is_disruptive:

0 commit comments

Comments
 (0)