diff --git a/stellarphot/photometry/tests/test_photometry.py b/stellarphot/photometry/tests/test_photometry.py index 110f6c61..a22f0b6a 100644 --- a/stellarphot/photometry/tests/test_photometry.py +++ b/stellarphot/photometry/tests/test_photometry.py @@ -91,10 +91,11 @@ # Passband map for the tests PASSBAND_MAP = PassbandMap( + name="Example Passband Map", your_filter_names_to_aavso={ "B": "B", "rp": "SR", - } + }, ) DEFAULT_LOGGING_SETTINGS = LoggingSettings() diff --git a/stellarphot/settings/models.py b/stellarphot/settings/models.py index 55b72cd5..5c495321 100644 --- a/stellarphot/settings/models.py +++ b/stellarphot/settings/models.py @@ -729,6 +729,10 @@ class PassbandMap(BaseModelWithTableRep): Parameters ---------- + + name : str + Name of the passband map. + your_filter_names_to_aavso : list[`stellarphot.settings.PassbandMapEntry`] A list of pairs of your filter name and the corresponding AAVSO filter name. This is used to rename the passband entries in the output photometry table. @@ -748,9 +752,12 @@ class PassbandMap(BaseModelWithTableRep): Examples -------- >>> from stellarphot.settings import PassbandMap - >>> passband_map = PassbandMap(your_filter_names_to_aavso={"B": "B", "rp": "SR"}) + >>> passband_map = PassbandMap( + ... name="Sample map", + ... your_filter_names_to_aavso={"B": "B", "rp": "SR"} + ... ) >>> passband_map - PassbandMap(your_filter_names_to_aavso=[PassbandMapEntry(your_filter_name='B',... + PassbandMap(name='Sample map', your_filter_names_to_aavso=[PassbandMapEntry(your_... >>> # You can access the AAVSO filter name for a given filter name using dict syntax >>> passband_map["B"] 'B' @@ -766,6 +773,9 @@ class PassbandMap(BaseModelWithTableRep): """ + name: Annotated[ + str, Field(description="Name of the passband map", examples=["Filter wheel 1"]) + ] your_filter_names_to_aavso: list[PassbandMapEntry] | None def model_post_init(self, __context: Any) -> None: diff --git a/stellarphot/settings/tests/test_models.py b/stellarphot/settings/tests/test_models.py index 0dc470bf..868cb210 100644 --- a/stellarphot/settings/tests/test_models.py +++ b/stellarphot/settings/tests/test_models.py @@ -64,6 +64,7 @@ ) DEFAULT_PASSBAND_MAP = dict( + name="Example map", your_filter_names_to_aavso=[ PassbandMapEntry( your_filter_name="V", @@ -77,7 +78,7 @@ your_filter_name="rp", aavso_filter_name="SR", ), - ] + ], ) DEFAULT_LOGGING_SETTINGS = dict( @@ -417,13 +418,13 @@ def test_deletion_fails(self): def test_passband_map_init_with_none(): - pb_map = PassbandMap(your_filter_names_to_aavso=None) + pb_map = PassbandMap(name="Test", your_filter_names_to_aavso=None) assert pb_map._dict == {} def test_passband_map_init_with_passband_map(): pb_map = PassbandMap(**DEFAULT_PASSBAND_MAP) - pb_map2 = PassbandMap(your_filter_names_to_aavso=pb_map) + pb_map2 = PassbandMap(name="Example map", your_filter_names_to_aavso=pb_map) assert pb_map == pb_map2 diff --git a/stellarphot/tests/test_core.py b/stellarphot/tests/test_core.py index d8458173..c54d2b6c 100644 --- a/stellarphot/tests/test_core.py +++ b/stellarphot/tests/test_core.py @@ -87,13 +87,14 @@ max_data_value=50000 * u.adu, ) feder_passbands = PassbandMap( + name="Feder Passbands", your_filter_names_to_aavso={ "up": "SU", "gp": "SG", "rp": "SR", "zp": "SZ", "ip": "SI", - } + }, ) feder_obs = Observatory( name="Feder Observatory", latitude=46.86678, longitude=-96.45328, elevation="311 m" @@ -531,7 +532,9 @@ def test_photometry_data_short_filter_name(): phot_data = PhotometryData( observatory=feder_obs, camera=feder_cg_16m, - passband_map=PassbandMap(your_filter_names_to_aavso={"i": "SI"}), + passband_map=PassbandMap( + name="Test map", your_filter_names_to_aavso={"i": "SI"} + ), input_data=data, ) @@ -558,7 +561,9 @@ def test_photometry_data_filter_name_map_preserves_original_names(): phot_data = PhotometryData( observatory=feder_obs, camera=feder_cg_16m, - passband_map=PassbandMap(your_filter_names_to_aavso={"i": "SI"}), + passband_map=PassbandMap( + name="Test map", your_filter_names_to_aavso={"i": "SI"} + ), input_data=data, )