From 88a18848f1598bfc1171bb667c6c9ec352412bcd Mon Sep 17 00:00:00 2001 From: Todd Schumann Date: Mon, 15 Jul 2024 10:22:42 -0600 Subject: [PATCH] Add test for multi-antennas --- .../tests/test_differential_calibration.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scos_actions/calibration/tests/test_differential_calibration.py b/scos_actions/calibration/tests/test_differential_calibration.py index 5c9c80ca..0f156dac 100644 --- a/scos_actions/calibration/tests/test_differential_calibration.py +++ b/scos_actions/calibration/tests/test_differential_calibration.py @@ -16,15 +16,30 @@ def setup_differential_calibration_file(self, tmp_path: Path): "calibration_reference": "antenna input", "calibration_data": {3555e6: 11.5}, } + dict_to_json_multiple_antenna = { + "calibration_parameters": ["rf_path", "frequency"], + "calibration_reference": "antenna input", + "calibration_data": { + "antenna1": {3555e6: 11.5}, + "antenna2": {3555e6: 21.5}, + } + } self.valid_file_path = tmp_path / "sample_diff_cal.json" + self.valid_file_path_multiple_antenna = tmp_path / "sample_diff_cal_multiple_antenna.json" self.invalid_file_path = tmp_path / "sample_diff_cal_invalid.json" self.sample_diff_cal = DifferentialCalibration( file_path=self.valid_file_path, **dict_to_json ) + self.sample_diff_cal_multiple_antenna = DifferentialCalibration( + file_path=self.valid_file_path_multiple_antenna, **dict_to_json_multiple_antenna + ) with open(self.valid_file_path, "w") as f: f.write(json.dumps(dict_to_json)) + + with open(self.valid_file_path_multiple_antenna, "w") as f: + f.write(json.dumps(dict_to_json_multiple_antenna)) dict_to_json.pop("calibration_reference", None) @@ -35,6 +50,8 @@ def test_from_json(self): """Check from_json functionality with valid and invalid dummy data.""" diff_cal = DifferentialCalibration.from_json(self.valid_file_path) assert diff_cal == self.sample_diff_cal + diff_cal_multiple_antenna = DifferentialCalibration.from_json(self.valid_file_path_multiple_antenna) + assert diff_cal_multiple_antenna == self.sample_diff_cal_multiple_antenna with pytest.raises(Exception): _ = DifferentialCalibration.from_json(self.invalid_file_path)