Skip to content

Commit 14d4a35

Browse files
committed
Remove duplicate d3d/ subdir for 0D signals in hierarchy of signal_data/
1 parent 030f332 commit 14d4a35

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

data/d3d_signals.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
'bmstinj', ] # Total Beam Torque
3333
# 'pcechpwrf'] #Total ECH Power Not always on!
3434

35-
signal_paths = ['d3d/' + path for path in signal_paths]
36-
3735
# 0D EFIT signals
3836
signal_paths += ['EFIT01/RESULTS.AEQDSK.Q95']
3937

plasma/models/targets.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
g.flush_all_inorder()
1616
g.comm.Barrier()
1717

18+
# TODO(KGF): remove unused threshold_range() methods (#54)
19+
20+
# remapper() method, used only in normalize.py, implicitly knows the
21+
# transformation applied to Shot.ttd within Shot.convert_to_ttd()
22+
1823

1924
# Requirement: larger value must mean disruption more likely.
2025
class Target(object):
@@ -28,6 +33,7 @@ def loss_np(y_true, y_pred):
2833

2934
@abc.abstractmethod
3035
def remapper(ttd, T_warning):
36+
# TODO(KGF): base class directly uses ttd=log(TTD+dt/10) quantity
3137
return -ttd
3238

3339
@abc.abstractmethod
@@ -47,6 +53,7 @@ def loss_np(y_true, y_pred):
4753

4854
@staticmethod
4955
def remapper(ttd, T_warning, as_array_of_shots=True):
56+
# TODO(KGF): see below comment in HingeTarget.remapper()
5057
binary_ttd = 0*ttd
5158
mask = ttd < np.log10(T_warning)
5259
binary_ttd[mask] = 1.0
@@ -88,11 +95,11 @@ def loss_np(y_true, y_pred):
8895

8996
@staticmethod
9097
def remapper(ttd, T_warning):
91-
eps = 1e-4
92-
ttd = 10**(ttd)
98+
eps = 1e-4 # hardcoded "avoid division by zero"
99+
ttd = 10**(ttd) # see below comment about undoing log transformation
93100
mask = ttd < T_warning
94101
ttd[~mask] = T_warning
95-
ttd = (1.0)/(ttd+eps) # T_warning
102+
ttd = (1.0)/(ttd + eps)
96103
return ttd
97104

98105
@staticmethod
@@ -111,6 +118,8 @@ def loss_np(y_true, y_pred):
111118

112119
@staticmethod
113120
def remapper(ttd, T_warning):
121+
# TODO(KGF): this next line "undoes" the log-transform in shots.py
122+
# Shot.convert_to_ttd() (except for small offset of +dt/10)
114123
ttd = 10**(ttd)
115124
mask = ttd < T_warning
116125
ttd[~mask] = 0 # T_warning
@@ -184,6 +193,7 @@ def loss_np(y_true, y_pred):
184193

185194
@staticmethod
186195
def remapper(ttd, T_warning, as_array_of_shots=True):
196+
# TODO(KGF): see below comment in HingeTarget.remapper()
187197
binary_ttd = 0*ttd
188198
mask = ttd < np.log10(T_warning)
189199
binary_ttd[mask] = 1.0
@@ -209,6 +219,7 @@ def loss_np(y_true, y_pred):
209219

210220
@staticmethod
211221
def remapper(ttd, T_warning, as_array_of_shots=True):
222+
# TODO(KGF): zeros the ttd=log(TTD+dt/10) (just reuses shape)
212223
binary_ttd = 0*ttd
213224
mask = ttd < np.log10(T_warning)
214225
binary_ttd[mask] = 1.0

0 commit comments

Comments
 (0)