PassbandMap#

class stellarphot.settings.PassbandMap(*arg, name: Annotated[str, AfterValidator(func=_non_empty_string_validator)], your_filter_names_to_aavso: list[PassbandMapEntry])[source]#

Bases: BaseModelWithTableRep

Class 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 PassbandMapEntry objects.

Notes

This class behaves like a dictionary in terms of accessing individual entries but you _cannot_ use the dict methods to modify the object. This means, for example, that if my_map is a PassbandMap object, you can access the AAVSO passband that corresponds to your B passband with my_map["B"] but you _cannot_ set entries like this my_map["B"] = "B" and you _cannot_ delete entries like this del 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.

self is explicitly positional-only to allow self as a field name.

Attributes Summary

model_config

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__ and model_construct.

validate_your_filter_names_to_aavso(v)

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

get(key, default=None)[source]#
items()[source]#
keys()[source]#
model_post_init(_PassbandMap__context: Any) None[source]#

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

classmethod validate_your_filter_names_to_aavso(v)[source]#
values()[source]#