SchemaConverter¶
- class lsst.ts.scheduler.utils.SchemaConverter¶
Bases:
SchemaConverter
Record how to convert an observation array to the standard opsim schema.
Extends rubin_scheduler.scheduler.utils.SchemaConverter with a method to read an opsim database and return a dataframe instead of an observation array.
Methods Summary
obs2opsim
(obs_array[, filename, info, ...])Convert an array of observations into a pandas dataframe with Opsim schema.
opsim2df
(filename)Read an opsim database and return a pandas data frame.
opsim2obs
(filename)convert an opsim schema dataframe into an observation array.
opsimdf2obs
(df)convert an opsim schema dataframe into an observation array.
Methods Documentation
- obs2opsim(obs_array, filename=None, info=None, delete_past=False, if_exists='append')¶
Convert an array of observations into a pandas dataframe with Opsim schema.
- Parameters:
- obs_array
np.array
Numpy array with OpSim observations.
- filename
str
, optional Name of the database file to write to.
- info
np.array
, optional Numpy array with database info.
- delete_past
bool
Delete past observations (default=False)?
- if_exists
str
Flag to pass to
to_sql
when writting to the database to control strategy when the database already exists.
- obs_array
- Returns:
- opsim2df(filename: str) DataFrame ¶
Read an opsim database and return a pandas data frame.
- Parameters:
- filename
str
Path to an sqlite3 opsim database.
- filename
- Returns:
pd.DataFrame
Observations from the database.