Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
402 changes: 402 additions & 0 deletions omas/machine_mappings/_efit_no_py2tdi.json

Large diffs are not rendered by default.

129 changes: 0 additions & 129 deletions omas/machine_mappings/_efit_toksearch.json

This file was deleted.

5 changes: 1 addition & 4 deletions omas/machine_mappings/d3d.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"__cocos_rules__": {},
"__include__": [
"_common",
"_efit"
"_efit_no_py2tdi"
],
"__mdsserver__": "atlas.gat.com:8000",
"__options__": {
Expand All @@ -21,9 +21,6 @@
"revision": "BLESSED",
"store_differential": false
},
"__toksearch_overrides__": [
"_efit_toksearch"
],
"bolometer.channel.:": {
"PYTHON": "bolometer_hardware(ods, {pulse})"
},
Expand Down
52 changes: 29 additions & 23 deletions omas/machine_mappings/d3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ def charge_exchange_data(ods, pulse, analysis_type='CERQUICK', _measurements=Tru
else:
pos1 = pos
TDIs[f'{sub}_{channel}_{pos}__data'] = f"CER.{analysis_type}.{sub}.CHANNEL{channel:02d}.{pos1}"
TDIs[f'{sub}_{channel}_{pos}__time'] = f"dim_of(CER.{analysis_type}.{sub}.CHANNEL{channel:02d}.{pos1}, 0)/1000"
TDIs[f'{sub}_{channel}_{pos}__time'] = f"dim_of(CER.{analysis_type}.{sub}.CHANNEL{channel:02d}.{pos1}, 0)"
for pos in ['FZ', 'ZEFF', 'NZ']:
look_up[f'{sub}_{channel}_{pos}__data'] = f"TCL('decomp IMPDENS.{analysis_type}.{pos}{sub[0]}{channel}', _output), _output"

Expand All @@ -1737,7 +1737,7 @@ def charge_exchange_data(ods, pulse, analysis_type='CERQUICK', _measurements=Tru
else:
assert impcon_tree_name==tree_name, "References to multiple IMCPON trees in one IMPDENS analysis type are not supported."
impcon_TDIs[key] = new_path
impcon_TDIs[key.replace("_data", "_time")] = f"dim_of({new_path},0)/1000"
impcon_TDIs[key.replace("_data", "_time")] = f"dim_of({new_path},0)"
# fetch
data = provider.raw('IONS', pulse, TDIs)
if sys.version_info >= (3, 9):
Expand All @@ -1754,7 +1754,6 @@ def charge_exchange_data(ods, pulse, analysis_type='CERQUICK', _measurements=Tru
postime = data[f'{sub}_{channel}_TIME']
if isinstance(postime, Exception):
continue
postime = postime / 1000.0 # Convert ms to s
ch = ods['charge_exchange.channel.+'] # + does the next channel
ch['name'] = 'impCER_{}{:02d}'.format(sub, channel)
ch['identifier'] = '{}{:02d}'.format(sub[0], channel)
Expand All @@ -1770,20 +1769,20 @@ def charge_exchange_data(ods, pulse, analysis_type='CERQUICK', _measurements=Tru
chpos['data'] = posdat * -np.pi / 180.0 if pos == 'VIEW_PHI' and not isinstance(posdat, Exception) else posdat
if _measurements:
if not isinstance(data[f'{sub}_{channel}_TEMP__data'], Exception):
ch['ion.0.t_i.time'] = data[f'{sub}_{channel}_TEMP__time']
ch['ion.0.t_i.time'] = data[f'{sub}_{channel}_TEMP__time'] / 1000.e0
ch['ion.0.t_i.data'] = unumpy.uarray(data[f'{sub}_{channel}_TEMP__data'],
data[f'{sub}_{channel}_TEMP_ERR_PS__data']
+ data[f'{sub}_{channel}_TEMP_ERR__data'])
if not isinstance(data[f'{sub}_{channel}_ROT__data'], Exception):
ch['ion.0.velocity_tor.time'] = data[f'{sub}_{channel}_ROT__time']
ch['ion.0.velocity_tor.time'] = data[f'{sub}_{channel}_ROT__time']/1000.0
ch['ion.0.velocity_tor.data'] = unumpy.uarray(data[f'{sub}_{channel}_ROT__data'] * 1000.0,
data[f'{sub}_{channel}_ROT_ERR_PS__data'] * 1000.0
+ data[f'{sub}_{channel}_ROT_ERR__data'] * 1000.0) # from Km/s to m/s
if not isinstance(data[f'{sub}_{channel}_FZ__data'], Exception):
ch['ion.0.n_i_over_n_e.time'] = data[f'{sub}_{channel}_FZ__time']/1000.0
ch['ion.0.n_i_over_n_e.data'] = data[f'{sub}_{channel}_FZ__data'] * 0.01
if not isinstance(data[f'{sub}_{channel}_NZ__data'], Exception):
ch['ion.0.n_i.time'] = data[f'{sub}_{channel}_FZ__time']
ch['ion.0.n_i.time'] = data[f'{sub}_{channel}_FZ__time']/1000.0
ch['ion.0.n_i.data'] = data[f'{sub}_{channel}_NZ__data']
if not isinstance(data[f'{sub}_{channel}_ZEFF__data'], Exception):
ch['zeff.time'] = data[f'{sub}_{channel}_ZEFF__time'] / 1000.0
Expand Down Expand Up @@ -1840,21 +1839,21 @@ def magnetics_floops_data(ods, pulse, store_differential=False, nref=0):
if pulse > shot:
compshot = shot
break
for compsig in comp[compshot]:
if compsig == 'N1COIL' and pulse > 112962:
for compsig_name in comp[compshot]:
if compsig_name == 'N1COIL' and pulse > 112962:
continue
provider = ods.get_mds_provider('d3d')
compsig_data = provider.data(None, pulse, f'ptdata("{compsig}",{pulse})')
compsig_time = provider.dim_of(None, pulse, f'ptdata("{compsig}",{pulse})', 0) / 1000.0
compsig_data = provider.data(None, pulse, f'ptdata("{compsig_name}",{pulse})')
compsig_time = provider.dim_of(None, pulse, f'ptdata("{compsig_name}",{pulse})', 0) / 1000.0
for channel in ods['magnetics.flux_loop']:
if f'magnetics.flux_loop.{channel}.identifier' in ods1 and ods[f'magnetics.flux_loop.{channel}.flux.validity'] >= 0:
sig = ods1[f'magnetics.flux_loop.{channel}.identifier']
if sig in comp[compshot][compsig]:
if sig in comp[compshot][compsig_name]:
sigraw_time = ods[f'magnetics.flux_loop.{channel}.flux.time']
compsig_data_interp = np.interp(sigraw_time, compsig_time, compsig_data)
ods[f'magnetics.flux_loop.{channel}.flux.data'] -= comp[compshot][compsig][sig] * compsig_data_interp
ods[f'magnetics.flux_loop.{channel}.flux.data'] -= comp[compshot][compsig_name][sig] * compsig_data_interp
else:
printe(f"No {compsig} compensation for {sig}, skipping")
printe(f"No {compsig_name} compensation for {sig}, skipping")

# Fetch uncertainties
TDIs = {}
Expand Down Expand Up @@ -1988,24 +1987,31 @@ def magnetics_probes_data(ods, pulse):
if pulse > shot:
compshot = shot
break
for compsig in comp[compshot]:
if compsig == 'N1COIL' and pulse > 112962:
continue
provider = ods.get_mds_provider('d3d')
compsig_data = provider.data(None, pulse, f"[ptdata2(\"{compsig}\",{pulse})]")
compsig_time = provider.dim_of(None, pulse, f"[ptdata2(\"{compsig}\",{pulse})]", 0) / 1000.0
compsig_TDIs = {}
if pulse > 112962 and 'N1COIL' in comp[compshot]:
comp[compshot].pop('N1COIL')
for compsig_name in comp[compshot]:
compsig_TDIs[compsig_name] = f"ptdata2(\"{compsig_name}\",{pulse})"
compsig_TDIs[compsig_name+"_time"] = f"dim_of(ptdata2(\"{compsig_name}\",{pulse}),0)"

provider = ods.get_mds_provider('d3d')
compsig_data = provider.raw(None, pulse, compsig_TDIs)

for compsig_name in comp[compshot]:
compsig = compsig_data[compsig_name]
compsig_time = compsig_data[compsig_name+"_time"] * 1.e-3
for channel in ods1['magnetics.b_field_pol_probe']:
if (
f'magnetics.b_field_pol_probe.{channel}.identifier' in ods1
and ods[f'magnetics.b_field_pol_probe.{channel}.field.validity'] >= 0
):
sig = ods1[f'magnetics.b_field_pol_probe.{channel}.identifier']
if sig in comp[compshot][compsig]:
if sig in comp[compshot][compsig_name]:
sigraw_time = ods[f'magnetics.b_field_pol_probe.{channel}.field.time']
compsig_data_interp = np.interp(sigraw_time, compsig_time, compsig_data)
ods[f'magnetics.b_field_pol_probe.{channel}.field.data'] -= comp[compshot][compsig][sig] * compsig_data_interp
compsig_data_interp = np.interp(sigraw_time, compsig_time, compsig)
ods[f'magnetics.b_field_pol_probe.{channel}.field.data'] -= comp[compshot][compsig_name][sig] * compsig_data_interp
else:
printe(f"No {compsig} compensation for {sig}, skipping")
printe(f"No {compsig_name} compensation for {sig}, skipping")


# Fetch uncertainties
Expand Down
Loading
Loading