desihub / desimeter

DESI coordinates and transformations
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

add ok2move script #104

Closed sbailey closed 4 years ago

sbailey commented 4 years ago

This PR adds an ok2move script that identifies which positioners are likely ok to move based upon the geometry to their two nearest neighbors. This is intended to be used as part of the recovery for a collision incident where positioners can get trapped between others. ok2move takes an input table of spots matched to positioners (e.g. using PR #102) and prints groups of positioners that are safe to move or optionally writes those lists to a file. It also optionally can output QA plots of the positioners in each group for a human double check before moving them (takes several minutes to generate all the plots at NERSC).

(desi) [ok2move*] desimeter $ ok2move --help
usage: ok2move [options]

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        input table of spots matched to positioners
  -o OUTPUT, --output OUTPUT
                        output file of positioners ok to move
  -g GROUPSIZE, --groupsize GROUPSIZE
                        Size of groups of positioners for output [default 50]
  --plotdir PLOTDIR     base directory for QA plots (requires --fvcimage too)
  --fvcimage FVCIMAGE   input FVC image (required if --plotdir ...)
  --extname EXTNAME     extname of FVC file to use

The output text is intended for cutting-and-pasting to ICS quick_move, and is split into groups (adjustable with --groupsize):

group0 = ['M08246','M08025','M08138','M08020','M08204','M08021','M08023','M08127','M07802','M08239','M08264','M08257','M08258','M07705','M07706','M08022','M08228','M08123','M08260','M08268','M01908','M02388','M01051','M08238','M02049','M08089','M01606','M01057','M08283','M08259','M02145','M05997','M08122','M07672','M08218','M07103','M07551','M08207','M08107','M08475','M01373','M01999','M08008','M08265','M07099','M07703','M07875','M05993','M07813','M07003']
group1 = ['M07810','M08206','M06003','M00628','M01451','M06002','M08277','M06533','M01475','M08081','M02161','M01060','M02278','M01436','M07876','M02224','M08285','M01578','M06537','M08103','M02187','M01437','M01657','M01066','M06535','M02002','M08289','M05669','M08220','M01620','M08305','M08317','M08043','M01409','M08039','M06896','M08173','M08275','M08074','M08215','M02071','M08175','M02220','M07782','M08105','M08316','M06846','M08045','M08046','M08042']
...

Example output plots: image

In the end, the intended procedure is that one would use this to identify positioners that could be safely moved, rehome those in groups, and then remeasure the location of all positioners and rerun ok2move to identify new positioners that are not safe to move.

A potential improvement would be to identify which positioners are safe to move in +phi vs. -phi, but I'm starting with a PR for the minimally useful functionality, while trusting anti-collision checks to prevent further crashes; this PR just focuses the work on positioners that could move.