AzCam Documentation

AzCam is a framework for the acquisition and analysis of image data typically taken with scientific CCD/CMOS cameras. It is implemented as a python package (azcam) and is most often used within an IPython console environment.

This documentation was built for azcam version |version|.

Help

When using IPython, type ?xxx, xxx?, xxx?? or help(xxx) where xxx is an azcam command, object, or subpackage.

Useful links include:

Usage

Most of AzCam’s functionality is defined upon importing the azcam package followed by importing confiuration modules, such as azcamserver or azcamconsole.
This sequence allows access to modules from the azcam namespace and also sets up required internal data structures.

Example console code to get the current system wavelength is:

import azcam
import azcam.azcamconsole
azcam.azcamconsole.config()
wavelength = azcam.api.get_wavelength()

while similar server-side code would be:

import azcam
import azcam.azcamserver
azcam.azcamserver.config()
wavelength = azcam.api.get_wavelength()

Note that for some systems, a configuration package may be available which loads all the system code required by azcam. As an example, the following code is used to configure systems in the University of Arizona Imaging Technology Laboratory (ITL):

import azcam
import azcam_itl.azcamserver
azcam_itl.azcamserver.config()
wavelength = azcam.api.get_wavelength()

The Application Programming Interfaces (APIs) are very similar between azcamserver, azcamconsole, the remote socket interface, and the web programming interface. Many commands can be run using the same command format either on the server-side or client-side.
The proper syntax is azcam.api.commandname(). This convention will correctly utilize either the server or client versions of the commandname(), as determined by a previous azcam.azcamserver or azcam.azcamconsole import statement.

AzCamServer

AzCamServer is the server-side component of an azcam system which has direct control of hardware. Configuration settings (mostly python modules) define which hardware is in use and its capabilities. Besides the server’s command line interface (CLI), internal software servers are provided for both ethernet (socket) and web web (http) connections.

The API for azcamserver provides a command set which can be sent from remote socket and web connections, typed at the command line, and used for python server-side code development. Within azcamserver, call the command by name:

CLI or script example: azcam.api.expose(2.5, 'flat', 'an image title')

On a remote connection to azcamserver’s command server, send the command string over a TCP connection. For remote connections only, the leading azcam.api. should not be included.

Socket example: expose 2.5 flat "an image title"

Over a http connection (typically from a web browser) send the command using the standard query syntax:.

Web example: http://hostname:2403/api/expose?exposure_time=2.5&image_type=flat&image_title=an+image+title.

AzCamConsole

AzCamConsole is a client-side environment typically run in a IPython console environment. Often it is configured to communicate with a running azcamserver process to acquire sensor characterization data. However, it does not need to be run with azcamserver and is also used only for data analysis.

The API for azcamconsole is similar to that of azcamserver. When communicating with azcamserver, internally it sends string commands to the server and receives back string replies, converting data types as required.

Within azcamconsole, call the command by name:

Example: azcam.api.expose(2.5, 'flat', 'an image title')

Startup

Start AzCamConsole by executing a script such as start_console which is often linked to a desktop icon. The configuration of AzCamConsole is specific to each system.

Aliases

When using IPython, the auto parenthesis mode allows typing commands without requiring the normal python syntax of command(par1, par2, …). The equivalent alias syntax is command par1 par2. With Ipython in this mode all commands can use this syntax, there are a few especially useful command line commands which are listed below.

  • sav to save the current AzCamConsole state

  • bf (browse folder) to open a GUI to browse for a directory and then set it as the current working folder (similar to cd but with GUI).

  • Run to run a command in the python search path, usually for scripts (note the upper case R to distinguish it from IPython’s built-in run magic command).

  • gf to try and go to current image folder.

  • sf to try and set image folder to the current directory.

Scripts and Plugins

Scripts consist of python code which can be executed at a command line. Some scripts are plugins and are called simply by typing Run before their name using space delimited parameters (no parentheses), according to IPython’s run mechanism. Other scripts can be imported using normal Python conventions. Availability depends on configuration. Note that in general scripts cannot be run outside of their azcam environment (server or console) due to dependencies on communications connections, configurations files, etc.

Usage example:

make_histogram('test.fits',128,23456)
Run test_controller
Run test_shutter 5 3.0 5.0

Configuration and Shortcuts

For many preconfigured systems, shortcuts are provided for ease of use at the command line.
These are typically implemented at startup by a comamnd such as from cli_consolecommands import *.
Examples of shortcuts often available and which can be typed directly in the CLI are listed below. Type a ? after any command for help.

  • sav, bf, p, sroi, sf, gf

Commands and Objects

There are many commands and classes (which create objects and their methods) which are available to manipulate hardware, data, images, and exposures. The links listed below describe these commands. Availability depends on configuration.

These commands and classes generate objects which are typically available within both AzCamServer and AzCamConsole code.