Environment (pyobs.environment)
- class Environment(timezone: str = 'utc', location: Dict[str, Any] | EarthLocation | None = None, *args: Any, **kwargs: Any)[source]
An Environment object hold information about the location of the observatory and provides some convenience methode.
An object of this type is usually never instantiated manually, but is part of a
Module
, automatically created from the configuration file like this:timezone: Africa/Johannesburg location: longitude: 20.810808 latitude: -32.375823 elevation: 1798.
- localtime(utc: datetime | None = None) datetime [source]
Returns the local time at the observatory, either for a given UTC time or for now, if none is given.
- Parameters:
utc – UTC to convert. Use now if none is given.
- Returns:
Local time.
- property location: EarthLocation | None
Returns the location of the observatory.
- lst(time: datetime | Time) Longitude [source]
Returns the local sidereal time for a given time.
- Parameters:
time – Time to convert to LST.
- Returns:
Local sidereal time.
- night_obs(time: datetime | Time | None = None) date [source]
Returns the date of the night for the given night, i.e. the date of the start of the night.
- Parameters:
time – Time to return night for. If none is given, current time is used.
- Returns:
Night of observation.
- sun(time: Time, altaz: bool = True) SkyCoord [source]
Returns the position of the sun, either as RA/Dec or Alt/Az for the given time.
- Parameters:
time – Time to calculate position for.
altaz – If True, Alt/Az is returned, otherwise RA/Dec.
- Returns:
Coordinates of sun.
- property timezone: tzinfo
Returns the timezone of the observatory.
- to_altaz(radec: SkyCoord, time: Time | None = None) SkyCoord [source]
Converts a given set of RA/Dec to Alt/Az for the current location at a given time.
- Parameters:
radec – RA/Dec coordinates to convert.
time – Time to use, or none for now.
- Returns:
Alt/Az coordinates for given RA/Dec.