Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Command geometry_convert with parameters executed in psana environment converts geometry constants between psana and CrystFEL formats forth and back depending on input file name extension. Converter works for a few major composite detectors cspad, pnccd, epix10ka, jungfrau. 

Forward conversion by default changes coordinate frame from psana (the same frame as in optical metrology) to CrystFEL (LAB frame: z-along photon beam, y-up, x=[y×z]). The LAB frame is widely used in crystallography data processing. Backward conversion does not change coordinate frame and generates panels' positions and tilts as is. Pixel coordinates reconstructed in psana from this file will also be defined in the LAB frame.

...

Command for "forward" conversion of the detector geometry constants from psana to CrystFEL needs in a couple of parameters for detector type (-d) and input psana geometry file name (-f) . It is also convenient to specify unique and optionally output CrystFEL geometry file name (-o), for example

      geometry_convert -d cspad -f geo-cspad-psana.data -o geo-cspad-crystfel.geom

By default converter changes coordinate frame from psana (similar to one in optical metrology) to LAB (usually used in CrystFEL). Parameter --cframe 0 allows to keep the coordinate frame unchanged.

For now, forward Forward converter recognizes detector types detectors epix10ka, epix10kav2, jungfrau, cspad, pnccd , pnccdv2, associated with segment types from their segment names EPIX10KA:V1, EPIX10KA:V2, JUNGFRAU:V1, JUNGFRAU:V2, SENS2X1:V1, PNCCD:V1, MTRX:V2:512:512:75:75 , respectively, used in the input geometry file.loaded from the input geometry file.

Use dataset for z position correction

Since ana-4.0.47-py3 three optional parameters added to apply z-position correction from PV variables.

Code Block
titleoptional parameters for z-position correction from data
collapsetrue
  --dsname DSNAME       FOR Z CORRECTION FROM DATA - dataset (str) like
                        exp=<experiment>:run=<run-number>:smd:..., def=None
  --zpvname ZPVNAME     FOR Z CORRECTION FROM DATA - z-correction variable
                        name ex: CXI:DS1:MMS:06.RBV or alias ex: DscCsPad_z,
                        def=None
  --f_um F_UM           FOR Z CORRECTION FROM DATA - factor for conversion PV
                        value to um, def=1000.000000

To apply z position correction at least --dsname parameter should be specified. In this case PV names CXI:DS1:MMS:06.RBV, CXI:DS2:MMS:06.RBV, MFX:DET:MMS:04.RBV, XPP:ROB:POS:Z, AMO:LMP:MMS:10.RBV are tested for availability.

  • if nothing found, the list of all available PV names is printed, correction is not applied,
  • if more than one found, specification of one of them is requested in parameter --zpvname,
  • if one is found - its value is used with factor --f_um to apply correction.
  • if --zpvname is specified incorrectly and not found, the list of all available PV names is printed, correction is not applied.\

Example of the command with z position correction:

geometry_convert -f geo-jungfrau.data -o geo-jungfrau.geom --dsname exp=cxic00318:run=123:smd --zpvname CXI:DS1:MMS:06.RBV

 Conversion Conversion from CrystFEL to psana

Command for "backward" conversion of the detector geometry constants from CrystFEL to psana needs in a couple of parameters for detector type (-d) and input CrystFEL geometry file name (-f). Optional output file name (-o) for psana geometry is also useful, for example

...

For now, backward converter recognizes works for detector types epix10ka, jungfrau, cspad (with quads like in cxi), cspadv2 (without quads like in xpp), pnccd. Information about detector type is missing in the CrystFEL *.geom file, so parameted -d needs to be specified.

Special case of CSPAD detector

ASIC naming convention in CrystFEL are slightly different for cspad with and without moving quads. For now, appropriate Appropriate detector type (-d) should be selected specified explicitly as cspad or cspadv2, respectively, for exampe

...

Code Block
titleCurrent result for command geometry_convert -h
collapsetrue
Converts geometry constants from psana to CrystFEL format and backward (see
--fname).

optional arguments:
  -h, --help            show this help message and exit
  -d DETTYPE, --dettype DETTYPE
                        detector type, one of epix10ka, jungfrau, cspad,
                        pnccd, def=epix10ka
  -f FNAME, --fname FNAME
                        input geometry file name. File name extention *.geom
                        launches converter from CrystFEL to psana,
                        def=/reg/g/psdm/detector/data_test/geometry/geo-
                        epix10ka2m-16-segment.data
  -o OFNAME, --ofname OFNAME
                        output file name, def=geo-crystfel.txt
  -l LOGLEV, --loglev LOGLEV
                        logging level name, one of NOTSET, DEBUG, INFO,
                        WARNING, ERROR, CRITICAL, def=INFO
  --cframe CFRAME       coordinate frame 0/1 for psana/LAB, def=1. Works for
                        PSANA->CRYSTFEL conversion ONLY where it selects frame
                        for pixel coordinates. Backward conversion
                        CRYSTFEL->PSANA does not change frame. For test
                        perpose it is assumed that forth and back conversion
                        PSANA->CRYSTFEL->PSANA should not change constants in
                        the geometry file (up to precision lose at conversion)
                        if they are defined for the same coordinate frame. For
                        this type of test parameter should be set to 0 to keep
                        psana frame unchanged.

Test of converter

CSPAD

Panel type SENS2X1:V1 describes cspad 2x1 panel geometry in psana. There are two types of cspad detectors, xpp- and cxi-like, w/o and with quads, which has different configuration both in psana and CrystFEL.

Code Block
  cp /reg/g/psdm/detector/data_test/geometry/geo-cspad-test.data .
  geometry_convert -d cspad -f geo-cspad-test.data -o geo-cspad-test-cframe-psana.geom --cframe 0
  geometry_convert -d cspadv2 -f geo-cspad-test-cframe-psana.geom -o geo-cspad-test-back.data
  geometry_image -g geo-cspad-test.data -a /reg/g/psdm/detector/data_test/npy/nda-mfx11116-r0624-e005365-MfxEndstation-0-Cspad-0-max.txt -R10 -i0

epix10ka2m

Panel types

Code Block
  cp /reg/g/psdm/detector/data_test/geometry/geo-epix10ka2m-test.txt .
  geometry_convert -d epix10ka -f geo-epix10ka2m-test.txt -o geo-epix10ka2m-test-cframe-psana.geom --cframe 0
  geometry_convert -d epix10ka -f geo-epix10ka2m-test-cframe-psana.geom -o geo-epix10ka2m-test-back.txt
  then see the minor difference between geo-epix10ka2m-test.txt and geo-epix10ka2m-test-back.txt
  or check image with each of geometry files:
  geometry_image -g geo-epix10ka2m-test-back.txt -a /reg/g/psdm/detector/data_test/npy/nda-mfxc00118-r0184-epix10ka2m-silver-behenate-max.txt -R10 -i0

jungfrau

There may be two segment types Jungfrau:V1 and Jungfrau:V2 which represent the same panel from two sides. Forward test works for both types, backward returns panels of the Jungfrau:V2 type.

Code Block
  cp /reg/g/psdm/detector/data_test/geometry/geo-jungfrau-8-test.data .
  geometry_convert -d jungfrau -f geo-jungfrau-8-test.data -o geo-jungfrau-8-test-cframe-psana.geom --cframe 0
  geometry_convert -d jungfrau -f geo-jungfrau-8-test-cframe-psana.geom -o geo-jungfrau-8-test-back.data
  geometry_image -g geo-jungfrau-8-test.data -a /reg/g/psdm/detector/data_test/npy/nda-cxilv9518-r0008-jungfrau-lysozyme-max.npy -R10 -i0

pnccd

A waste majority of pnccd geometry files in psana use old-style segment description as PNCCD:V1 with matrix coordinate reference frame. Forward conversion from psana-to-CrystFEL naturally supports this format. However, this format is not convenient for uniform backward conversion from CrystFEL-to-psana the arbitrary Cartesian frame. Backward conversion use segment description as MTRX:V2 in output file. The same segment type can be used in the conversion from psana-to-CrystFEL, but all geometry constants for panel position and orientation needs to be changed.  This issue creates a mess in direct comparison between original   and forth-and-back converted geometry file. For now this type of test is unavailable.

Conversion from psana-to-CrystFEL was tested long time ago and presumably works.

DETTYPE, --dettype DETTYPE
                        USED FOR CRYSTFEL TO PSANA ONLY - 
                        detector type, one of epix10ka, jungfrau, cspad, cspadv2,
                        pnccd, def=epix10ka
 

Reference

...

...