Using PlateMaker through DOS

Preparing the test environment

Cleaning the working directory

The examples here assume a clean working directory, which needs to be set by the data_dir parameter in the PLATEMAKER role definition in the example platemaker.ini file, found in $PLATEMAKER_DIR/etc.

Make sure the parent directory exists:

>>> from os import mkdir
>>> try:
...     mkdir('/tmp/test_platemaker_data')
... except FileExistsError:
...     pass

but the test subdirectory does not. (PlateMaker generates it automatically.):

>>> from shutil import rmtree
>>> try:
...     rmtree('/tmp/test_platemaker_data/52254')
... except FileNotFoundError:
...     pass

Loading test input data

These examples require data to be provided to PlateMaker. These can be loaded from test_data in the PlateMaker product:

>>> from PlateMaker import test_data
>>> seq_id = test_data.seq_id
>>> instrument = test_data.inst_name
>>> targets = test_data.targets
>>> gfa_images = test_data.gfa_images
>>> fvc_image = test_data.fvc_image
>>> initial_merged_fvc_spots = test_data.initial_merged_fvc_spots
>>> merged_fvc_spots = test_data.merged_fvc_spots

Preparing to interact using PML

The architect with a PlateMaker role needs to be up and running, and the environment variables need to be set up so that the python process can find it, for example with dos_env.csh.

Then, start a python interactive process and establish a connection to the PlateMaker role:

>>> from DOSlib.PML import dos_connection
>>> pm = dos_connection('PLATEMAKER')
>>> pm.execute('configure')
'SUCCESS'
>>> pm.execute('set', instrument=instrument)
'SUCCESS'

Running nfsproc

The first step in running nfsproc, and indeed required before any PlateMaker processing steps can be completed, is to set a seq_id:

>>> pm.execute('set', seq_id=seq_id)
'SUCCESS'

nfsproc can be run thus:

>>> pm.execute('set', targets=targets)
'SUCCESS'
>>> pm.execute('nfsproc')
'SUCCESS'

Note that the set and the nfsproc executions can be combined into a single call:

>>> pm.execute('nfsproc', targets=targets)
'SUCCESS'

After nfsproc is run, the data can be retrieved thus:

>>> nfs_data = pm.execute('get', 'nfs_data')
>>> fiducial_pos = pm.execute('get', 'fiducial_pos')
>>> center = pm.execute('get', 'center')
>>> prism = pm.execute('get', 'prism')

Running fidproc

The next step is running fidproc, which can be run thus:

>>> pm.execute('set', merged_fvc_spots=initial_merged_fvc_spots)
'SUCCESS'
>>> pm.execute('fidproc')
'SUCCESS'

>>> fiber_pos = pm.execute('get', 'fiber_pos')
>>> positioner_pos = pm.execute('get', 'positioner_pos')

Running posproc

Get some fake data to send to posproc::
>>> positioner_true = test_data.positioner_true

The next step is running posproc, which can be run thus:

>>> pm.execute('set', positioner_true=positioner_true)
'SUCCESS'
>>> pm.execute('posproc')
'SUCCESS'

>>> fiber_pos = pm.execute('get', 'fiber_pos')

Running gfaproc

gfaproc can be run thus:

>>> pm.execute('gfaproc', gfa_images=gfa_images)
'SUCCESS'

Like nfsproc, the parameters can be provided in a separate set execution. If they are unchanged sinces the previous execution, they need not be provided again. For example, when run after the nfsproc example above, the gfaproc example could have been simplified to:

>>> pm.execute('gfaproc', gfa_images=gfa_images)
'SUCCESS'

because nfs_data is already set correctly by the previous execution of nfsproc.

After gfaproc is run, the data can be retrieved thus:

>>> gfa_guide = pm.execute('get', 'gfa_guide')
>>> gfa_center = pm.execute('get', 'gfa_center')
>>> gfa_data = pm.execute('get', 'gfa_data')

Note that the gfa_data parameter is not expected to be useful except as input to fvcproc, and even then probably will never need to be retrieved explicitly.

Running fvcproc

fvcproc can be run thus:

>>> pm.execute('fvcproc', merged_fvc_spots=merged_fvc_spots)
'SUCCESS'

Again, when run after prior commands which have provided the necessary data, the previously provided keywords may be omitted:

>>> pm.execute('fvcproc', merged_fvc_spots=merged_fvc_spots)
'SUCCESS'

After fvcproc is run, the data can be retrieved thus:

>>> positioner_corr = pm.execute('get', 'positioner_corr')
>>> fibermap = pm.execute('get', 'fibermap')