From 9b30a419c53a263f7e7fcb9d6bd68a68ad996a4d Mon Sep 17 00:00:00 2001 From: +Joseph Timothy McClenaghan Date: Thu, 7 May 2026 13:08:38 -0700 Subject: [PATCH 1/2] add option to pull minimum data for fuse need for gslite --- omas/examples/fuse_data_export.py | 46 ++++++++++++++++++------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/omas/examples/fuse_data_export.py b/omas/examples/fuse_data_export.py index 640fbef07..61201c66c 100644 --- a/omas/examples/fuse_data_export.py +++ b/omas/examples/fuse_data_export.py @@ -8,9 +8,9 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, - EFIT_RUN_ID, PROFILES_RUN_ID, CER_analysis_type="CERQUICK"): + EFIT_RUN_ID, PROFILES_RUN_ID, CER_analysis_type="CERQUICK",pull_gslite_min=False): ods = omas.ODS() - + if len(EFIT_RUN_ID) == 0: EFIT_RUN_ID = None if len(PROFILES_RUN_ID) == 0: @@ -25,9 +25,10 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, # printe("- Fetching nbi data") # d3d.nbi_active_hardware(ods, $shot) - - printe("- Fetching core_profiles data") - d3d.core_profiles_profile_1d(ods, shot, PROFILES_tree=PROFILES_TREE, + + if not pull_gslite_min: + printe("- Fetching core_profiles data") + d3d.core_profiles_profile_1d(ods, shot, PROFILES_tree=PROFILES_TREE, PROFILES_run_id=PROFILES_RUN_ID) printe("- Fetching wall data") @@ -35,29 +36,35 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, printe("- Fetching coils data") d3d.pf_active_hardware(ods, shot) - d3d.pf_active_coil_current_data(ods, shot) + if not pull_gslite_min: + d3d.pf_active_coil_current_data(ods, shot) printe("- Fetching magnetic hardware data") d3d.magnetics_hardware(ods, shot) - printe("- Fetching flux loops data") - d3d.magnetics_floops_data(ods, shot) + if not pull_gslite_min: + printe("- Fetching flux loops data") + d3d.magnetics_floops_data(ods, shot) - printe("- Fetching magnetic probes data") - d3d.magnetics_probes_data(ods, shot) + printe("- Fetching magnetic probes data") + d3d.magnetics_probes_data(ods, shot) - printe("- Fetching Thomson scattering data") - d3d.thomson_scattering_data(ods, shot) + printe("- Fetching Thomson scattering data") + d3d.thomson_scattering_data(ods, shot) printe("- Fetching interferometer data") d3d.interferometer_hardware(ods, shot) - d3d.interferometer_data(ods, shot) + if not pull_gslite_min: + d3d.interferometer_data(ods, shot) - printe("- Fetching charge exchange data") - d3d.charge_exchange_data(ods, shot, analysis_type=CER_analysis_type) + printe("- Fetching charge exchange data") + d3d.charge_exchange_data(ods, shot, analysis_type=CER_analysis_type) - printe("- Fetching summary data") - d3d.summary(ods, shot) + printe("- Fetching summary data") + d3d.summary(ods, shot) + + if pull_gslite_min: + d3d.ip_bt_dflux_data(ods, shot) printe("- Fetching equilibrium data") with ods.open(device, shot, options={'EFIT_tree': EFIT_TREE, "EFIT_run_id": EFIT_RUN_ID}): @@ -95,11 +102,12 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, parser.add_argument('--EFIT_RUN_ID', default="") parser.add_argument('--PROFILES_RUN_ID', default="") parser.add_argument('--CER_ANALYSIS_TYPE', default="CERQUICK") + parser.add_argument("--PULL_GSLITE_MIN", action="store_true") # Parse the arguments args = parser.parse_args() fuse_export(args.save_path, args.device, args.shot, args.EFIT_TREE, args.PROFILES_TREE, args.EFIT_RUN_ID, args.PROFILES_RUN_ID, - args.CER_ANALYSIS_TYPE) - \ No newline at end of file + args.CER_ANALYSIS_TYPE, args.PULL_GSLITE_MIN) + From 69b7c5478babe30accc3bd487a2184dd760a589b Mon Sep 17 00:00:00 2001 From: jmcclena Date: Thu, 7 May 2026 16:21:12 -0700 Subject: [PATCH 2/2] minor clean up --- omas/examples/fuse_data_export.py | 42 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/omas/examples/fuse_data_export.py b/omas/examples/fuse_data_export.py index 61201c66c..ffd9611bc 100644 --- a/omas/examples/fuse_data_export.py +++ b/omas/examples/fuse_data_export.py @@ -7,15 +7,16 @@ import argparse -def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, - EFIT_RUN_ID, PROFILES_RUN_ID, CER_analysis_type="CERQUICK",pull_gslite_min=False): +def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, + EFIT_RUN_ID, PROFILES_RUN_ID, CER_analysis_type="CERQUICK", + pull_gslite_min=False): ods = omas.ODS() if len(EFIT_RUN_ID) == 0: EFIT_RUN_ID = None if len(PROFILES_RUN_ID) == 0: PROFILES_RUN_ID = None - + tic = time.time() if device.lower() != "d3d": raise ValueError(f"Unsupported device {device}. Only 'd3d' supported at present.") @@ -25,24 +26,30 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, # printe("- Fetching nbi data") # d3d.nbi_active_hardware(ods, $shot) - - if not pull_gslite_min: - printe("- Fetching core_profiles data") - d3d.core_profiles_profile_1d(ods, shot, PROFILES_tree=PROFILES_TREE, - PROFILES_run_id=PROFILES_RUN_ID) printe("- Fetching wall data") d3d.wall(ods, shot) - printe("- Fetching coils data") + printe("- Fetching coils hardware data") d3d.pf_active_hardware(ods, shot) - if not pull_gslite_min: - d3d.pf_active_coil_current_data(ods, shot) printe("- Fetching magnetic hardware data") d3d.magnetics_hardware(ods, shot) - if not pull_gslite_min: + printe("- Fetching interferometer hardware data") + d3d.interferometer_hardware(ods, shot) + + if pull_gslite_min: + printe("- Fetching ip/bt/dflux data") + d3d.ip_bt_dflux_data(ods, shot) + else: + printe("- Fetching core_profiles data") + d3d.core_profiles_profile_1d(ods, shot, PROFILES_tree=PROFILES_TREE, + PROFILES_run_id=PROFILES_RUN_ID) + + printe("- Fetching coils current data") + d3d.pf_active_coil_current_data(ods, shot) + printe("- Fetching flux loops data") d3d.magnetics_floops_data(ods, shot) @@ -52,9 +59,7 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, printe("- Fetching Thomson scattering data") d3d.thomson_scattering_data(ods, shot) - printe("- Fetching interferometer data") - d3d.interferometer_hardware(ods, shot) - if not pull_gslite_min: + printe("- Fetching interferometer data") d3d.interferometer_data(ods, shot) printe("- Fetching charge exchange data") @@ -63,9 +68,6 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, printe("- Fetching summary data") d3d.summary(ods, shot) - if pull_gslite_min: - d3d.ip_bt_dflux_data(ods, shot) - printe("- Fetching equilibrium data") with ods.open(device, shot, options={'EFIT_tree': EFIT_TREE, "EFIT_run_id": EFIT_RUN_ID}): for k in range(len(ods["equilibrium.time"])): @@ -88,6 +90,7 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, ods.save(save_path) printe(f" Done in {time.time()-tic:.2f} [s]") + if __name__ == "__main__": parser = argparse.ArgumentParser() @@ -107,7 +110,6 @@ def fuse_export(save_path, device, shot, EFIT_TREE, PROFILES_TREE, # Parse the arguments args = parser.parse_args() - fuse_export(args.save_path, args.device, args.shot, args.EFIT_TREE, + fuse_export(args.save_path, args.device, args.shot, args.EFIT_TREE, args.PROFILES_TREE, args.EFIT_RUN_ID, args.PROFILES_RUN_ID, args.CER_ANALYSIS_TYPE, args.PULL_GSLITE_MIN) -