Skip to content

Cast numpy.float64 to float and round it

Cyril Danilevski requested to merge hotfix/acq_rate_rounding into master

Description

Round the acquisition rate read from files to 1 decimal point.
This is wanted because we are only interested in the acquisition rate to bucket the data, and not do science with this value.

It does not make sense to do it upstream, in the device where the data is created, as better accuracy might be needed (eg. profiling the detector over the course of 10 years).

Some variance could be added to MyMDC, but that still messes up the retrieval of constants for online calibration: a human would have to enter the exact value.

How Has This Been Tested?

This was tested with the following command:

xfel-calibrate AGIPD DARK \
    --slurm-mem 750 \
    --slurm-name darks_mini_half \
    --report-to /gpfs/exfel/data/scratch/danilevc/out/mini_half_test \
    --receiver-id {}CH0 \
    --karabo-id-control HED_EXP_AGIPD500K2G \
    --karabo-da-control AGIPD500K2G00 \
    --h5path-ctrl /CONTROL/{}/MDL/FPGA_COMP \
    --in-folder /gpfs/exfel/exp/HED/202031/p900174/raw/ \
    --out-folder /gpfs/exfel/data/scratch/danilevc/out/mini_half_test/runs_r0010_r0011_r0012 \
    --karabo-id HED_DET_AGIPD500K2G \
    --run-high 10 \
    --run-med 11 \
    --run-low 12 \
    --modules 0,1,2,3,4,5,6,7 \

Here's an extract of the output RST showing the fix in action:

Calculate Offsets, Noise and Thresholds
---------------------------------------

The calculation is performed per-pixel and per-memory-cell. Offsets are
simply the median value for a set of dark data taken at a given gain,
noise the standard deviation, and gain-bit values the medians of the
gain array.


.. parsed-literal::

    Process file:  /gpfs/exfel/exp/HED/202031/p900174/raw//r0010/RAW-R0010-AGIPD00-S00000.h5
    Process file:  /gpfs/exfel/exp/HED/202031/p900174/raw//r0011/RAW-R0011-AGIPD00-S00000.h5
    Process file:  /gpfs/exfel/exp/HED/202031/p900174/raw//r0012/RAW-R0012-AGIPD00-S00000.h5
    Using 352 memory cells
    Using 1.1 MHz acquisition rate

Where previously it was:

.. parsed-literal::

    Process file:  /gpfs/exfel/exp/HED/202031/p900174/raw//r0010/RAW-R0010-AGIPD00-S00000.h5
    Process file:  /gpfs/exfel/exp/HED/202031/p900174/raw//r0011/RAW-R0011-AGIPD00-S00000.h5
    Process file:  /gpfs/exfel/exp/HED/202031/p900174/raw//r0012/RAW-R0012-AGIPD00-S00000.h5
    Using 352 memory cells
    Using 1.100000023841858 MHz acquisition rate

Note

This is currently used for the hibeff webservice, which is running its own service at the moment.

@ahmedk @kamile

Edited by Cyril Danilevski

Merge request reports