From 2a0942503f50530eb7487d81e7c5e605d7119959 Mon Sep 17 00:00:00 2001 From: tbechtel Date: Wed, 29 Apr 2026 16:50:24 -0700 Subject: [PATCH] Fix mapping for ec_launchers with the top system This change is also part of a PR for OMAS so that branch needs to be used for testing this. A shot with top launch is added to the config for ec_launchers so that this does not get missed. --- imas_composer/ids/ec_launchers.py | 3 ++- tests/conftest.py | 6 +++--- tests/test_config_ec_launchers.yaml | 10 ++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/imas_composer/ids/ec_launchers.py b/imas_composer/ids/ec_launchers.py index e04639d..17df803 100644 --- a/imas_composer/ids/ec_launchers.py +++ b/imas_composer/ids/ec_launchers.py @@ -6,6 +6,7 @@ from typing import Dict, List import numpy as np +import re from ..core import RequirementStage, Requirement, IDSEntrySpec from .base import IDSMapper @@ -477,7 +478,7 @@ def _compose_launching_position_phi(self, shot: int, raw_data: dict) -> np.ndarr port_key = Requirement(f'.ECH.SYSTEM_{system_no}.ANTENNA.PORT', shot, 'RF').as_key() port_string = raw_data[port_key] - phi = np.deg2rad(float(port_string.split(' ')[0])) + phi = np.deg2rad(float(re.sub(r'[^0-9.+]', '', port_string).split('+')[0])) phi_arrays.append(phi * np.ones(ntime)) diff --git a/tests/conftest.py b/tests/conftest.py index a1ff437..2521baa 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ - OMAS validation: Compare imas_composer output against OMAS reference implementation Test Shot Configuration: -- Default: Tests run on TEST_SHOTS = [202161, 203321, 204602, 204601] +- Default: Tests run on TEST_SHOTS = [202161, 203321, 204601, 204602] - exclude_shots: In test_config_.yaml, skip specific shots (e.g., no data available) - override_shots: In test_config_.yaml, completely replace TEST_SHOTS with custom list Example: For interferometer with RIP data requirement (shots >= 168823): @@ -51,10 +51,10 @@ def _load_yaml_default(yaml_filename: str, key: str, fallback): # Bt | Ip # 202161: - | - # 203321: + | - -# 204602: - | + # 204601: + | + +# 204602: - | + -TEST_SHOTS = [202161, 203321, 204602, 204601] +TEST_SHOTS = [202161, 203321, 204601, 204602] # ============================================================================ diff --git a/tests/test_config_ec_launchers.yaml b/tests/test_config_ec_launchers.yaml index 3914294..0e1312f 100644 --- a/tests/test_config_ec_launchers.yaml +++ b/tests/test_config_ec_launchers.yaml @@ -1,7 +1,7 @@ # Test configuration for EC Launchers IDS -# Only shot 170325 has EC launcher data, exclude all others -exclude_shots: [] +# Include all the standard TEST_SHOTS plus one with top launch +override_shots: [202161, 203321, 204312, 204601, 204602] # Fields to skip OMAS comparison for (composer still tested) # Format: field_path: "reason for skipping" @@ -12,12 +12,14 @@ skip_fields: {} field_shot_exclusions: ec_launchers.beam.spot.size: - 203321 - - 204602 + - 204312 - 204601 + - 204602 ec_launchers.beam.phase.curvature: - 203321 - - 204602 + - 204312 - 204601 + - 204602 # Requirement validation settings requirement_validation: