lsst.sims.ocs.kernel.simulator module

class lsst.sims.ocs.kernel.simulator.Simulator(options, configuration, database)[source]

Bases: future.types.newobject.newobject

Main class for the survey simulation.

This class is responsible for setting up, running and shutting down the LSST survey simulation.

opts

argparse.Namespace – The options returned by the ArgumentParser instance.

conf

SimulationConfig – The simulation configuration instance.

db

SocsDatabase – The simulation database instance.

fractional_duration

float – The length in years for the simulated survey.

time_handler

TimeHandler – The simulation time handling instance.

log

logging.Logger – The logging instance.

sal

SalManager – The instance that manages interactions with the SAL.

seq

Sequencer – The sequencer instance.

dh

DowntimeHandler – The downtime handler instance.

conf_comm

ConfigurationCommunicator – The configuration communicator instance.

cloud_model

CloudModel – The cloud model instance.

seeing_model

SeeingModel – The seeing model instance.

field_database

lsst.sims.survey.fields.FieldsDatabase – The instance of the fields database.

field_selection

lsst.sims.survey.fields.FieldSelection – The instance of the field selector.

Initialize the class.

Parameters:
  • options (argparse.Namespace) – The instance returned by ArgumentParser containing the command-line options.
  • configuration (SimulationConfig) – The simulation configuration instance.
  • database (SocsDatabase) – The simulation database instance.
end_night()[source]

Perform actions at the end of the night.

finalize()[source]

Perform finalization steps.

This function handles finalization of the SalManager and Sequencer instances.

gather_proposal_history(phtype, topic)[source]

Gather the proposal history from the current target.

Parameters:
  • phtype (str) – The type of the proposal history (target or observation).
  • topic (scheduler_targetC or scheduler_interestedProposalC) – The topic instance to gather the observation proposal information from.
get_target_from_scheduler()[source]

Get target from scheduler.

This function provides the mechanism for getting the target from the Scheduler. Currently, a while loop is required to do this.

initialize()[source]

Perform initialization steps.

This function handles initialization of the SalManager and Sequencer instances and gathering the necessary telemetry topics.

run()[source]

Run the simulation.

save_configuration()[source]

Save the configuration information to the DB.

save_field_information()[source]

Save the field information to the DB.

save_proposal_information()[source]

Save the active proposal information to the DB.

start_day()[source]

Perform actions at the start of day.

This function performs all actions at the start of day. This involves:

  • Sending a timestamp to the Scheduler
  • Checking if the Scheduler requests a filter swap
  • Peforming the filter swap if requested
start_night(night)[source]

Perform actions at the start of the night.

Parameters:night (int) – The current night.
write_proposal_fields(prop_fields)[source]

Transform the proposal field information and write to the survey database.

Parameters:prop_fields (dict) – The set of proposal fields information.
duration

int – The duration of the simulation in days.