Manager

class acq4.Manager.Manager(configFile=None, argv=None)[source]

Manager class is responsible for: - Loading/configuring device modules and storing their handles - Managing the device rack GUI - Creating acquisition task handles - Loading gui modules and storing their handles - Creating and managing DirectoryHandle objects - Providing unified timestamps - Making sure all devices/modules are properly shut down at the end of the program

__init__(configFile=None, argv=None)[source]
configure(cfg)[source]

Load the devices, modules, stylesheet, and storageDir defined in cfg

createTask(cmd)[source]

Creates a new Task instance from the specified command structure.

currentDirChanged(fh, change=None, args=())[source]

Handle situation where currentDir is moved or renamed

dirHandle(d, create=False)[source]

Return a directory handle for the specified directory string.

exec_(pyfile)[source]

Execute a Python file.

This is used to enable easy loading of customizations from an externally defined file. Note that sys.path is temporarily modified to allow the external file to import from scripts in its own path.

For more complex customizations, it is recommended to build an importable module instead.

pyfilestr

The full path to the python file to be exec’d

globsdict

global namespace defined by the exec

fileHandle(d)[source]

Return a file or directory handle for d

getBaseDir()[source]

Return a directory handle to the base directory for data storage.

This is the highest-level directory where acquired data may be stored. If the base directory has not been set, return None.

getCurrentDatabase()[source]

Return the database currently selected in the Data Manager

getCurrentDir()[source]

Return a directory handle to the currently-selected directory for data storage.

getDevice(name)[source]

Return a device instance given its name.

getDirOfSelectedFile()[source]

Returns the directory that is currently selected, or the directory of the file that is currently selected in Data Manager.

getInterface(*args, **kargs)[source]

Return the object that was previously declared with name and interface type.

getModule(name)[source]

Return an already loaded module

listConfigurations()[source]

Return a list of the named configurations available

listDefinedModules()[source]

List module configurations defined in the config file

listDevices()[source]

Return a list of the names of available devices.

listModules()[source]

List names of currently loaded modules.

loadDefinedModule(name, forceReload=False)[source]

Load a module and configure as defined in the config file

loadDevice(devClassName, conf, name)[source]

Create a new instance of a device.

devClassNamestr

The name of a device class that was registered using acq4.devices.registerDeviceClass(). See acq4.devices.DEVICE_CLASSES for access to all available device classes.

confdict

A structure passed to the device providing configuration options

namestr

The name of this device. The instantiated device object will be retrievable using Manager.getDevice(name)

deviceDevice instance

The instantiated device object

loadModule(moduleClassName, name=None, config=None, forceReload=False, importMod=None, execPath=None)[source]

Create a new instance of an user interface module.

moduleClassNamestr

The name of the module class to instantiate. The class must have been registered by calling acq4.modules.registerModuleClass(). See acq4.modules.MODULE_CLASSES for access to all available module classes.

namestr or None

The name to assign to the newly instantiated module. If None, then the class name is used instead. Module names are automatically modified to avoid name collision with previously loaded modules.

configdict | None

Configuration options to pass to the module constructor

quit()[source]

Nicely request that all devices and modules shut down

readConfig(configFile)[source]

Read configuration file, create device objects, add devices to list

reloadAll()[source]

Reload all python code

reserveDevices(devices, timeout=10.0)[source]

Return a DeviceLocker that can be used to reserve multiple devices simultaneously:

with manager.reserveDevices([‘Camera’, ‘Clamp1’, ‘Stage’]):

# .. do stuff

runTask(cmd)[source]

Convenience function that runs a task and returns its results.

setBaseDir(d)[source]

Set the base directory for data storage.

setCurrentDir(d)[source]

Set the currently-selected directory for data storage.

setLogDir(d)[source]

Set the directory to which log messages are stored.

showGUI()[source]

Show the Manager GUI

suggestedDirFields(file)[source]

Given a DirHandle with a dirType, suggest a set of meta-info fields to use.

writeConfigFile(data, fileName)[source]

Write a file into the currently used config directory.