PassbandMap#
- class stellarphot.settings.PassbandMap(*arg, name: Annotated[str, AfterValidator(func=_non_empty_string_validator)], your_filter_names_to_aavso: list[PassbandMapEntry])[source]#
Bases:
BaseModelWithTableRepClass to represent a mapping from one set of filter names to another that behaves like a
dict.- Parameters:
- namestr
Name of the passband map.
- your_filter_names_to_aavsolist[
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. Note that, as shown in the example below, you can initialize this with a dictionary, and it will be converted to a list of
PassbandMapEntryobjects.
Notes
This class behaves like a dictionary in terms of accessing individual entries but you _cannot_ use the
dictmethods to modify the object. This means, for example, that ifmy_mapis aPassbandMapobject, you can access the AAVSO passband that corresponds to yourBpassband withmy_map["B"]but you _cannot_ set entries like thismy_map["B"] = "B"and you _cannot_ delete entries like thisdel my_map["B"].Examples
>>> from stellarphot.settings import PassbandMap >>> passband_map = PassbandMap( ... name="Sample map", ... your_filter_names_to_aavso={"B": "B", "rp": "SR"} ... ) >>> passband_map 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' >>> passband_map["rp"] 'SR' >>> # If you prefer you can access the individual entries in >>> # the list of PassbandMapEntry >>> passband_map.your_filter_names_to_aavso[1] PassbandMapEntry(your_filter_name='rp', aavso_filter_name=<AAVSOFilters.SR: 'SR'>) >>> # Getting the AAVSO filter name this way is a little cumbersome though: >>> passband_map.your_filter_names_to_aavso[1].aavso_filter_name.value 'SR'
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Attributes Summary
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].Methods Summary
get(key[, default])items()keys()model_post_init(_PassbandMap__context)Override this method to perform additional initialization after
__init__andmodel_construct.values()Attributes Documentation
- model_config = {'extra': 'forbid', 'json_schema_extra': {'description': 'Class to represent a mapping from one set of filter names to another that behaves like a `dict`.'}, 'validate_assignment': True, 'validate_default': True}#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
Methods Documentation