Using PlateMaker through DOS, simulating all required data¶
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/54321')
... except FileNotFoundError:
... pass
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'
Using nfssim
to simulate PlateMaker
inputs¶
The nfssim
command creates simulated data for sending to
succeeding PlateMaker
steps, except for those data produced by
fvcsim
(see below):
>>> ra, decl = 187.7, 12.4 ;# the Virgo cluster, just for fun
>>> pm.execute('set', instrument='desi', seq_id=54321)
'SUCCESS'
>>> pm.execute('nfssim', coords=(ra, decl))
54321
If you want to use default coordinates, just leave off the coords keyword parameter.
Simulated data can now be retrieved:
>>> nfs_data = pm.execute('get', 'nfs_data')
>>> assignments = pm.execute('get', 'assignments')
>>> fiducial_pos = pm.execute('get', 'fiducial_pos')
>>> initial_merged_fvc_spots = pm.execute('get', 'merged_fvc_spots')
>>> gfa_images = pm.execute('get', 'gfa_images')
>>> fvc_image = pm.execute('get', 'fvc_image')
Running nfsproc
¶
We have already set the seq_id
and instrument
, so we don’t
need to do it again.
nfsproc
can be run thus:
>>> pm.execute('nfsproc', assignments=assignments)
'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
¶
nfsproc
and fidproc
produce their own guesset at
positioner_true
, so ask for it so we can feed it back as test
data. Note that PlateMaker
already has this version of the data,
so this isn’t really necessary, except to better match non-simulation
operations in the following step.
>>> positioner_true = pm.execute('get', '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'
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 fvcsim
¶
FVC analysis now needs to be simulated. Note that the image to be analyzed was created by nfssim, above:
>>> pm.execute('fvcsim', fvc_image=fvc_image)
'SUCCESS'
The simulated data can now be retrieved, if desired:
>>> merged_fvc_spots = pm.execute('get', 'merged_fvc_spots')
Running fvcproc
¶
fvcproc
can be run thus:
>>> 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')