HAL Reference¶
Actor¶
- class hal.actor.actor.ActorHelpers(actor)[source]¶
Bases:
object
State helpers.
- Parameters:
actor (HALActor)
- class hal.actor.actor.HALActor(*args, **kwargs)[source]¶
Bases:
LegacyActor
HAL actor.
Macros¶
- class hal.macros.macro.Macro[source]¶
Bases:
object
A 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, **opts)[source]¶
Resets stage status.
reset_stages
is a list of stages to be executed when callingrun
. Ifreset_stages
is a list of string andforce=False
, the reset stages are rearranged according to the original__STAGES__
order, including concurrent stages. If the list ofreset_stages
includes tuples representing stages that must be run concurrently, orforce=True
, then the stages are run as input.opts
parameters 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
MacroError
if 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:
Macro
Take an APOGEE dome flat after an exposure.
Helpers¶
- class hal.helpers.apogee.APOGEEHelper(actor)[source]¶
Bases:
HALHelper
APOGEE instrument helper.
- Parameters:
actor (HALActor)
- async expose(command, exp_time, exp_type='dark', 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
None
the 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
None
if 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
None
if the shutter is already at that position.
- class hal.helpers.boss.BOSSHelper(actor)[source]¶
Bases:
HALHelper
Control 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.
- property readout_pending¶
True if an exposure readout is pending.
- class hal.helpers.ffs.FFSHelper(actor)[source]¶
Bases:
HALHelper
Command and keeps track of the Flat-Field Screens status.
- Parameters:
actor (HALActor)
- class hal.helpers.ffs.FFSStatus(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
FFS status flags.
- class hal.helpers.lamps.LampsHelperAPO(actor)[source]¶
Bases:
HALHelper
Control 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:
HALHelper
Control 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:
HALHelper
Helper 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
True
if any stop bit is set in the<axis>Stat
TCC 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, rot
oralt, az, rot
.track_command (str | None) – A raw TCC
track
command (without thetcc
target) to send. In this case other arguments likekeep_offsets
orrotwrap
are ignored.keep_offsets (bool) – Whether to keep the existing offsets.
rotwrap (str | None) – The type of
/RotWrap
to 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)