lvmsurveysim.schedule

Observing plan

class lvmsurveysim.schedule.plan.ObservingPlan(start=None, end=None, format='jd', observatory='APO', summer_shutdown=None, twilight_alt=15, good_weather=None)[source]

Creates an observing plan.

Parameters
  • start (float or path-like) – Either the JD of the start date.

  • end (float) – The JD of the end date.

  • format (str) – The format of the start and end date. Must be a format that astropy.time.Time can understand.

  • observatory (str) – The observatory, either 'APO' or 'LCO'.

  • summer_shutdown (list) – A list of JDs that correspond to summer shutdown. Those JDs will be excluded from the range between (start, end).

  • twilight_alt (float) – The altitude in degrees at which to consider that the twilight has began or finished. A positive value although it corresponds to a depression below the horizon.

  • good_weather (float) – The fraction of good weather nights. Nights with bad weather will be randomised and indicated in the plan.

Variables

data (Table) – A Table with the schedule information including twilight times, Moon position, and Moon phase.

classmethod read(path, observatory)[source]

Reads a plan file.

Parameters
  • path (path-like) – Path to a file containing an observing plan file. The file must be in ascii, fixed-width format with | as separators

  • observatory (str) – The observatory, either 'APO' or 'LCO'.

write(path, overwrite=False)[source]

Writes the observing plan to a file.

lvmsurveysim.schedule.plan.get_sun_moon_data(jd, location=None)[source]

Computes the Sun and Moon position and illuminated fraction for a given JD(s).

Adapted from PyAstronomy.

Parameters
  • jd (float or ndarray) – The Julian date.

  • location (EarthLocation) – The location of the observation. If None, assumes a geocentric position.

Returns

data (tuple) – A tuple with the SkyCoord position of the Sun, Moon and the illuminated fraction [0 - 1]. Has the same size as jd.

TileDB

Scheduler

Simulator

OpsDB

class lvmsurveysim.schedule.opsdb.LVMOpsBaseModel(*args, **kwargs)[source]

Base class for LVM’s peewee ORM models.

DoesNotExist

alias of LVMOpsBaseModelDoesNotExist

class lvmsurveysim.schedule.opsdb.Metadata(*args, **kwargs)[source]

Peewee ORM class for LVM Survey Database Metadata

DoesNotExist

alias of MetadataDoesNotExist

class lvmsurveysim.schedule.opsdb.Observation(*args, **kwargs)[source]

Peewee ORM class for LVM Survey Observation records

DoesNotExist

alias of ObservationDoesNotExist

class lvmsurveysim.schedule.opsdb.OpsDB[source]

Interface the operations database for LVM. Makes the rest of the LVM Operations software agnostic to peewee or any other ORM we might be using one day.

classmethod close()[source]

Close the database connection.

classmethod create_tables(drop=False)[source]

Create the database tables needed for the LVM Ops DB. Should be called only once for the lifetime of the database. Optionally, drop existing tables before creation.

classmethod del_metadata(key)[source]

Deletes the key/value pair from the Metadata table.

classmethod drop_tables(models)[source]

Delete the tables. Should not be called during Operations. Development only.

classmethod get_db()[source]

Return the database instance. Should not be called outside this class.

classmethod get_metadata(key, default_value=None)[source]

Get the value associated with a key from the Metadata table. Return the value, or default_value if not found.

classmethod init(dbpath=None)[source]

Intialize the database connection. Must be called exactly once upon start of the program.

classmethod load_tiledb(targets=None, fits=False, path=None)[source]

Load a tile database from the opsdb, or optionally read from FITS table file. Default is read from SQL operations database.

Parameters
  • targets (TargetList or path-like) – Optional, the TargetList object associated with the tile database or a path to the target list to load. If None, the TARGFILE value stored in the database file will be used to find abd load the correct target list.

  • fits (boolean) – Optional, load from a FITS table rather than SQL

  • path (str or Path) – Optional, the path and basename of the tile fits file, no extension. Expects to find ‘path.fits’.

Returns

~lvmsurveysim.schedule.TileDB – TileDB instance

classmethod record_observation(TileID, obstype, jd, lst, hz, obs_alt, lunation)[source]

Record an LVM Observation in the database.

classmethod save_tiledb(tiledb, fits=False, path=None, overwrite=False)[source]

Saves a tile table to the operations database, optionally into a FITS table.

The default is to update the tile database in SQL. No parameters are needed in this case.

Parameters
  • tiledb (TileDB) – The instance of a tile database to save

  • fits (bool) – Optional, save to FITS table instead of database.

  • path (str or Path) – Optional, the path and basename of the fits file, no extension. Expects to find ‘path.fits’.

  • overwrite (bool) – Optional, overwrite the FITS file if it already exists. Default False

classmethod set_metadata(key, value)[source]

Set the value associated with a key from the Metadata table. Creates or replaces the key/value pair.

classmethod update_tile_status(tileid, status)[source]

Update the tile Status column in the tile database.

class lvmsurveysim.schedule.opsdb.Tile(*args, **kwargs)[source]

Peewee ORM class for LVM Survey Tiles

DoesNotExist

alias of TileDoesNotExist

MoonModel