HAL Reference¶
Actor¶
- class hal.actor.actor.ActorHelpers(actor)[source]¶
Bases:
objectState helpers.
- Parameters:
actor (HALActor)
- class hal.actor.actor.HALActor(*args, **kwargs)[source]¶
Bases:
LegacyActorHAL actor.
Macros¶
- class hal.macros.macro.Macro[source]¶
Bases:
objectA base macro class that offers concurrency and cancellation.
- output_stage_status(command=None, level='d')[source]¶
Outputs the stage status to the actor.
- Parameters:
command (Optional[HALCommandType])
level (str)
- reset(command, reset_stages=None, force=False, reset_config=True, **opts)[source]¶
Resets stage status.
reset_stagesis a list of stages to be executed when callingrun. Ifreset_stagesis a list of string andforce=False, the reset stages are rearranged according to the original__STAGES__order, including concurrent stages. If the list ofreset_stagesincludes tuples representing stages that must be run concurrently, orforce=True, then the stages are run as input.optsparameters will be used to override the macro configuration options only until the next reset.
- async send_command(target, command_string, raise_on_fail=True, **kwargs)[source]¶
Sends a command to an actor. Raises
MacroErrorif it fails.
- async wait_until_complete()[source]¶
Asynchronously blocks until the macros is done, cancelled, or failed.
- property actor¶
Returns the command actor.
- property helpers¶
Returns the actor helpers.
- property running¶
Is the macro running?
- class hal.macros.apogee_dome_flat.APOGEEDomeFlatMacro[source]¶
Bases:
MacroTake an APOGEE dome flat after an exposure.
Helpers¶
- class hal.helpers.apogee.APOGEEHelper(actor)[source]¶
Bases:
SpectrographHelperAPOGEE instrument helper.
- Parameters:
actor (HALActor)
- async expose(command, exp_time, exp_type='object', dither_position=None)[source]¶
Exposes APOGEE.
- Parameters:
- async expose_dither_pair(command, exp_time, dither_sequence=None, exp_type='object')[source]¶
Takes an APOGEE dither set.
- Parameters:
command (HALCommandType) – The command used to interact with the APOGEE actor.
exp_time (float) – The exposure time for each exposure in the dither sequence.
exp_type (str) – The exposure type. Valid values are
object,dark, andflat.dither_sequence (str | None) – The dither sequence. If
Nonethe first dither will be taken at the current position and the mechanism will be switched after it. Alternatively, a string"AB","BA", etc.
- get_dither_position()[source]¶
Returns the dither position or
Noneif unknown.- Return type:
str | None
- async set_dither_position(command, position, force=False)[source]¶
Sets the dither mechanism to the commanded position.
- async shutter(command, open=True, shutter='apogee', force=False)[source]¶
Opens/closes the shutter.
- Parameters:
command (HALCommandType) – The command instance to use to command the shutter.
open (bool) – If
True, opens the shutter, otherwise closes it.shutter (str) – The shutter to query. Can be
apogee,calbox, orfpi.force (bool) – If
True, sends the command to the shutter even if it reports to already be in that position.
- Returns:
shutter_command – The command sent to the shutter after been awaited for completion or
Noneif the shutter is already at that position.
- class hal.helpers.boss.BOSSHelper(actor)[source]¶
Bases:
SpectrographHelperControl for BOSS spectrograph.
- Parameters:
actor (HALActor)
- async expose(command, exp_time=0.0, exp_type='science', readout=True, read_async=False)[source]¶
Exposes BOSS. If
readout=False, does not read the exposure.
- is_exposing(reading_ok=True)[source]¶
Returns
Trueif the BOSS spectrograph is currently exposing.- Parameters:
reading_ok (bool)
- property readout_pending¶
True if an exposure readout is pending.
- class hal.helpers.ffs.FFSHelper(actor)[source]¶
Bases:
HALHelperCommand and keeps track of the Flat-Field Screens status.
- Parameters:
actor (HALActor)
- class hal.helpers.lamps.LampsHelperAPO(actor)[source]¶
Bases:
HALHelperControl for lamps.
- Parameters:
actor (HALActor)
- async all_off(command, force=False)[source]¶
Turn off all the lamps.
- Parameters:
command (HALCommandType)
force (bool)
- list_status()[source]¶
Returns a dictionary with the state of the lamps.
For each lamp the first value in the returned tuple is whether the lamp has been commanded on. The second value is whether the lamps is actually on. The third value is how long since it changed states. The final value indicates whether the lamp has warmed up.
- async turn_lamp(command, lamps, state, turn_off_others=False, delay=0.0, force=False)[source]¶
Turns a lamp on or off.
This routine always blocks until the lamps are on and warmed up. If you don’t want to block, call it as a task.
- Parameters:
command (HALCommandType) – The command that issues the lamp switching.
lamps (str | list[str]) – Name of the lamp(s) to turn on or off.
state (bool) – Whether to turn lamp on or off.
turn_off_others (bool) – Turn off all other lamps.
delay (float) – Wait this amount of seconds before actually commanding the lamps.
force (bool) – If
True, send the on/off command regardless of status.
- class hal.helpers.lamps.LampsHelperLCO(actor)[source]¶
Bases:
HALHelperControl for lamps at LCO.
- Parameters:
actor (HALActor)
- list_status()[source]¶
Returns a dictionary with the state of the lamps.
For each lamp the first value in the returned tuple is whether the lamp has been commanded on with the second being whether the lamps has finished warming up.
- async turn_lamp(command, lamps, state, turn_off_others=False, delay=0.0, is_retry=False)[source]¶
Turns a lamp on or off.
This routine always blocks until the lamps are on and warmed up. If you don’t want to block, call it as a task.
- Parameters:
command (HALCommandType) – The command that issues the lamp switching.
lamps (str | list[str]) – Name of the lamp(s) to turn on or off.
state (bool) – Whether to turn lamp on or off.
turn_off_others (bool) – Turn off all other lamps.
delay (float) – Wait this amount of seconds before actually commanding the lamps.
is_retry (bool) – Flag to track whether the method is being called as a retry.
- class hal.helpers.tcc.TCCHelper(actor)[source]¶
Bases:
HALHelperHelper for the TCC.
- Parameters:
actor (HALActor)
- axes_are_clear(axes=('az', 'alt', 'rot'))[source]¶
Checks that no bits are set in any axis status field.
- Return type:
- async axis_init(command)[source]¶
Executes TCC axis init or fails.
- Parameters:
command (HALCommandType)
- Return type:
- below_alt_limit()[source]¶
Check if we are below the alt=18 limit that prevents init/motion in az.
- Return type:
- check_stop_in(axes=('az', 'alt', 'rot'))[source]¶
Returns
Trueif any stop bit is set in the<axis>StatTCC keywords.The [az,alt,rot]Stat[3] bits show the exact status: http://www.apo.nmsu.edu/Telescopes/HardwareControllers/AxisControllers.html#25mStatusBits
- Return type:
- async do_slew(command, coords=None, track_command=None, keep_offsets=True, offset=False, rotwrap=None)[source]¶
Correctly handle a slew command, given what parse_args had received.
- Parameters:
command – The actor command used to send child commands to the TCC.
coords (dict[str, float] | None) – The coordinates where to slew. It must be a dictionary with keys
ra, dec, rotoralt, az, rot.track_command (str | None) – A raw TCC
trackcommand (without thetcctarget) to send. In this case other arguments likekeep_offsetsorrotwrapare ignored.keep_offsets (bool) – Whether to keep the existing offsets.
rotwrap (str | None) – The type of
/RotWrapto use.offset (bool) – If defined, the coordinates will be treated as an offset and not absolute positions.
- Return type:
- get_bad_axis_bits(axes=('az', 'alt', 'rot'), mask=None)[source]¶
Return the bad status bits for the requested axes.
- class hal.helpers.scripts.Scripts(actor: 'HALActor', path: 'pathlib.Path')[source]¶
Bases:
object- Parameters:
actor (HALActor)
path (pathlib.Path)