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

list

Lists available and connected cameras.

bmo camera list [OPTIONS]

Options

--camera_type <camera_type>

whether to show all cameras (default) or only on- or off-axis ones. [default: all]

Options:all|on|off
reconnect

Forces cameras to reconnect.

bmo camera reconnect [OPTIONS]
stop

Stops all current exposures.

bmo camera stop [OPTIONS]

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]...
clear

Deletes all DS9 frames. Alias for reset.

bmo ds9 clear [OPTIONS]
connect

Connects a DS9 server.

bmo ds9 connect [OPTIONS]

Options

--address <address>

the DS9 intance to which connect.

reset

Resets the DS9 window.

bmo ds9 reset [OPTIONS]
show-chart

Shows finding charts for the current plate in DS9.

bmo ds9 show-chart [OPTIONS] PLATE

Arguments

PLATE

Optional argument

help

Shows the help.

bmo help [OPTIONS]

ping

Pings the actor.

bmo ping [OPTIONS]

status

Returns the status.

bmo status [OPTIONS]

tcc

Sends a command to the TCC device.

In general, only bmo tcc connect is likely to be used if the connection to the TCC fails.

bmo tcc [OPTIONS] [[status|connect|disconnect]]

Arguments

COMMAND

Optional argument

version

Returns the version.

bmo version [OPTIONS]

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) – A pymba.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.

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) – A pymba.Vimba() object, that will be used to talk to the Vimba API. Normally passed down by MantaCameraSet.
  • camera_set (MantaCameraSet object or None) – The parent MantaCameraSet 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 a MantaExposure object. It then requeues the frame for future use.

If MantaCamera.exposure has been called with a call_back_func, it calls that function and passes it the MantaExposure 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:
  • fn (str) – The path to where to save the image.
  • exposure (MantaExposure object or None) – A MantaExposure object to save. If None, the last` exposure will be saved.
  • kwargs (dict) – Keyword arguments to be passed to MantaExposure.save.
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 an astropy.wcs.WCS object. If wcs=None, an approximate WCS solution will be generated using the centre of the image and the camera pixel scale.
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.