Observatory#
- class stellarphot.settings.Observatory(*arg, name: Annotated[str, AfterValidator(func=_non_empty_string_validator)], latitude: Annotated[Latitude, _UnitQuantTypePydanticAnnotation, BeforeValidator(func=add_degree_to_float, json_schema_input_type=PydanticUndefined)], longitude: Annotated[Longitude, _UnitQuantTypePydanticAnnotation, BeforeValidator(func=add_degree_to_float, json_schema_input_type=PydanticUndefined)], elevation: Annotated[Quantity, _UnitQuantTypePydanticAnnotation, WithPhysicalType(physical_type=length)], AAVSO_code: str | None = None, TESS_telescope_code: str | None = None)[source]#
Bases:
BaseModelWithTableRepClass to represent an observatory.
- Parameters:
- namestr
Name of the observatory.
- latitude
astropy.coordinates.Latitudeor other valid latitude representation Latitude of the observatory. Use a positive number for north and negative for south.
- longitude
astropy.coordinates.Longitudeor other valid longitude representation Longitude of the observatory. Use a positive number for east and negative for west.
- elevation
astropy.units.Quantity Elevation of the observatory.
- AAVSO_codestr, optional
AAVSO observer code.
- TESS_telescope_codestr, optional
TESS telescope code.
Examples
The first example shows how to set up an observatory whose latitude and longitude are 30° North and 100° West, respectively, and is at an elevation of 1000 meters.
>>> from astropy.coordinates import Latitude, Longitude >>> from astropy import units as u >>> from stellarphot.settings import Observatory >>> observatory = Observatory( ... name="test observatory", ... latitude=Latitude(30.0 * u.deg), ... longitude=Longitude(-100.0 * u.deg), ... elevation=1000 * u.m, ... ) >>> observatory Observatory(name='test observatory', latitude=<Latitude 30. deg>, longitude=<Longitude 260. deg>, elevation=<Quantity 1000. m>, AAVSO_code=None, TESS_telescope_code=None)
Note that units can be omitted from the latitude and longitude if and only if the units are degrees and the values are in decimal degrees.
>>> # You can also just provide numbers for the latitude and longitude >>> observatory = Observatory( ... name="test observatory", ... latitude=30.0, ... longitude=-100.0, ... elevation=1000 * u.m, ... ) >>> observatory Observatory(name='test observatory', latitude=<Latitude 30. deg>, longitude=<Longitude 260. deg>, elevation=<Quantity 1000. m>, AAVSO_code=None, TESS_telescope_code=None)
An observatory located at 46° 00’ 00.00” South and 96° 00’ 00.00” East, and at an elevation of 2300 meters would be created like this:
>>> observatory = Observatory( ... name="test observatory", ... latitude="-46d00m00.00s", ... longitude="96d00m00.00s", ... elevation=2.3 * u.km, ... ) >>> observatory Observatory(name='test observatory', latitude=<Latitude -46. deg>,...
It would be fine to use decmial degrees for the latitude and longitude in the above example, but the example is given in part to show how to use sexagesimal notation.
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
Return an
astropy.coordinates.EarthLocationobject for the observatory.Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].Attributes Documentation
- earth_location#
Return an
astropy.coordinates.EarthLocationobject for the observatory.
- model_config = {'extra': 'forbid', 'json_schema_extra': {'description': 'Class to represent an observatory.'}, 'validate_assignment': True, 'validate_default': True}#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].