Environment (pyobs.environment)
- class Environment(timezone: str = 'utc', location: Optional[Union[Dict[str, Any], astropy.coordinates.earth.EarthLocation]] = 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: Optional[datetime.datetime] = None) datetime.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: Optional[astropy.coordinates.earth.EarthLocation]
Returns the location of the observatory.
- lst(time: Union[datetime.datetime, pyobs.utils.time.Time]) astropy.coordinates.angles.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: Optional[Union[datetime.datetime, pyobs.utils.time.Time]] = None) datetime.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.
- now() pyobs.utils.time.Time [source]
Returns current time.
- sun(time: pyobs.utils.time.Time, altaz: bool = True) astropy.coordinates.sky_coordinate.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: datetime.tzinfo
Returns the timezone of the observatory.
- to_altaz(radec: astropy.coordinates.sky_coordinate.SkyCoord, time: Optional[pyobs.utils.time.Time] = None) astropy.coordinates.sky_coordinate.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.
- to_radec(altaz: astropy.coordinates.sky_coordinate.SkyCoord, time: Optional[pyobs.utils.time.Time] = None) astropy.coordinates.sky_coordinate.SkyCoord [source]
Converts a given set of Alt/Az to RA/Dec for the current location at a given time.
- Parameters:
altaz – Alt/Az coordinates to convert.
time – Time to use, or none for now.
- Returns:
RA/Dec coordinates for given Alt/Az.