Model Observatory¶
- class rubin_scheduler.scheduler.model_observatory.KinemModel(location=None, park_alt=86.5, park_az=0.0, start_filter='r', mjd0=0, telescope='rubin')[source]¶
Bases:
object
A Kinematic model of the telescope.
- Parameters:
location (
astropy.coordinates.EarthLocation
) – The location of the telescope. If None, defaults to rubin_scheduler.utils.Site infopark_alt (
float
(86.5)) – The altitude the telescope gets parked at (degrees)park_az (
float
(0)) – The azimuth for telescope park position (degrees)start_filter (
str
(‘r’)) – The filter that gets loaded when the telescope is parkedmjd0 (
float
(0)) – The MJD to assume we are starting fromtelescope (`str’) – The telescope name to use for sky rotation conversion. Default “rubin”
Note
Note there are additional parameters in the methods setup_camera, setup_dome, setup_telescope, and setup_optics.
- mount_filters(filter_list)[source]¶
Change which filters are mounted
- Parameters:
filter_list (
list
[str
]) – List of the mounted filters.
- observe(observation, mjd, rot_tel_pos=None, lax_dome=True)[source]¶
Observe a target, and return the slewtime and visit time for the action
If slew is not allowed, returns np.nan and does not update state.
- setup_camera(readtime=2.4, shuttertime=1.0, filter_changetime=120.0, fov=3.5, rotator_min=-90, rotator_max=90, maxspeed=3.5, accel=1.0, shutter_2motion_min_time=15.0, jerk=4.0)[source]¶
Configure the camera.
- Parameters:
readtime (
float
) – The readout time of the CCDs (seconds)shuttertime (
float
) – The time it takes the shutter to go from closed to fully open (seconds)filter_changetime (
float
) – The time it takes to change filters (seconds)fov (
float
) – The camera field of view (degrees)rotator_min (
float
) – The minimum angle the camera rotator (rotTelPos) can move to (degrees)rotator_max (
float
) – The maximum angle the camera rotator (rotTelPos) can move to degrees)maxspeed (
float
) – The maximum speed of the rotator (degrees/s)accel (
float
) – The acceleration of the rotator (degrees/s^2)jerk (
float
) – The jerk of the rotator (degrees/s^3). None treats jerk as infinite. Default 4.0.shutter_2motion_min_time (
float
) – The time required for two shutter motions (seconds). If one takes a 1-snap 10s exposure, there will be a 5s of overhead before the next exposure can start.
- setup_dome(altitude_maxspeed=1.75, altitude_accel=0.875, altitude_jerk=None, altitude_freerange=0.0, azimuth_maxspeed=1.5, azimuth_accel=0.75, azimuth_jerk=None, azimuth_freerange=4.0, settle_time=1.0)[source]¶
Configure the dome.
- Parameters:
altitude_maxspeed (
float
) – Maximum speed for altitude movement (degrees/second)altitude_accel (
float
) – Maximum acceleration for altitude movement (degrees/second**2)altitude_jerk (
float
) – The jerk for the altitude movement (degrees/second**3). None treats jerk as infinite. Default Nonealtitude_freerange (
float
) – The range over which there is 0 delayazimuth_maxspeed (
float
) – Maximum speed for azimuth movement (degrees/second)azimuth_accel (
float
) – Maximum acceleration for azimuth movement (degrees/second**2)azimuth_jerk (
float
) – The jerk of the azimuth movement (degrees/second**3). Default of None treats jerk as infinite.azimuth_freerange (
float
) – The range in which there is 0 delaysettle_time (
float
) – Settle time after movement (seconds)
- setup_optics(ol_slope=0.2857142857142857, cl_delay=[0.0, 36.0], cl_altlimit=[0.0, 9.0, 90.0])[source]¶
Configure parameters for the optics closed and open loops.
- Parameters:
ol_slope (
float
(1.0/3.5)) – seconds/degree in altitude slew.cl_delay (list ([0.0, 36])) – The delays for closed optics loops (seconds)
cl_altlimit (list ([0.0, 9.0, 90.0])) – The altitude limits (degrees) for performing closed optice loops. Should be one element longer than cl_delay.
Note
A given movement in altitude will cover X degrees; if X > cl_altlimit[i] there is an additional delay of cl_delay[i]
- setup_telescope(altitude_minpos=20.0, altitude_maxpos=86.5, azimuth_minpos=-250.0, azimuth_maxpos=250.0, altitude_maxspeed=3.5, altitude_accel=3.5, altitude_jerk=14.0, azimuth_maxspeed=7.0, azimuth_accel=7.0, azimuth_jerk=28.0, settle_time=3.0)[source]¶
Configure the telescope (TMA) movement and position.
- Parameters:
altitude_minpos (
float
) – Minimum altitude for the telescope (degrees).altitude_maxpos (
float
) – Maximum altitude for the telescope (degrees). Maximum position of 86.5 is limited due to slew requirements near the zenith with an alt-az mount.azimuth_minpos (
float
) – Minimum azimuth position (degrees). Note this value is related to cumulative azimuth range, for cable wrap.azimuth_maxpos (
float
) – Maximum azimuth position (degrees). Note this value is related to cumulative azimuth range, for cable wrap. Defaults -250/250 include 0-360 for all-sky azimuth positions, reachable via multiple routes.altitude_maxspeed (
float
) – Maximum speed for altitude movement (degrees/second)altitude_accel (
float
) – Maximum acceleration for altitude movement (degrees/second**2)altitude_jerk (
float
) – Jerk for altitude movement (degrees/second**2). None will treat jerk as infinite. Default 20.azimuth_maxspeed (
float
) – Maximum speed for azimuth movement (degrees/second)azimuth_accel (
float
) – Maximum acceleration for azimuth movement (degrees/second**2)azimuth_jerk (
float
) – Jerk for azimuth movement (degrees/second**2). None will treat jerk as infinite. Default 40.settle_time (
float
) – Settle time required for telescope after movement (seconds) See alsotma_movement
for definitions for the speed, acceleration and jerk.
- shutter_stall(observation)[source]¶
Time we need to stall after shutter closes to let things cool down.
- slew_times(ra_rad, dec_rad, mjd, rot_sky_pos=None, rot_tel_pos=None, filtername='r', lax_dome=True, alt_rad=None, az_rad=None, starting_alt_rad=None, starting_az_rad=None, starting_rot_tel_pos_rad=None, update_tracking=False)[source]¶
Calculates slew time to a series of alt/az/filter positions from the current position (stored internally).
Assumptions (currently): Assumes we have been tracking on ra,dec,rot_sky_pos position. Ignores the motion of the sky while we are slewing (this approx should probably average out over time). No checks for if we have tracked beyond limits. (this assumes folks put telescope in park if there’s a long gap.) Assumes the camera rotator never needs to (or can’t) do a slew over 180 degrees.
Calculates the slew time necessary to get from current state to alt2/az2/filter2. The time returned is actually the time between the end of an exposure at current location and the beginning of an exposure at alt2/az2, since it includes readout time in the slew time.
- Parameters:
ra_rad (
np.ndarray
) – The RA(s) of the location(s) we wish to slew to (radians)dec_rad (
np.ndarray
) – The declination(s) of the location(s) we wish to slew to (radians)mjd (
float
) – The current modified julian date (days)rot_sky_pos (
np.ndarray
) – The desired rot_sky_pos(s) (radians). Angle between up on the chip and North. Note, it is possible to set a rot_sky_pos outside the allowed camera rotator range, in which case the slewtime will be masked. If both rot_sky_pos and rot_tel_pos are set, rot_tel_pos will be used.rot_tel_pos (
np.ndarray
) – The desired rot_tel_pos(s) (radians). This overrides rot_sky_pos, if set. If neither rot_sky_pos nor rot_tel_pos are set, no rotation time is added (equivalent to using current rot_tel_pos).filtername (
str
or None) – The filter(s) of the desired observations. Set to None to compute only telescope and dome motion times.alt_rad (
np.ndarray
) – The altitude(s) of the destination pointing(s) (radians). Will override ra_rad,dec_rad if provided.az_rad (
np.ndarray
) – The azimuth(s) of the destination pointing(s) (radians). Will override ra_rad,dec_rad if provided.lax_dome (
bool
, default True) – If True, allow the dome to creep, model a dome slit, and don’t require the dome to settle in azimuth. If False, adhere to the way SOCS calculates slew times (as of June 21 2017) and do not allow dome creep.starting_alt_rad (
float
(None)) – The starting altitude for the slew (radians). If None, will use internally stored last pointing.starting_az_rad (
float
(None)) – The starting azimuth for the slew (radians). If None, will use internally stored last pointing.starting_rot_tel_pos_rad (
float
(None)) – The starting camera rotation for the slew (radians). If None, will use internally stored last pointing.update_tracking (
bool
(False)) – If True, update the internal attributes to say we are tracking the specified RA,Dec,RotSkyPos position.
- Returns:
slew_time – The number of seconds between the two specified exposures. Will be np.nan or np.inf if slew is not possible.
- Return type:
np.ndarray
- class rubin_scheduler.scheduler.model_observatory.ModelObservatory(nside=32, mjd=None, mjd_start=60980.0, alt_min=5.0, lax_dome=True, cloud_limit=0.3, sim_to_o=None, park_after=10.0, init_load_length=10, kinem_model=None, seeing_db=None, seeing_data=None, cloud_db=None, cloud_offset_year=0, cloud_data=None, downtimes=None, no_sky=False, wind_data=None, starting_time_key='sun_n12_setting', ending_time_key='sun_n12_rising', sky_alt_limits=None, sky_az_limits=None, telescope='rubin')[source]¶
Bases:
object
Generate a realistic telemetry stream for the scheduler in simulations, including simulating the acquisition of observations.
- Parameters:
nside (
int
, optional) – The healpix nside resolution. Default None usesset_default_nside()
.mjd (
float
, optional) – The MJD to start the model observatory for observations. Used to set current conditions and load sky. Default None uses mjd_start.mjd_start (
float
, optional) – The MJD of the start of the survey. This must be set to start of whole survey, for tracking purposes. Default None usessurvey_start_mjd()
.alt_min (
float
, optional) – The minimum altitude to compute models at (degrees).lax_dome (
bool
, optional) – Passed to observatory model. If true, allows dome creep.cloud_limit (
float
, optional.) – The limit to stop taking observations if the cloud model returns something equal or higher. Default of 0.3 is validated as a “somewhat pessimistic” weather downtime choice.sim_to_o (
sim_targetoO
object, optional) – If one would like to inject simulated ToOs into the telemetry stream. Default None adds no ToOs.park_after (
float
, optional) – Park the telescope after a gap longer than park_after (minutes). Default 10 minutes is used to park the telescope during downtime.init_load_length (
int
, optional) – The length of pre-scheduled sky brightness values to load initially (days). The default is 10 days; shorter values can be used for quicker load times.kinem_model (
Kinem_model
, optional) – An instantiated rubin_scheduler Kinem_model object. Default of None uses a default Kinem_model.seeing_db (
str
, optional) – The filename of the seeing data database, if one would like to use an alternate seeing database. Default None uses the default seeing database.seeing_data (
SeeingData
-like, optional) – If one wants to replace the default seeing_data object. Should be an object with a __call__ method that takes MJD and returns zenith fwhm_500 in arcsec. Set to “ideal” to have constant 0.7” seeing.cloud_db (
str
, optional) – The filename of the cloud data database. Default of None uses the default database from rubin_sim_data.cloud_offset_year (
int
, optional) – The year offset to be passed to CloudData. Default 0.cloud_data (
CloudData
-like, optional) – If one wants to replace the default cloud data. Should be an object with a __call__ method that takes MJD and returns cloudy level. Set to “ideal” for no clouds.downtimes (
np.ndarray
, (N,3) or None, optional) – If one wants to replace the default downtimes. Should be a np.array with columns of “start” and “end” with MJD values and should include both scheduled and unscheduled downtime. Set to “ideal” for no downtime. Default of None will use the downtime models fromScheduledDowntime
andUnscheduledDowntime
.no_sky (
bool
, optional) – If True, then don’t load any skybrightness files. Handy if one wants a well filled out Conditions object, but doesn’t need the sky since that can be slower to load. Default False.wind_data (WindData`-like, optional) – If one wants to replace the default wind_data object. Should be an object with a __call__ method that takes the time and returns a tuple with the wind speed (m/s) and originating direction (radians east of north). Default of None uses an idealized WindData object with no wind.
starting_time_key (
str
, optional) – What key in the almanac to use to determine the start of observing on a night. Default “sun_n12_setting”, e.g., sun at -12 degrees and setting. Other options are “sun_n18_setting” and “sunset”. If surveys are not configured to wait until the sun is lower in the sky, observing will start as soon as the time passes the time returned by this key, in each night.ending_time_key (
str
, optional) – What key in the almanac to use to signify it is time to skip to the next night. Default “sun_n12_rising”, e.g., sun at -12 degrees and rising. Other options are “sun_n18_rising” and “sunrise”.sky_az_limits (
list
[[float
,float
]]) – A list of lists giving valid azimuth ranges. e.g., [0, 180] would mean all azimuth values are valid, while [[0, 90], [270, 360]] or [270, 90] would mean anywhere in the south is invalid. Degrees.sky_alt_limits (
list
[[float
,float
]]) – A list of lists giving valid altitude ranges. Degrees. For both the alt and az limits, if a particular alt (or az) value is included in any limit, it is valid for all of them. Altitude limits of [[20, 40], [40, 60]] would allow altitudes betwen 20-40 and 40-60, but [[20, 40], [40, 60], [20, 86]] will allow altitudes anywhere between 20-86 degrees.telescope (
str
) – Telescope name for rotation computations. Default “rubin”.
- check_mjd(mjd, cloud_skip=20.0)[source]¶
See if an mjd is ok to observe
- Parameters:
cloud_skip (float (20)) – How much time to skip ahead if it’s cloudy (minutes)
- Returns:
mjd_ok (
bool
)mdj (
float
) – If True, the input mjd. If false, a good mjd to skip forward to.
- check_up(mjd)[source]¶
See if we are in downtime
- Returns:
is_up, mjd – Returns (True, current_mjd) if telescope is up and (False, downtime_ends_mjd) if in downtime
- Return type:
bool
,float
- rubin_scheduler.scheduler.model_observatory.acc_time(distance, v_max, acc_max)[source]¶
Time to move given a maximum velocity and acceleration. Assumes infinite jerk. Velocity and accelerations are assumed to be symetric (minimum acceleration = -1* acc_max)
- Parameters:
distance (
float
) – The distance to travel. Could be units of length or angle as long as other parameters match.v_max (
float
) – The maximum velocity. Units of length or angle per unit of timeacc_max (
float
) – The maximum acceleration. Units of length or angle per unit of time squared.
- rubin_scheduler.scheduler.model_observatory.generate_nights(mjd_start, duration=3653.0, rough_step=2, verbose=False)[source]¶
Generate the sunset and twilight times for a range of dates
- Parameters:
mjd_start (float) – The starting mjd
duration (float (3653)) – How long to compute times for (days)
rough_step (float (2.)) – Time step for computing first pass rough sunrise times (hours)
- rubin_scheduler.scheduler.model_observatory.jerk_time(distance, v_max, acc_max, jerk_max)[source]¶
Calculate how long to move a distance given maximum jerk, acceleration, and velocity
All parameters are assumed to be symetric (e.g, minimum jerk = -1*jerk_max)
modified from mdhom/py_constant_jerk constantJerk.py see also: https://www.researchgate.net/publication/ 289374755_THIRD_ORDER_POINT-TO-POINT_MOTION_-PROFILE
- Parameters:
distance (
float
) – The distance to travel. Could be units of length or angle as long as other parameters match.v_max (
float
) – The maximum velocity. Units of length or angle per unit of timeacc_max (
float
) – The maximum acceleration. Units of length or angle per unit of time squared.jerk_max (
float
) – The maximum jerk. Units of length or angle per unit of time cubed. If set to None, assumes jerk is infinite and defaults to use acc_time.
- rubin_scheduler.scheduler.model_observatory.rotator_movement(percent=100)[source]¶
- Get a dictionary of parameters to pass to
setup_camera
defining rotator max speed, acceleration and jerk, in terms of ‘percent’ of total performance.
- percent
float
, optional Default performance for the scheduler simulations for operations has been 100% (100, default). Expected performance at the start of comcam on-sky science operations is approximately full performance.
- percent
- Returns:
rot – A dictionary which can be passed as kwargs to KinematicModel.setup_camera(**rot).
- Return type:
dict
{str
:float
}
- Get a dictionary of parameters to pass to
- rubin_scheduler.scheduler.model_observatory.tma_movement(percent=70)[source]¶
- Get a dictionary of parameters to pass to
setup_telescope
defining altitude and azimuth speed, acceleration, and jerk in terms of ‘percent’ of total performance.
- percent
float
, optional Default performance for the scheduler simulations for operations has been 70% (70, default). Expected performance at the start of comcam on-sky science operations is about 10%.
- percent
- Returns:
tma – A dictionary which can be passed as kwargs to KinematicModel.setup_telescope(**tma).
- Return type:
dict
{str
:float
}
- Get a dictionary of parameters to pass to