ocd.auto_schedule
– Schedule and execute the next shot(s)¶
Functionality to schedule the next shot goes in here
-
ocd.auto_schedule.
run_autoschedule
(conf, shot_list, julian_date, azimuth, seeing, transparency, sky_background)[source]¶ Run
autoschedule_main
and parse the output.Parameters: - conf :
configparser.ConfigParser
configuration. It uses the following options of the
[autoschedule]
section:exe_name
: name of the executableinit_file
,lae_dec
,moon_loc
,illum_tables
: name of the files necessary to run autoschedule
- shot_list : string
name of the file with the shot positions
- julian_date : float
Julian date for the start of the planning
- azimuth : float
current telescope azimuth
- seeing, transparency, sky_background : float
current conditions
Returns: - table :
astropy.table.Table
parsed output from autoschedule
Raises: - ocd.errors.AutoscheduleError
if the
autoschedule_main
command fails
- conf :
-
ocd.auto_schedule.
get_next_shots
(conf, azimuth, seeing, transparency, sky_background)[source]¶ Dump the shot list and run autoschedule.
Parameters: - conf :
configparser.ConfigParser
configuration. Passed to
ocd.shots_db.create_shot_file()
,run_autoschedule()
- azimuth : float
current telescope azimuth
- seeing, transparency, sky_background : float
current conditions
Returns: - table :
astropy.table.Table
parsed output from autoschedule
- conf :
-
ocd.auto_schedule.
prepare_shot_params
(conf, autoschedule_shot)[source]¶ - Convert a shot as produced by
autoschedule_main
to a dictionary passed toocd.run_shot.run()
. - Convert the exposure times from minutes to seconds.
- Add the metadata stored in the
ShotMetadata
table
Parameters: - conf :
configparser.ConfigParser
configuration. Passed to
ocd.shots_db.create_shot_file()
,run_autoschedule()
- autoschedule_shot : class:astropy.table.Row
row of to convert to a dictionary
Returns: - shot_dict : dictionary
dictionary of options
- Convert a shot as produced by
-
class
ocd.auto_schedule.
ShotRunner
(conf, state_machine, trigger_state, metrology, azimuth)[source]¶ Bases:
object
Prepare and run a shot.
Parameters: - conf :
configparser.ConfigParser
configuration
- state_machine :
ocd.states.BaseState
state machine used to trigger the shot run
- trigger_state : sting
name of the state of
state_machine
to use as trigger for running the shot- metrology :
ocd.storage.MetrologyVault
vault containing the metrology information
- azimuth :
ocd.storage.AzimuthVault
azimuth values from the telescope
Attributes: - topics : list
name of topics that trigger
handle_event()
. It’s taken fromstate_machine.trigger_topics
-
_store_config_options
(self)[source]¶ Save the
skip_shot_submission
,skip_shot_delta_sec
andwait_shot_delta_sec
options of the[autoschedule]
section into_skip_shot
,_skip_shot_delta_sec
and_wait_shot_delta_sec
-
handle_event
(self, tcs_topic, tcs_event)[source]¶ When an event with the given topic arrives, decide whether it’s time to run a shot.
Parameters: - tcs_topic : string
topic of the event
- tcs_event : dict
event to handle, ignored
Returns: - bool
whether the event triggers some computation
-
_pending_processes
(self)[source]¶ Check if there are running processes and clear the them if they are done.
Returns: - pending : bool
whether there are still running processes.
-
_shot_runner
(self)[source]¶ Collect all the information necessary and run a shot.
In details:
- check that a
ocd run_shot
process is not running - cleanup finished shots
- call
get_next_shots()
to get the next shots - call
prepare_shot_params()
to prepare the values to pass toocd run_shot
- log the number of scheduled shots and the first available one;
- run
ocd run_shot
in asubprocess.Popen
and store the process
- check that a
-
_fwhm
¶ Get the fwhm to use to run the shot.
Returns: - float
mean FWHM from the guiders
-
_skymag
¶ Get the sky magnitude to use to run the shot.
Returns: - float
mean sky magnitude from the guiders
-
_transparency
¶ Get the sky magnitude to use to run the shot.
Returns: - float
mean sky magnitude from the guiders
-
_az
¶ Get and return the azimuth from the
AzimuthVault.azimuth
. If this is not found, try to getAzimuthVault.azimuth_tmp
or return 180Returns: - float
current azimuth
-
update_config
(self, conf)[source]¶ Update the local copy of the configuration file and
ref_values
.Parameters: - conf :
pyhetdex.tools.configuration.ConfigParser
new configuration object
Returns: - string
message to report back
- conf :
- conf :