Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc xy analysis #122

Merged
merged 7 commits into from
Sep 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 67 additions & 9 deletions doc/pos_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ Moving positioners + measuring
------------------------------
This happens outside of desimeter. The robots are always moved using ``PetalApp.py``, which is an ICS wrapper around ``petal.py``.

``<desi_svn>/code/online/Positioner/PetalApp/<some_tag_or_branch>/python/PetalApp/PetalApp.py``
- ``<desi_svn>/code/online/Positioner/PetalApp/<some_tag_or_branch>/python/PetalApp/PetalApp.py``
- ``<desi_svn>/code/focalplane/plate_control/<some_tag_or_branch>/petal/petal.py``

``<desi_svn>/code/focalplane/plate_control/<some_tag_or_branch>/petal/petal.py``
Depending on the operational circumstance, there will be different high-level scripts which send the requests for which targets to go to, and when to trigger the FVC camera. These are in general:

Depending on the operational circumstance, there will be different high-level scripts which send the requests for which targets to go to, and when to trigger the FVC camera. These are in general the night time OCS script, or else for "xytests" and "arc calibrations", etc, the various PECS scripts.
Night time observations
- OCS script
- ``<desi_svn>/code/online/OCS/<some_tag_or_branch>/python/OCS/``

``<desi_svn>/code/online/OCS/<some_tag_or_branch>/python/OCS/``

``<desi_svn>/code/focalplane/plate_control/<some_tag_or_branch>/pecs/``
Scripted move sequences
- ``run_sequence.py``
- ``<desi_svn>/code/focalplane/plate_control/<some_tag_or_branch>/pecs/``

Legacy test scripts (mostly replaced by ``run_sequence.py``)
- ``arc_calibration.py``, ``grid_calibration.py``, ``xytest.py``, etc

For every move performed, numerous values get stored in the online database (posmovedb). These include:

Expand All @@ -43,6 +49,59 @@ For every move performed, numerous values get stored in the online database (pos

Anytime a calibration value is changed (such as ``LENGTH_R1``, ``LENGTH_R2``, etc), or indeed any other change of positioner state data, that fact will be recorded in the online database.

Typical test procedure
----------------------
Positioners are tested using pre-defined lists of moves and setup parameters. These are executed by ``run_sequence.py``. Data goes straight into the online DB. Analysis is done offline at any time, using desimeter. The typical steps are:

#) Locate the ``seq_*.ecsv`` file, defining the test sequence to be performed.
- These can also be freshly generated by running the script ``pecs/sequence_generator.py``
- Typical syntax: ``python sequence_generator.py``

#) Confirm the focal plane / petal hardware, fiber view camera, and online system are all up and running.
- Not explained here.
- As of 2020-09-10, information on hardware setup / operation is captured mostly in this google doc: https://docs.google.com/document/d/1auayJzVoZYV_LOhYA4mK8h_oTlYU4pC8JQJgvHVb8Us/edit?usp=sharing

#) Run the test.
- Code location: ``<desi_svn>/code/focalplane/plate_control/<some_tag_or_branch>/pecs/``
- Typical syntax: ``python run_sequence.py -i seq_<SOME_TEST>.ecsv --num_corr 2``
- For numerous other options\*, see help: ``python run_sequence.py --help``
- Review the test sequence (it will be displayed before anything happens, and you will have a chance to exit).
- Follow the interactive prompts to define which petals / buses / positioners should be operated.
- Throughout the test, data is stored in real time to the online DB, as soon as it is available.
- All output printed to stdout is saved into a log file on disk, verbatim.
- Between moves, there is a cool-down period (defined by cycle time option). If you need to quit the test midway through, it is *completely safe* to do CTRL-C in the terminal during this cool-down.
- After the test, note the exposure ID.

#) Get data from DB.
- Code location: ``<desimeter>/bin``
- Example syntax: ``get_posmoves --host beyonce.lbl.gov --port 5432 --password <password> --petal-ids 1 --with-calib --exposure-ids 2679 --pos-ids <optional comma-separated list> -o ~/<your_output_directory>``
- For numerous other options, see help: ``get_posmoves --help``
- Many files will be generated, one per positioners. You can restrict this by arguing only a specific list of posids to grab.
- Note as of 2020-09-10, we have had some issues with ports, when running requests from a computer other than beyonce. A workaround is to log into beyonce and run it like ``/software/products/desimeter-master/bin/get_posmoves``. You may need to first call ``prepare_desimeter``.

#) Analyze the data.
- Code location: ``<desimeter>/bin``
- Calibrations
- ``fit_posparams`` --> ``merge_posparams`` --> ``prepare_posparams_for_instr``
- See descriptions below.
- Performance (e.g. "xy tests")
- Example syntax: ``analyze_pos_performance -i M*.csv -o ~/<your_output_directory>``
- Plots, histograms, and summary csv files will be produced.
- This can be run really on any combination of data, not just an xy test. You could include night-time observations, for example. Just include the exposure-ids you want in the previous step, when you grabbed the data from the DB with ``get_posmoves``.

\* ``run_sequence.py`` has numerous options. These include:
- anticollision mode
- phi range limits
- fvc match radius
- auto-disabling of unmatched positioners
- auto-updating of internally-tracked (theta, phi) based on fvc measurements
- dry run (no actual movements of hardware)
- cycle tiem between moves
- number of fvc images per measurement
- number of correction moves per target
- number of best / worst positioners to list at stdout, for each measured target
- whether to park the positioners at a standard location before / after the test

Re-analysis of fiber positions with desimeter
---------------------------------------------
FVC fits files can be re-analyzed at any time after the fact using desimeter. Also see: `<posmov.rst>`_
Expand All @@ -61,8 +120,9 @@ As of 2020-06-16, desimeter provides the following tools:

Analysis of positioning performance
-----------------------------------
As of 2020-09-10, desimeter provides the following tools:

As of 2020-06-16, desimeter provides the following tools:
* ``analyze_pos_performance`` ... Calculates positioning errors move-by-move. Generates plots, histograms, and csv files summarizing performance.

* ``fit_posparams`` ... Fits positioner calibration parameters, by comparing measured (x,y) to internally-tracked (theta,phi).

Expand All @@ -88,5 +148,3 @@ As on overview of the role desimter plays in this process, those basic steps are
4. ``prepare_posparams_for_instr`` ... validate parameters and generate modified table

Finally after desimeter has prepared the new calibration parameters, we use ``pecs/set_calibrations.py`` (managed in DESI's svn repo, *not* desihub), which pushes data to the online DB.