Versions Compared

Key

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

...

  • pdscalibdata/include/PnccdBaseV1.h                   - baseclass for pnCCD parameters, defines Segs, Rows, Cols, Size
  • pdscalibdata/include/PnccdPedestalsV1.h            -   loads pedestals from file, returns ndarray of pedestals
  • pdscalibdata/include/PnccdCommonModeV1.h     -   the same for common mode
  • pdscalibdata/include/PnccdPixelGainV1.h            - the same for pixel gain
  • pdscalibdata/include/PnccdPixelRmsV1.h            - the same for pixel rms
  • pdscalibdata/include/PnccdPixelStatusV1.h         - the same for pixel status
  • PSCalib::PnccdCalibPars                                   - wrapper for all pnCCD types

...

Detector-dependent interface

Example can be found in PSCalib/test/ex_calib_file_finder.cpp:

...

  • Too simple calibration file format, does not allow any metadata or comments.
  • Detector-dependent objects and parameters "knows" about parameters' array type and shape:
    • PSCalib::PnccdCalibPars which depends on PnccdPedestalsV1, PnccdCommonModeV1, ..., PnccdBaseV1
    • pdscalibdata::PnccdPedestalsV1::pars_t      = float
      pdscalibdata::PnccdCommonModeV1::pars_t     = uint16_t 
      pdscalibdata::PnccdPixelStatusV1::pars_t    = uint16_t
      pdscalibdata::PnccdPixelGainV1::pars_t      = float
    • const std::string groupName = "PNCCD::CalibV1";                             - do we really need it ?   

How to improve interface for "new-style" calibration

We need to define calibration array shape, type of parameters, and where to find them under calib directory: groupName="PNCCD::CalibV1", source="Camp.0:pnCCD.1";

...

Detector-independent interface

  • Interface is declared in the abstract base class PSCalib::CalibPars
  • Access to all detector-dependent classes is hidden in the static factory class PSCalib::CalibParsStore
Code Block
#include "PSCalib/CalibPars.h"
#include "PSCalib/CalibParsStore.h"

// Instatiation
//Here we assume that code is working inside psana module where evt and env variables are defined through input parameters of call-back methods.
//Code below instateates calibpars object using factory static method PSCalib::CalibParsStore::Create:

std::string calib_dir = env.calibDir(); // or "/reg/d/psdm/<INS>/<experiment>/calib"
std::string  group = std::string(); // or something like "PNCCD::CalibV1";
const std::string source = "Camp.0:pnCCD.1";
const std::string key = ""; // key for raw data
Pds::Src src; env.get(source, key, &src);
PSCalib::CalibPars* calibpars = PSCalib::CalibParsStore::Create(calib_dir, group, src, PSCalib::getRunNumber(evt));

// Access methods
 *  calibpars->printCalibPars();
 *  const PSCalib::CalibPars::pedestals_t*    peds_data = calibpars->pedestals();
 *  const PSCalib::CalibPars::pixel_gain_t*   gain_data = calibpars->pixel_gain();
 *  const PSCalib::CalibPars::pixel_rms_t*    rms_data  = calibpars->pixel_rms();
 *  const PSCalib::CalibPars::pixel_status_t* mask_data = calibpars->pixel_status();
 *  const PSCalib::CalibPars::common_mode_t*  cmod_data = calibpars->common_mode();

 

New approach to calibration files with header

In order to get rid of detector dependent types of calibration parameters we need to add metadata in the calibration file. All metadata can be listed in the header of the calibration files, for example, using keyward mapping/dictionary

...

pdscalibdata::DetPedestalsV1::pars_t   = float
pdscalibdata::DetCommonModeV1::pars_t  = uint16_t 
pdscalibdata::DetPixelStatusV1::pars_t = uint16_t
pdscalibdata::DetPixelGainV1::pars_t   = float

...

:

Code Block
# RULES:
# Lines starting with # in the beginning of the file are considered as comments or pseudo-comments for metadata
# Lines without # with space-separated values are used for input of parameters
# Empty lines are ignored

# Optional fields:
# TITLE:      This is a file with pedestals
# DATE_TIME:  2014-01-30 10:21:23
# AUTHOR:     someone
# EXPERIMENT: amotut13
# DETECTOR:   Camp.0:pnCCD.1
# CALIB_TYPE: pedestals

# Mandatory fields to define the ndarray<TYPE,NDIMS> and its shape as unsigned shape[NDIMS] = {DIM1,DIM2,DIM3}
# TYPE:       float
# NDIMS:      3
# DIM1:       4
# DIM2:       255
# DIM3:       255

973.941639 881.189675 1050.211 773.263749 899.241302 981.805836 1150.72615 993.084175 1121.15488 1029.76319 1220.14927 903.278339 1097.49944 1066.94949 1263.71044 1053.53872 1194.35915 935.320988 1317 ...

 

psana modules for pnCCD

New module ImgAlgos.PnccdNDArrProducer

...