Skip to content

Commit

Permalink
Merge pull request #268 from gafusion/fix_f-coil_currents
Browse files Browse the repository at this point in the history
Fix DIII-D machine mapping for F-coil currents
  • Loading branch information
jmcclena authored Aug 30, 2023
2 parents d3e95c5 + 3356230 commit 3eb8e3c
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions omas/machine_mappings/d3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ def pf_active_hardware(ods, pulse):
mhdin.to_omas(ods, update='pf_active')

coil_names = [
'ECOILA',
'ECOILB',
'E567UP',
'E567DN',
'E89DN',
'E89UP',
'F1A',
'F2A',
'F3A',
Expand All @@ -379,12 +385,6 @@ def pf_active_hardware(ods, pulse):
'F7B',
'F8B',
'F9B',
'ECOILA',
'ECOILB',
'E567UP',
'E567DN',
'E89DN',
'E89UP',
]
for k, fcid in enumerate(coil_names):
ods['pf_active.coil'][k]['name'] = fcid
Expand All @@ -407,7 +407,7 @@ def pf_active_coil_current_data(ods, pulse):
ods1,
pulse,
channels='pf_active.coil',
identifier='pf_active.coil.{channel}.element.0.identifier',
identifier='pf_active.coil.{channel}.identifier',
time='pf_active.coil.{channel}.current.time',
data='pf_active.coil.{channel}.current.data',
validity=None,
Expand All @@ -431,6 +431,15 @@ def pf_active_coil_current_data(ods, pulse):
nt = len(ods[f'pf_active.coil.{k}.current.data'])
ods[f'pf_active.coil.{k}.current.data_error_upper'] = abs(data[identifier][3] * data[identifier][4]) * np.ones(nt) * 10.0

# IMAS stores the current in the coil not multiplied by the number of turns
for channel in ods1['pf_active.coil']:
if f'pf_active.coil.{channel}.current.data' in ods:
if 'F' in f'pf_active.coil.{channel}.identifier':
ods[f'pf_active.coil.{channel}.current.data'] /= ods1[f'pf_active.coil.{channel}.element.0.turns_with_sign']
ods[f'pf_active.coil.{channel}.current.data_error_upper'] /= ods1[f'pf_active.coil.{channel}.element.0.turns_with_sign']
else:
print(f'WARNING: pf_active.coil[{channel}].current.data is missing')


# ================================
@machine_mapping_function(__regression_arguments__, pulse=133221)
Expand Down

0 comments on commit 3eb8e3c

Please sign in to comment.