Build: #3 failed
Job: Pipeline PR Test 6.6.6 failed
Build log
The build generated 28,815 lines of output. The output is too long and has been truncated to the last 1,000 lines. Download or view full build log.
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_comment[hsd_baseline-config2-] PASSED [ 97%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_comment[hsd_baseline-config3- # This is comment\n] PASSED [ 98%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_comment[hsd_baseline-config4- # This is comment\n] PASSED [ 98%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_comment[hsd_baseline-config5- # This is \n # multi-line comment\n] PASSED [ 98%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_comment[hsd_baseline-config6- # This is \n # multi-line comment\n] PASSED [ 98%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_execution_command[breakpoint-config0-] PASSED [ 98%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_execution_command[hsd_baseline-config1- hsd_baseline()] PASSED [ 98%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_execution_command[hsd_baseline-config2- hsd_baseline(pstr='strval', pint=3)] PASSED [ 98%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_get_execution_command[hsd_importdata-config3- hsd_importdata(vis=vislist)\n\n if importonly:\n raise Exception(IMPORT_ONLY)] PASSED [ 99%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_c2p PASSED [ 99%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_to_procedure PASSED [ 99%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_export[False-] PASSED [ 99%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_export[True-plotlevel='summary'] PASSED [ 99%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_main SKIPPED (Skip testing ma...) [ 99%] |
| 23-Feb-2026 23:05:32 | recipes/recipe_converter_test.py::test_generate_all SKIPPED (Skip te...) [100%] |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | =================================== FAILURES =================================== |
| 23-Feb-2026 23:05:32 | ______________ test_build_fitting_configuration[inp0-None-False] _______________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = {17: 'cspline', 19: 'cspline', 23: 'cspline'}, expected = None |
| 23-Feb-2026 23:05:32 | should_raise = False |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | return |
| 23-Feb-2026 23:05:32 | > cfg = worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:34: |
| 23-Feb-2026 23:05:32 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_id_list = {17: 'cspline', 19: 'cspline', 23: 'cspline'} |
| 23-Feb-2026 23:05:32 | fit_function = [17, 19, 23], ms = None, context = None, switchpoly = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @staticmethod |
| 23-Feb-2026 23:05:32 | def build_fitting_configuration( |
| 23-Feb-2026 23:05:32 | spw_id_list: Union[List[int], set[Any]], |
| 23-Feb-2026 23:05:32 | fit_function: Optional[Union[str, Dict[Union[int, str], str]]] = "cspline", |
| 23-Feb-2026 23:05:32 | ms: MeasurementSet = None, |
| 23-Feb-2026 23:05:32 | context: Context = None, |
| 23-Feb-2026 23:05:32 | switchpoly=True |
| 23-Feb-2026 23:05:32 | ) -> Dict[int, BaselineFitParamConfig]: |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | Convert the fit_function parameter into a dictionary mapping each SPW ID to its BaselineFitParamConfig. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | If fit_function is None or falsy, the default 'cspline' is used. |
| 23-Feb-2026 23:05:32 | If a single string is provided, one BaselineFitParamConfig instance is created and applied to all SPWs. |
| 23-Feb-2026 23:05:32 | If a dictionary is provided, keys are normalized to integers; SPWs not specified default to 'cspline'. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Args: |
| 23-Feb-2026 23:05:32 | switchpoly: |
| 23-Feb-2026 23:05:32 | context: |
| 23-Feb-2026 23:05:32 | ms: Measurement set |
| 23-Feb-2026 23:05:32 | fit_function: The fit function parameter (str, dict, or None). |
| 23-Feb-2026 23:05:32 | spw_id_list: List of spectral window IDs to process. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Raises: |
| 23-Feb-2026 23:05:32 | ValueError: fit_function has unsupported value. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Returns: |
| 23-Feb-2026 23:05:32 | A dictionary mapping each SPW ID (int) to a BaselineFitParamConfig instance. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | valid_functions = {'spline', 'cspline', 'poly', 'polynomial', 'sinusoid'} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, str): |
| 23-Feb-2026 23:05:32 | if fit_function not in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {fit_function}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out = dict.fromkeys( |
| 23-Feb-2026 23:05:32 | spw_id_list, |
| 23-Feb-2026 23:05:32 | BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=fit_function, |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, dict): |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_function_map = dict.fromkeys(spw_id_list, "cspline") |
| 23-Feb-2026 23:05:32 | spw_function_map.update(fit_function) |
| 23-Feb-2026 23:05:32 | heuristics_out = {} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | # Need to fill in the input fit functions. We could make this cleaner without |
| 23-Feb-2026 23:05:32 | # the virtual2real section, but I'm not sure if the keys will match. |
| 23-Feb-2026 23:05:32 | for key, value in spw_function_map.items(): |
| 23-Feb-2026 23:05:32 | # Check that all the functions are supported. |
| 23-Feb-2026 23:05:32 | if not value in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {value}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | _key = context.observing_run.virtual2real_spw_id(key, ms) if context else key |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out[_key] = BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=spw_function_map[key], |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | else: |
| 23-Feb-2026 23:05:32 | > raise ValueError(f"Unsupported fitting function type: {type(fit_function)}") |
| 23-Feb-2026 23:05:32 | E ValueError: Unsupported fitting function type: <class 'list'> |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker.py:662: ValueError |
| 23-Feb-2026 23:05:32 | ____________ test_build_fitting_configuration[inp1-expected1-False] ____________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = {17: 'cspline', 19: 'cspline', 23: 'cspline'}, expected = {} |
| 23-Feb-2026 23:05:32 | should_raise = False |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | return |
| 23-Feb-2026 23:05:32 | > cfg = worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:34: |
| 23-Feb-2026 23:05:32 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_id_list = {17: 'cspline', 19: 'cspline', 23: 'cspline'} |
| 23-Feb-2026 23:05:32 | fit_function = [17, 19, 23], ms = None, context = None, switchpoly = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @staticmethod |
| 23-Feb-2026 23:05:32 | def build_fitting_configuration( |
| 23-Feb-2026 23:05:32 | spw_id_list: Union[List[int], set[Any]], |
| 23-Feb-2026 23:05:32 | fit_function: Optional[Union[str, Dict[Union[int, str], str]]] = "cspline", |
| 23-Feb-2026 23:05:32 | ms: MeasurementSet = None, |
| 23-Feb-2026 23:05:32 | context: Context = None, |
| 23-Feb-2026 23:05:32 | switchpoly=True |
| 23-Feb-2026 23:05:32 | ) -> Dict[int, BaselineFitParamConfig]: |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | Convert the fit_function parameter into a dictionary mapping each SPW ID to its BaselineFitParamConfig. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | If fit_function is None or falsy, the default 'cspline' is used. |
| 23-Feb-2026 23:05:32 | If a single string is provided, one BaselineFitParamConfig instance is created and applied to all SPWs. |
| 23-Feb-2026 23:05:32 | If a dictionary is provided, keys are normalized to integers; SPWs not specified default to 'cspline'. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Args: |
| 23-Feb-2026 23:05:32 | switchpoly: |
| 23-Feb-2026 23:05:32 | context: |
| 23-Feb-2026 23:05:32 | ms: Measurement set |
| 23-Feb-2026 23:05:32 | fit_function: The fit function parameter (str, dict, or None). |
| 23-Feb-2026 23:05:32 | spw_id_list: List of spectral window IDs to process. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Raises: |
| 23-Feb-2026 23:05:32 | ValueError: fit_function has unsupported value. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Returns: |
| 23-Feb-2026 23:05:32 | A dictionary mapping each SPW ID (int) to a BaselineFitParamConfig instance. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | valid_functions = {'spline', 'cspline', 'poly', 'polynomial', 'sinusoid'} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, str): |
| 23-Feb-2026 23:05:32 | if fit_function not in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {fit_function}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out = dict.fromkeys( |
| 23-Feb-2026 23:05:32 | spw_id_list, |
| 23-Feb-2026 23:05:32 | BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=fit_function, |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, dict): |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_function_map = dict.fromkeys(spw_id_list, "cspline") |
| 23-Feb-2026 23:05:32 | spw_function_map.update(fit_function) |
| 23-Feb-2026 23:05:32 | heuristics_out = {} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | # Need to fill in the input fit functions. We could make this cleaner without |
| 23-Feb-2026 23:05:32 | # the virtual2real section, but I'm not sure if the keys will match. |
| 23-Feb-2026 23:05:32 | for key, value in spw_function_map.items(): |
| 23-Feb-2026 23:05:32 | # Check that all the functions are supported. |
| 23-Feb-2026 23:05:32 | if not value in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {value}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | _key = context.observing_run.virtual2real_spw_id(key, ms) if context else key |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out[_key] = BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=spw_function_map[key], |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | else: |
| 23-Feb-2026 23:05:32 | > raise ValueError(f"Unsupported fitting function type: {type(fit_function)}") |
| 23-Feb-2026 23:05:32 | E ValueError: Unsupported fitting function type: <class 'list'> |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker.py:662: ValueError |
| 23-Feb-2026 23:05:32 | _____________ test_build_fitting_configuration[inp2-cspline-False] _____________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = {17: 'cspline', 19: 'cspline', 23: 'cspline'}, expected = 'cspline' |
| 23-Feb-2026 23:05:32 | should_raise = False |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | return |
| 23-Feb-2026 23:05:32 | > cfg = worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:34: |
| 23-Feb-2026 23:05:32 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_id_list = {17: 'cspline', 19: 'cspline', 23: 'cspline'} |
| 23-Feb-2026 23:05:32 | fit_function = [17, 19, 23], ms = None, context = None, switchpoly = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @staticmethod |
| 23-Feb-2026 23:05:32 | def build_fitting_configuration( |
| 23-Feb-2026 23:05:32 | spw_id_list: Union[List[int], set[Any]], |
| 23-Feb-2026 23:05:32 | fit_function: Optional[Union[str, Dict[Union[int, str], str]]] = "cspline", |
| 23-Feb-2026 23:05:32 | ms: MeasurementSet = None, |
| 23-Feb-2026 23:05:32 | context: Context = None, |
| 23-Feb-2026 23:05:32 | switchpoly=True |
| 23-Feb-2026 23:05:32 | ) -> Dict[int, BaselineFitParamConfig]: |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | Convert the fit_function parameter into a dictionary mapping each SPW ID to its BaselineFitParamConfig. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | If fit_function is None or falsy, the default 'cspline' is used. |
| 23-Feb-2026 23:05:32 | If a single string is provided, one BaselineFitParamConfig instance is created and applied to all SPWs. |
| 23-Feb-2026 23:05:32 | If a dictionary is provided, keys are normalized to integers; SPWs not specified default to 'cspline'. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Args: |
| 23-Feb-2026 23:05:32 | switchpoly: |
| 23-Feb-2026 23:05:32 | context: |
| 23-Feb-2026 23:05:32 | ms: Measurement set |
| 23-Feb-2026 23:05:32 | fit_function: The fit function parameter (str, dict, or None). |
| 23-Feb-2026 23:05:32 | spw_id_list: List of spectral window IDs to process. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Raises: |
| 23-Feb-2026 23:05:32 | ValueError: fit_function has unsupported value. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Returns: |
| 23-Feb-2026 23:05:32 | A dictionary mapping each SPW ID (int) to a BaselineFitParamConfig instance. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | valid_functions = {'spline', 'cspline', 'poly', 'polynomial', 'sinusoid'} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, str): |
| 23-Feb-2026 23:05:32 | if fit_function not in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {fit_function}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out = dict.fromkeys( |
| 23-Feb-2026 23:05:32 | spw_id_list, |
| 23-Feb-2026 23:05:32 | BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=fit_function, |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, dict): |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_function_map = dict.fromkeys(spw_id_list, "cspline") |
| 23-Feb-2026 23:05:32 | spw_function_map.update(fit_function) |
| 23-Feb-2026 23:05:32 | heuristics_out = {} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | # Need to fill in the input fit functions. We could make this cleaner without |
| 23-Feb-2026 23:05:32 | # the virtual2real section, but I'm not sure if the keys will match. |
| 23-Feb-2026 23:05:32 | for key, value in spw_function_map.items(): |
| 23-Feb-2026 23:05:32 | # Check that all the functions are supported. |
| 23-Feb-2026 23:05:32 | if not value in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {value}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | _key = context.observing_run.virtual2real_spw_id(key, ms) if context else key |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out[_key] = BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=spw_function_map[key], |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | else: |
| 23-Feb-2026 23:05:32 | > raise ValueError(f"Unsupported fitting function type: {type(fit_function)}") |
| 23-Feb-2026 23:05:32 | E ValueError: Unsupported fitting function type: <class 'list'> |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker.py:662: ValueError |
| 23-Feb-2026 23:05:32 | ____________ test_build_fitting_configuration[inp3-expected3-False] ____________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = {17: 'cspline', 19: 'cspline', 23: 'cspline'}, expected = {30: 'poly'} |
| 23-Feb-2026 23:05:32 | should_raise = False |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | return |
| 23-Feb-2026 23:05:32 | > cfg = worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:34: |
| 23-Feb-2026 23:05:32 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_id_list = {17: 'cspline', 19: 'cspline', 23: 'cspline'} |
| 23-Feb-2026 23:05:32 | fit_function = [17, 19, 23], ms = None, context = None, switchpoly = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @staticmethod |
| 23-Feb-2026 23:05:32 | def build_fitting_configuration( |
| 23-Feb-2026 23:05:32 | spw_id_list: Union[List[int], set[Any]], |
| 23-Feb-2026 23:05:32 | fit_function: Optional[Union[str, Dict[Union[int, str], str]]] = "cspline", |
| 23-Feb-2026 23:05:32 | ms: MeasurementSet = None, |
| 23-Feb-2026 23:05:32 | context: Context = None, |
| 23-Feb-2026 23:05:32 | switchpoly=True |
| 23-Feb-2026 23:05:32 | ) -> Dict[int, BaselineFitParamConfig]: |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | Convert the fit_function parameter into a dictionary mapping each SPW ID to its BaselineFitParamConfig. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | If fit_function is None or falsy, the default 'cspline' is used. |
| 23-Feb-2026 23:05:32 | If a single string is provided, one BaselineFitParamConfig instance is created and applied to all SPWs. |
| 23-Feb-2026 23:05:32 | If a dictionary is provided, keys are normalized to integers; SPWs not specified default to 'cspline'. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Args: |
| 23-Feb-2026 23:05:32 | switchpoly: |
| 23-Feb-2026 23:05:32 | context: |
| 23-Feb-2026 23:05:32 | ms: Measurement set |
| 23-Feb-2026 23:05:32 | fit_function: The fit function parameter (str, dict, or None). |
| 23-Feb-2026 23:05:32 | spw_id_list: List of spectral window IDs to process. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Raises: |
| 23-Feb-2026 23:05:32 | ValueError: fit_function has unsupported value. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Returns: |
| 23-Feb-2026 23:05:32 | A dictionary mapping each SPW ID (int) to a BaselineFitParamConfig instance. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | valid_functions = {'spline', 'cspline', 'poly', 'polynomial', 'sinusoid'} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, str): |
| 23-Feb-2026 23:05:32 | if fit_function not in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {fit_function}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out = dict.fromkeys( |
| 23-Feb-2026 23:05:32 | spw_id_list, |
| 23-Feb-2026 23:05:32 | BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=fit_function, |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, dict): |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_function_map = dict.fromkeys(spw_id_list, "cspline") |
| 23-Feb-2026 23:05:32 | spw_function_map.update(fit_function) |
| 23-Feb-2026 23:05:32 | heuristics_out = {} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | # Need to fill in the input fit functions. We could make this cleaner without |
| 23-Feb-2026 23:05:32 | # the virtual2real section, but I'm not sure if the keys will match. |
| 23-Feb-2026 23:05:32 | for key, value in spw_function_map.items(): |
| 23-Feb-2026 23:05:32 | # Check that all the functions are supported. |
| 23-Feb-2026 23:05:32 | if not value in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {value}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | _key = context.observing_run.virtual2real_spw_id(key, ms) if context else key |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out[_key] = BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=spw_function_map[key], |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | else: |
| 23-Feb-2026 23:05:32 | > raise ValueError(f"Unsupported fitting function type: {type(fit_function)}") |
| 23-Feb-2026 23:05:32 | E ValueError: Unsupported fitting function type: <class 'list'> |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker.py:662: ValueError |
| 23-Feb-2026 23:05:32 | ______________ test_build_fitting_configuration[inp4-poly-False] _______________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = {17: 'poly', 19: 'poly', 23: 'poly'}, expected = 'poly' |
| 23-Feb-2026 23:05:32 | should_raise = False |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | return |
| 23-Feb-2026 23:05:32 | > cfg = worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:34: |
| 23-Feb-2026 23:05:32 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_id_list = {17: 'poly', 19: 'poly', 23: 'poly'}, fit_function = [17, 19, 23] |
| 23-Feb-2026 23:05:32 | ms = None, context = None, switchpoly = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @staticmethod |
| 23-Feb-2026 23:05:32 | def build_fitting_configuration( |
| 23-Feb-2026 23:05:32 | spw_id_list: Union[List[int], set[Any]], |
| 23-Feb-2026 23:05:32 | fit_function: Optional[Union[str, Dict[Union[int, str], str]]] = "cspline", |
| 23-Feb-2026 23:05:32 | ms: MeasurementSet = None, |
| 23-Feb-2026 23:05:32 | context: Context = None, |
| 23-Feb-2026 23:05:32 | switchpoly=True |
| 23-Feb-2026 23:05:32 | ) -> Dict[int, BaselineFitParamConfig]: |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | Convert the fit_function parameter into a dictionary mapping each SPW ID to its BaselineFitParamConfig. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | If fit_function is None or falsy, the default 'cspline' is used. |
| 23-Feb-2026 23:05:32 | If a single string is provided, one BaselineFitParamConfig instance is created and applied to all SPWs. |
| 23-Feb-2026 23:05:32 | If a dictionary is provided, keys are normalized to integers; SPWs not specified default to 'cspline'. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Args: |
| 23-Feb-2026 23:05:32 | switchpoly: |
| 23-Feb-2026 23:05:32 | context: |
| 23-Feb-2026 23:05:32 | ms: Measurement set |
| 23-Feb-2026 23:05:32 | fit_function: The fit function parameter (str, dict, or None). |
| 23-Feb-2026 23:05:32 | spw_id_list: List of spectral window IDs to process. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Raises: |
| 23-Feb-2026 23:05:32 | ValueError: fit_function has unsupported value. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Returns: |
| 23-Feb-2026 23:05:32 | A dictionary mapping each SPW ID (int) to a BaselineFitParamConfig instance. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | valid_functions = {'spline', 'cspline', 'poly', 'polynomial', 'sinusoid'} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, str): |
| 23-Feb-2026 23:05:32 | if fit_function not in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {fit_function}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out = dict.fromkeys( |
| 23-Feb-2026 23:05:32 | spw_id_list, |
| 23-Feb-2026 23:05:32 | BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=fit_function, |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, dict): |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_function_map = dict.fromkeys(spw_id_list, "cspline") |
| 23-Feb-2026 23:05:32 | spw_function_map.update(fit_function) |
| 23-Feb-2026 23:05:32 | heuristics_out = {} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | # Need to fill in the input fit functions. We could make this cleaner without |
| 23-Feb-2026 23:05:32 | # the virtual2real section, but I'm not sure if the keys will match. |
| 23-Feb-2026 23:05:32 | for key, value in spw_function_map.items(): |
| 23-Feb-2026 23:05:32 | # Check that all the functions are supported. |
| 23-Feb-2026 23:05:32 | if not value in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {value}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | _key = context.observing_run.virtual2real_spw_id(key, ms) if context else key |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out[_key] = BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=spw_function_map[key], |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | else: |
| 23-Feb-2026 23:05:32 | > raise ValueError(f"Unsupported fitting function type: {type(fit_function)}") |
| 23-Feb-2026 23:05:32 | E ValueError: Unsupported fitting function type: <class 'list'> |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker.py:662: ValueError |
| 23-Feb-2026 23:05:32 | ____________ test_build_fitting_configuration[inp5-expected5-False] ____________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = {17: 'cspline', 19: 'cspline', 23: 'poly'}, expected = {'23': 'poly'} |
| 23-Feb-2026 23:05:32 | should_raise = False |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | return |
| 23-Feb-2026 23:05:32 | > cfg = worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:34: |
| 23-Feb-2026 23:05:32 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_id_list = {17: 'cspline', 19: 'cspline', 23: 'poly'} |
| 23-Feb-2026 23:05:32 | fit_function = [17, 19, 23], ms = None, context = None, switchpoly = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @staticmethod |
| 23-Feb-2026 23:05:32 | def build_fitting_configuration( |
| 23-Feb-2026 23:05:32 | spw_id_list: Union[List[int], set[Any]], |
| 23-Feb-2026 23:05:32 | fit_function: Optional[Union[str, Dict[Union[int, str], str]]] = "cspline", |
| 23-Feb-2026 23:05:32 | ms: MeasurementSet = None, |
| 23-Feb-2026 23:05:32 | context: Context = None, |
| 23-Feb-2026 23:05:32 | switchpoly=True |
| 23-Feb-2026 23:05:32 | ) -> Dict[int, BaselineFitParamConfig]: |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | Convert the fit_function parameter into a dictionary mapping each SPW ID to its BaselineFitParamConfig. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | If fit_function is None or falsy, the default 'cspline' is used. |
| 23-Feb-2026 23:05:32 | If a single string is provided, one BaselineFitParamConfig instance is created and applied to all SPWs. |
| 23-Feb-2026 23:05:32 | If a dictionary is provided, keys are normalized to integers; SPWs not specified default to 'cspline'. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Args: |
| 23-Feb-2026 23:05:32 | switchpoly: |
| 23-Feb-2026 23:05:32 | context: |
| 23-Feb-2026 23:05:32 | ms: Measurement set |
| 23-Feb-2026 23:05:32 | fit_function: The fit function parameter (str, dict, or None). |
| 23-Feb-2026 23:05:32 | spw_id_list: List of spectral window IDs to process. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Raises: |
| 23-Feb-2026 23:05:32 | ValueError: fit_function has unsupported value. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Returns: |
| 23-Feb-2026 23:05:32 | A dictionary mapping each SPW ID (int) to a BaselineFitParamConfig instance. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | valid_functions = {'spline', 'cspline', 'poly', 'polynomial', 'sinusoid'} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, str): |
| 23-Feb-2026 23:05:32 | if fit_function not in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {fit_function}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out = dict.fromkeys( |
| 23-Feb-2026 23:05:32 | spw_id_list, |
| 23-Feb-2026 23:05:32 | BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=fit_function, |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, dict): |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_function_map = dict.fromkeys(spw_id_list, "cspline") |
| 23-Feb-2026 23:05:32 | spw_function_map.update(fit_function) |
| 23-Feb-2026 23:05:32 | heuristics_out = {} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | # Need to fill in the input fit functions. We could make this cleaner without |
| 23-Feb-2026 23:05:32 | # the virtual2real section, but I'm not sure if the keys will match. |
| 23-Feb-2026 23:05:32 | for key, value in spw_function_map.items(): |
| 23-Feb-2026 23:05:32 | # Check that all the functions are supported. |
| 23-Feb-2026 23:05:32 | if not value in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {value}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | _key = context.observing_run.virtual2real_spw_id(key, ms) if context else key |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out[_key] = BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=spw_function_map[key], |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | else: |
| 23-Feb-2026 23:05:32 | > raise ValueError(f"Unsupported fitting function type: {type(fit_function)}") |
| 23-Feb-2026 23:05:32 | E ValueError: Unsupported fitting function type: <class 'list'> |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker.py:662: ValueError |
| 23-Feb-2026 23:05:32 | ____________ test_build_fitting_configuration[inp6-expected6-False] ____________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = {17: 'poly', 19: 'cspline', 23: 'cspline'} |
| 23-Feb-2026 23:05:32 | expected = {'17': 'poly', 19: 'cspline'}, should_raise = False |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | return |
| 23-Feb-2026 23:05:32 | > cfg = worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:34: |
| 23-Feb-2026 23:05:32 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_id_list = {17: 'poly', 19: 'cspline', 23: 'cspline'} |
| 23-Feb-2026 23:05:32 | fit_function = [17, 19, 23], ms = None, context = None, switchpoly = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @staticmethod |
| 23-Feb-2026 23:05:32 | def build_fitting_configuration( |
| 23-Feb-2026 23:05:32 | spw_id_list: Union[List[int], set[Any]], |
| 23-Feb-2026 23:05:32 | fit_function: Optional[Union[str, Dict[Union[int, str], str]]] = "cspline", |
| 23-Feb-2026 23:05:32 | ms: MeasurementSet = None, |
| 23-Feb-2026 23:05:32 | context: Context = None, |
| 23-Feb-2026 23:05:32 | switchpoly=True |
| 23-Feb-2026 23:05:32 | ) -> Dict[int, BaselineFitParamConfig]: |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | Convert the fit_function parameter into a dictionary mapping each SPW ID to its BaselineFitParamConfig. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | If fit_function is None or falsy, the default 'cspline' is used. |
| 23-Feb-2026 23:05:32 | If a single string is provided, one BaselineFitParamConfig instance is created and applied to all SPWs. |
| 23-Feb-2026 23:05:32 | If a dictionary is provided, keys are normalized to integers; SPWs not specified default to 'cspline'. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Args: |
| 23-Feb-2026 23:05:32 | switchpoly: |
| 23-Feb-2026 23:05:32 | context: |
| 23-Feb-2026 23:05:32 | ms: Measurement set |
| 23-Feb-2026 23:05:32 | fit_function: The fit function parameter (str, dict, or None). |
| 23-Feb-2026 23:05:32 | spw_id_list: List of spectral window IDs to process. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Raises: |
| 23-Feb-2026 23:05:32 | ValueError: fit_function has unsupported value. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Returns: |
| 23-Feb-2026 23:05:32 | A dictionary mapping each SPW ID (int) to a BaselineFitParamConfig instance. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | valid_functions = {'spline', 'cspline', 'poly', 'polynomial', 'sinusoid'} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, str): |
| 23-Feb-2026 23:05:32 | if fit_function not in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {fit_function}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out = dict.fromkeys( |
| 23-Feb-2026 23:05:32 | spw_id_list, |
| 23-Feb-2026 23:05:32 | BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=fit_function, |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, dict): |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_function_map = dict.fromkeys(spw_id_list, "cspline") |
| 23-Feb-2026 23:05:32 | spw_function_map.update(fit_function) |
| 23-Feb-2026 23:05:32 | heuristics_out = {} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | # Need to fill in the input fit functions. We could make this cleaner without |
| 23-Feb-2026 23:05:32 | # the virtual2real section, but I'm not sure if the keys will match. |
| 23-Feb-2026 23:05:32 | for key, value in spw_function_map.items(): |
| 23-Feb-2026 23:05:32 | # Check that all the functions are supported. |
| 23-Feb-2026 23:05:32 | if not value in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {value}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | _key = context.observing_run.virtual2real_spw_id(key, ms) if context else key |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out[_key] = BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=spw_function_map[key], |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | else: |
| 23-Feb-2026 23:05:32 | > raise ValueError(f"Unsupported fitting function type: {type(fit_function)}") |
| 23-Feb-2026 23:05:32 | E ValueError: Unsupported fitting function type: <class 'list'> |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker.py:662: ValueError |
| 23-Feb-2026 23:05:32 | ____________ test_build_fitting_configuration[inp7-expected7-False] ____________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = {17: 'poly', 19: 'cspline', 23: 'poly'} |
| 23-Feb-2026 23:05:32 | expected = {17: 'poly', 19: 'cspline', 23: 'poly'}, should_raise = False |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | return |
| 23-Feb-2026 23:05:32 | > cfg = worker.build_fitting_configuration(inp, SPWS) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:34: |
| 23-Feb-2026 23:05:32 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_id_list = {17: 'poly', 19: 'cspline', 23: 'poly'} |
| 23-Feb-2026 23:05:32 | fit_function = [17, 19, 23], ms = None, context = None, switchpoly = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @staticmethod |
| 23-Feb-2026 23:05:32 | def build_fitting_configuration( |
| 23-Feb-2026 23:05:32 | spw_id_list: Union[List[int], set[Any]], |
| 23-Feb-2026 23:05:32 | fit_function: Optional[Union[str, Dict[Union[int, str], str]]] = "cspline", |
| 23-Feb-2026 23:05:32 | ms: MeasurementSet = None, |
| 23-Feb-2026 23:05:32 | context: Context = None, |
| 23-Feb-2026 23:05:32 | switchpoly=True |
| 23-Feb-2026 23:05:32 | ) -> Dict[int, BaselineFitParamConfig]: |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | Convert the fit_function parameter into a dictionary mapping each SPW ID to its BaselineFitParamConfig. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | If fit_function is None or falsy, the default 'cspline' is used. |
| 23-Feb-2026 23:05:32 | If a single string is provided, one BaselineFitParamConfig instance is created and applied to all SPWs. |
| 23-Feb-2026 23:05:32 | If a dictionary is provided, keys are normalized to integers; SPWs not specified default to 'cspline'. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Args: |
| 23-Feb-2026 23:05:32 | switchpoly: |
| 23-Feb-2026 23:05:32 | context: |
| 23-Feb-2026 23:05:32 | ms: Measurement set |
| 23-Feb-2026 23:05:32 | fit_function: The fit function parameter (str, dict, or None). |
| 23-Feb-2026 23:05:32 | spw_id_list: List of spectral window IDs to process. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Raises: |
| 23-Feb-2026 23:05:32 | ValueError: fit_function has unsupported value. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | Returns: |
| 23-Feb-2026 23:05:32 | A dictionary mapping each SPW ID (int) to a BaselineFitParamConfig instance. |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | """ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | valid_functions = {'spline', 'cspline', 'poly', 'polynomial', 'sinusoid'} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, str): |
| 23-Feb-2026 23:05:32 | if fit_function not in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {fit_function}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out = dict.fromkeys( |
| 23-Feb-2026 23:05:32 | spw_id_list, |
| 23-Feb-2026 23:05:32 | BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=fit_function, |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | if isinstance(fit_function, dict): |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | spw_function_map = dict.fromkeys(spw_id_list, "cspline") |
| 23-Feb-2026 23:05:32 | spw_function_map.update(fit_function) |
| 23-Feb-2026 23:05:32 | heuristics_out = {} |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | # Need to fill in the input fit functions. We could make this cleaner without |
| 23-Feb-2026 23:05:32 | # the virtual2real section, but I'm not sure if the keys will match. |
| 23-Feb-2026 23:05:32 | for key, value in spw_function_map.items(): |
| 23-Feb-2026 23:05:32 | # Check that all the functions are supported. |
| 23-Feb-2026 23:05:32 | if not value in valid_functions: |
| 23-Feb-2026 23:05:32 | raise ValueError(f"Unsupported fitting function value: {value}") |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | _key = context.observing_run.virtual2real_spw_id(key, ms) if context else key |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | heuristics_out[_key] = BaselineFitParamConfig( |
| 23-Feb-2026 23:05:32 | fitfunc=spw_function_map[key], |
| 23-Feb-2026 23:05:32 | switchpoly=switchpoly |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | return heuristics_out |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | else: |
| 23-Feb-2026 23:05:32 | > raise ValueError(f"Unsupported fitting function type: {type(fit_function)}") |
| 23-Feb-2026 23:05:32 | E ValueError: Unsupported fitting function type: <class 'list'> |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker.py:662: ValueError |
| 23-Feb-2026 23:05:32 | __________ test_build_fitting_configuration[ValueError-badfunc-True] ___________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = <class 'ValueError'>, expected = 'badfunc', should_raise = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | > with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | E TypeError: expected exception must be a BaseException type, not str |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:31: TypeError |
| 23-Feb-2026 23:05:32 | _________ test_build_fitting_configuration[ValueError-expected9-True] __________ |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | inp = <class 'ValueError'>, expected = {19: 'invalid'}, should_raise = True |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | @pytest.mark.parametrize( |
| 23-Feb-2026 23:05:32 | "inp, expected, should_raise", |
| 23-Feb-2026 23:05:32 | [ |
| 23-Feb-2026 23:05:32 | # valid inputs |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, None, False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {}, False), |
| 23-Feb-2026 23:05:32 | ({17: "cspline", 19: "cspline", 23: "cspline"}, "cspline", False), # SPLINE = CSPLINE in the FittingFunction class of fitrorder.py |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: DEF}, {30: "poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17: "poly", 19: "poly", 23: "poly"}, "poly", False), |
| 23-Feb-2026 23:05:32 | ({17: DEF, 19: DEF, 23: "poly"}, {"23":"poly"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23: DEF}, {"17":"poly", 19:"cspline"}, False), |
| 23-Feb-2026 23:05:32 | ({17:"poly", 19:"cspline", 23:"poly"}, {17:"poly", 19:"cspline", 23:"poly"}, False), |
| 23-Feb-2026 23:05:32 | # error inputs |
| 23-Feb-2026 23:05:32 | (ValueError, "badfunc", True), |
| 23-Feb-2026 23:05:32 | (ValueError, {19:"invalid"}, True), |
| 23-Feb-2026 23:05:32 | ], |
| 23-Feb-2026 23:05:32 | ) |
| 23-Feb-2026 23:05:32 | def test_build_fitting_configuration(inp, expected, should_raise): |
| 23-Feb-2026 23:05:32 | if should_raise: |
| 23-Feb-2026 23:05:32 | > with pytest.raises(expected): |
| 23-Feb-2026 23:05:32 | E TypeError: expected exception must be a BaseException type, not int |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | hsd/tasks/baseline/worker_test.py:31: TypeError |
| 23-Feb-2026 23:05:32 | =============================== warnings summary =============================== |
| 23-Feb-2026 23:05:32 | pipeline/hifa/tasks/applycal/ampphase_vs_freq_qa_test.py::test_score_all_scans |
| 23-Feb-2026 23:05:32 | /home/casatest/casa-build-utils/pipeline/workdir/casa-6.6.6-18-py3.10.el8/lib/py/lib/python3.10/site-packages/numpy/ma/core.py:489: ComplexWarning: Casting complex values to real discards the imaginary part |
| 23-Feb-2026 23:05:32 | fill_value = np.asarray(fill_value, dtype=ndtype) |
| 23-Feb-2026 23:05:32 | |
| 23-Feb-2026 23:05:32 | -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html |
| 23-Feb-2026 23:05:32 | - generated xml file: /home/casatest/casa-build-utils/pipeline/workdir/pipeline_test_result.xml - |
| 23-Feb-2026 23:05:32 | =========================== short test summary info ============================ |
| 23-Feb-2026 23:05:32 | SKIPPED [2] h/tasks/common/atmutil_test.py:213: need_vis |
| 23-Feb-2026 23:05:32 | SKIPPED [3] h/tasks/common/atmutil_test.py:233: need_vis |
| 23-Feb-2026 23:05:32 | SKIPPED [2] h/tasks/common/atmutil_test.py:251: need_vis |
| 23-Feb-2026 23:05:33 | SKIPPED [1] infrastructure/daskhelpers_test.py:80: dask not installed |
| 23-Feb-2026 23:05:33 | SKIPPED [1] infrastructure/daskhelpers_test.py:146: dask not installed |
| 23-Feb-2026 23:05:33 | SKIPPED [1] infrastructure/daskhelpers_test.py:195: dask not installed |
| 23-Feb-2026 23:05:33 | SKIPPED [1] recipes/recipe_converter_test.py:375: Skip testing main. Its output must be carefully examined by developer. |
| 23-Feb-2026 23:05:33 | SKIPPED [1] recipes/recipe_converter_test.py:380: Skip testing generate_all. Its output must be carefully examined by developer. |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[inp0-None-False] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[inp1-expected1-False] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[inp2-cspline-False] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[inp3-expected3-False] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[inp4-poly-False] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[inp5-expected5-False] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[inp6-expected6-False] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[inp7-expected7-False] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[ValueError-badfunc-True] |
| 23-Feb-2026 23:05:33 | FAILED hsd/tasks/baseline/worker_test.py::test_build_fitting_configuration[ValueError-expected9-True] |
| 23-Feb-2026 23:05:33 | ====== 10 failed, 656 passed, 12 skipped, 1 warning in 675.36s (0:11:15) ======= |
| 23-Feb-2026 23:05:33 | 1 |
| 23-Feb-2026 23:05:33 | mkdir: cannot create directory 'workdir': File exists |
| 23-Feb-2026 23:05:34 | Finished task 'Test' with result: Success |
| 23-Feb-2026 23:05:34 | All conditions for task 'JUnit Parser' were met. Conditions: Variable bamboo.repository.pr.targetBranch matches pattern main |
| 23-Feb-2026 23:05:34 | Starting task 'JUnit Parser' of type 'com.atlassian.bamboo.plugins.testresultparser:task.testresultparser.junit' |
| 23-Feb-2026 23:05:34 | Parsing test results under /export/home/cbt-pipeline-test/ci-workspace/bamboohome/xml-data/build-dir/PIPE-PPRT1297-PPT666... |
| 23-Feb-2026 23:05:34 | Failing task since 10 failing test cases were found. |
| 23-Feb-2026 23:05:34 | Finished task 'JUnit Parser' with result: Failed |
| 23-Feb-2026 23:05:34 | Starting task 'Cleanup' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script' |
| 23-Feb-2026 23:05:34 | Beginning to execute external process for build 'Pipeline - Pipeline Pull Request Test - PIPE-2893-hsd_baseline-enable-sinusoid-option - Pipeline PR Test 6.6.6 #3 (PIPE-PPRT1297-PPT666-3)' ... running command line: /export/home/cbt-pipeline-test/ci-workspace/bamboohome/temp/PIPE-PPRT1297-PPT666-3-ScriptBuildTask-4495502557508098846.sh ... in: /export/home/cbt-pipeline-test/ci-workspace/bamboohome/xml-data/build-dir/PIPE-PPRT1297-PPT666 |
| 23-Feb-2026 23:05:34 | Starting cleanup |
| 23-Feb-2026 23:05:34 | Error response from daemon: No such container: pipeline-test |
| 23-Feb-2026 23:05:34 | Error response from daemon: No such container: pipeline-test |
| 23-Feb-2026 23:05:34 | Cleanup complete |
| 23-Feb-2026 23:05:34 | Finished task 'Cleanup' with result: Success |
| 23-Feb-2026 23:05:34 | Running post build plugin 'Docker Container Cleanup' |
| 23-Feb-2026 23:05:34 | Beginning to execute external process for build 'Pipeline - Pipeline Pull Request Test - PIPE-2893-hsd_baseline-enable-sinusoid-option - Pipeline PR Test 6.6.6 #3 (PIPE-PPRT1297-PPT666-3)' ... running command line: /usr/bin/docker rm -f pipelinetest ... in: /export/home/cbt-pipeline-test/ci-workspace/bamboohome/xml-data/build-dir/PIPE-PPRT1297-PPT666 |
| 23-Feb-2026 23:05:38 | pipelinetest |
| 23-Feb-2026 23:05:38 | Running post build plugin 'NCover Results Collector' |
| 23-Feb-2026 23:05:38 | Running post build plugin 'Build Results Label Collector' |
| 23-Feb-2026 23:05:38 | Running post build plugin 'Clover Results Collector' |
| 23-Feb-2026 23:05:38 | Running post build plugin 'npm Cache Cleanup' |
| 23-Feb-2026 23:05:38 | Running post build plugin 'Artifact Copier' |
| 23-Feb-2026 23:05:38 | Publishing an artifact: Result xml |
| 23-Feb-2026 23:05:38 | Finished publishing of artifact Non required job artifact Http Compression On : [Result xml], patterns: [pipeline_test_result.xml] anchored at: [pkgout] in 129.5 ms |
| 23-Feb-2026 23:05:38 | Finalising the build... |
| 23-Feb-2026 23:05:38 | Stopping timer. |
| 23-Feb-2026 23:05:38 | Build PIPE-PPRT1297-PPT666-3 completed. |
| 23-Feb-2026 23:05:38 | Running on server: post build plugin 'Build Hanging Detection Configuration' |
| 23-Feb-2026 23:05:38 | Running on server: post build plugin 'NCover Results Collector' |
| 23-Feb-2026 23:05:38 | Running on server: post build plugin 'Build Labeller' |
| 23-Feb-2026 23:05:38 | Running on server: post build plugin 'Clover Delta Calculator' |
| 23-Feb-2026 23:05:38 | Running on server: post build plugin 'Maven Dependencies Postprocessor' |
| 23-Feb-2026 23:05:38 | All post build plugins have finished |
| 23-Feb-2026 23:05:38 | Generating build results summary... |
| 23-Feb-2026 23:05:38 | Saving build results to disk... |
| 23-Feb-2026 23:05:38 | Store variable context... |
| 23-Feb-2026 23:05:38 | Finished building PIPE-PPRT1297-PPT666-3. |