BMO API Reference¶
Available commands¶
This is an autogenerated list of commands available for BMO. They can be called from STUI
as bmo <command> <options>
. Under the hood, BMO uses click,
so you’ll notice that the command structure shares multiple similarities with a command line
interpreter (CLI).
bmo¶
bmo [OPTIONS] COMMAND [ARGS]...
camera¶
Handles the cameras.
bmo camera [OPTIONS] COMMAND [ARGS]...
expose¶
Exposes the cameras, showing the result in DS9.
bmo camera expose [OPTIONS]
Options
-
--camera_type
<camera_type>
¶ whether to expose all connected cameras (default) or only on- or off-axis. [default: all]
Options: all|on|off
-
--background
,
--no-background
¶
if True (default), substract a median background from the image. [default: True]
-
-o
,
--one
¶
if set, exposes once with each camera and stops. [default: False]
exptime¶
Sets the exposure time.
bmo camera exptime [OPTIONS] [EXPTIME]
Options
-
--camera_type
<camera_type>
¶ whether the exposure time should be set for all cameras (default) or only on- or off-axis. [default: all]
Options: all|on|off
Arguments
-
EXPTIME
¶
Optional argument
centre-up¶
Centres the field.
bmo centre-up [OPTIONS]
Options
-
-t
,
--translate
¶
Only applies translation.
-
-d
,
--dryrun
¶
Calculates offsets but does not apply them.
ds9¶
Handles the DS9 communication
bmo ds9 [OPTIONS] COMMAND [ARGS]...
Manta API¶
-
class
bmo.devices.manta.
MantaCameraSet
(vimba, actor=None)¶ Bases:
object
A set of Manta cameras.
This class allows to control a set of cameras (at this point, an on-axis and and off-axis). It handles the Vimba main API and the Vimba system controller, and allows to list cameras, connect, and disconnect them.
Parameters: - vimba (
pymba.Vimba
object) – Apymba.Vimba()
object, that will be used to talk to the Vimba API. - actor – The BMO actor, or
None
. If the latter, no messages will be written to the users.
-
close
()¶ Closes the Vimba system.
-
connect
(camera_id)¶ Connects a camera.
-
connect_all
(reconnect=True)¶ Connects all the available cameras.
-
disconnect
(camera_id)¶ Closes a camera and removes it from the list.
-
get_camera_ids
()¶ Returns a list of connected camera ids.
-
list_cameras
()¶ Returns a list of connected camera IDs.
-
update_keywords
(user_cmd=None)¶ Outputs camera keywords.
- vimba (
-
class
bmo.devices.manta.
MantaCamera
(camera_id, vimba, camera_set=None, actor=None)¶ Bases:
object
A class representing a Manta camera.
This class allows to connect a Manta camera and expose asynchronously.
Parameters: - camera_id (str) – The camera ID of the camera to connect.
- vimba (
pymba.Vimba
object) – Apymba.Vimba()
object, that will be used to talk to the Vimba API. Normally passed down byMantaCameraSet
. - camera_set (
MantaCameraSet
object or None) – The parentMantaCameraSet
object to which this camera belongs to. - actor – The BMO actor, or
None
. If the latter, no messages will be written to the users.
-
camera_type
¶ Returns
'on'
or'off'
depending on the type of camera.
-
close
()¶ Ends capture and closes the camera.
-
expose
(call_back_func=None)¶ Exposes the camera.
Accepts a
call_back_func
function to be called with the resulting exposure.
-
frame_callback
(frame)¶ Frame callback that gets caled when the frame is filled.
This callback is called when
ExposureTimeAbs
has passed and the frame is filled. It retrieves the image data and creates aMantaExposure
object. It then requeues the frame for future use.If
MantaCamera.exposure
has been called with acall_back_func
, it calls that function and passes it theMantaExposure
object.
-
init_camera
(camera_id)¶ Initialises the camera.
Gets the camera from the Vimba API, opens it, and sets the default configuration. It then creates a frame and announces and queues it to the camera. Finally, starts the capture mode.
-
reconnect
()¶ Closes and reconnects the camera.
-
save
(fn, exposure=None, **kwargs)¶ Saves a
MantaExposure
to disk.Parameters:
-
set_default_config
()¶ Sets the default configuration.
-
state
¶ Returns the state of the camera.
-
class
bmo.devices.manta.
MantaExposure
(raw, exposure_time, camera_id, ra=None, dec=None, extra_headers=[])¶ Bases:
object
A Manta camera exposure.
-
background
¶ Returns the value of background.
-
data
¶ Returns the image (defaults to raw).
-
classmethod
from_fits
(fn)¶ Creates a
MantaExposure
object from a FITS file.
-
get_background_cards
()¶ Returns a list of header values describing the background model.
-
get_wcs_header
(shape)¶ Returns an WCS header for an image of a certain
shape
.It assumes the centre of the image corresponds to
ra, dec
.
-
raw
¶ Returns the raw image.
-
save
(basename=None, dirname='/data/bcam', overwrite=False, compress=True, wcs=None)¶ Saves the image to disk.
Parameters: - basename (str or None) – The name of the image to save. If
None
, a name will be given to the image based on the camera ID and the time. - dirname (str) – The path to where to save the image.
- overwrite (bool) – If
True
, overwrites the destination path, if it exists. - compress (bool) – If
True
, the image will be compressed using fpack, and a.fz
suffix will be added to the path. - wcs (
astropy.wcs.WCS
object) – The astrometry solution for the image as anastropy.wcs.WCS
object. Ifwcs=None
, an approximate WCS solution will be generated using the centre of the image and the camera pixel scale.
- basename (str or None) – The name of the image to save. If
-
set_radec
(ra, dec)¶ Sets the RA and Dec of the centre of the image.
-
subtract_background
(background=None, sigma_clip=SigmaClip(sigma=3, sigma_lower=None, sigma_upper=None, iters=3, cenfunc=<function median>, stdfunc=<function std>), bkg_estimator=<photutils.background.core.MedianBackground object>, box_size=(50, 50), filter_size=(3, 3))¶ Fits a 2D background.
-