Skip to content

Commit e2738ea

Browse files
committed
Add comment warning about workaround for JET 0D CW -> ILW preprocessing
1 parent 9585728 commit e2738ea

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

data/signals.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,9 @@ def get_units(str):
8585
if found:
8686
if rank > 1:
8787
xdata = c.get('dim_of(_s,1)').data()
88-
# xunits = get_units('dim_of(_s,1)')
8988
ydata = c.get('dim_of(_s)').data()
90-
# yunits = get_units('dim_of(_s)')
9189
else:
9290
xdata = c.get('dim_of(_s)').data()
93-
# xunits = get_units('dim_of(_s)')
9491

9592
# MDSplus seems to return 2-D arrays transposed. Change them back.
9693
if np.ndim(data) == 2:
@@ -114,16 +111,13 @@ def fetch_jet_data(signal_path, shot_num, c):
114111
data = c.get('_sig=jet("{}/",{})'.format(signal_path, shot_num)).data()
115112
if np.ndim(data) == 2:
116113
data = np.transpose(data)
117-
time = c.get(
118-
'_sig=dim_of(jet("{}/",{}),1)'.format(
119-
signal_path, shot_num)).data()
120-
ydata = c.get(
121-
'_sig=dim_of(jet("{}/",{}),0)'.format(
122-
signal_path, shot_num)).data()
114+
time = c.get('_sig=dim_of(jet("{}/",{}),1)'.format(
115+
signal_path, shot_num)).data()
116+
ydata = c.get('_sig=dim_of(jet("{}/",{}),0)'.format(
117+
signal_path, shot_num)).data()
123118
else:
124-
time = c.get(
125-
'_sig=dim_of(jet("{}/",{}))'.format(
126-
signal_path, shot_num)).data()
119+
time = c.get('_sig=dim_of(jet("{}/",{}))'.format(
120+
signal_path, shot_num)).data()
127121
found = True
128122
except Exception as e:
129123
g.print_unique(e)
@@ -345,6 +339,11 @@ def fetch_nstx_data(signal_path, shot_num, c):
345339
# 'tmamp1':tmamp1, 'tmamp2':tmamp2, 'tmfreq1':tmfreq1, 'tmfreq2':tmfreq2,
346340
# 'pechin':pechin,
347341
# 'rho_profile_spatial':rho_profile_spatial, 'etemp':etemp,
342+
# -----
343+
# TODO(KGF): replace this hacky workaround
344+
# IMPORTANT: must comment-out the following line when preprocessing for
345+
# training on JET CW and testing on JET ILW (FRNN 0D).
346+
# Otherwise 1K+ CW shots are excluded due to missing profile data
348347
'etemp_profile': etemp_profile, 'edens_profile': edens_profile,
349348
# 'itemp_profile':itemp_profile, 'zdens_profile':zdens_profile,
350349
# 'trot_profile':trot_profile, 'pthm_profile':pthm_profile,

examples/guarantee_preprocessed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#####################################################
1212
np.random.seed(0)
1313
random.seed(0)
14-
guarantee_preprocessed(conf)
14+
guarantee_preprocessed(conf, verbose=True)

plasma/primitives/shots.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ def split_train_test(self, conf):
102102
use_shots_train = int(round(train_frac*use_shots))
103103
use_shots_test = int(round((1-train_frac)*use_shots))
104104
if len(shot_files_test) == 0:
105-
# split randomly
105+
# split randomly, e.g. sample both sets from same distribution
106+
# such as D3D test and train
106107
shot_list_train, shot_list_test = train_test_split(
107108
self.shots, train_frac, shuffle_training)
108-
# train and test list given
109+
# train and test list given, e.g. they are sampled from separate
110+
# distributions such as train=CW and test=ILW for JET
109111
else:
110112
shot_list_train = ShotList()
111113
shot_list_train.load_from_shot_list_files_objects(

0 commit comments

Comments
 (0)