pdscalibdata::NDArrIOV1< TDATA, NDIM > Class Template Reference
[pdscalibdata package]

#include <NDArrIOV1.h>

List of all members.

Public Types

typedef TDATA data_t
typedef unsigned shape_t
 LOADED = 1
 DEFAULT
 UNREADABLE
 UNDEFINED
enum  STATUS { LOADED = 1, DEFAULT, UNREADABLE, UNDEFINED }

Public Member Functions

 NDArrIOV1 (const std::string &fname, const unsigned print_bits=0377)
 Three constructors provide different default initialization. Each of them create an object which holds the file name and pointer (0 before load) to ndarray. File name can be specified later in the get_ndarray(fname) method, but print_file() and print_ndarray() methods will complain about missing file name until it is specified. Constructor with missing default initialization. Empty ndarray will be returned if constants from file can not be loaded.
 NDArrIOV1 (const std::string &fname, const shape_t *shape_def, const TDATA &val_def=TDATA(0), const unsigned print_bits=0377)
 Constructor with default ndarray of specified shape filled by a single value.
 NDArrIOV1 (const std::string &fname, const ndarray< const TDATA, NDIM > &nda_def, const unsigned print_bits=0377)
 Constructor with externally defined default ndarray.
 ~NDArrIOV1 ()
 Destructor.
unsigned int ndim () const
 Returns number of dimensions of ndarray.
void print ()
void print_file ()
 Prints input file line-by-line.
void print_ndarray ()
 Loads (if necessary) ndarray from file and print it.
ndarray< TDATA, NDIM > & get_ndarray (const std::string &fname=std::string())
 Loads (if necessary) ndarray from file and returns it.
std::string str_status ()
 Returns string with status of calibration constants.
STATUS status ()
 Returns enumerated status of calibration constants.
std::string str_ndarray_info ()
 Returns string with info about ndarray.
std::string str_shape ()
 Returns string of shape.

Static Public Member Functions

static void save_ndarray (const ndarray< const TDATA, NDIM > &nda, const std::string &fname, const std::vector< std::string > &vcoms=std::vector< std::string >(), const unsigned &print_bits=0377)
 Static method to save ndarray in file with internal metadata and external comments.


Detailed Description

template<typename TDATA, unsigned NDIM>
class pdscalibdata::NDArrIOV1< TDATA, NDIM >

This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.

See also:
Version:
Id
NDArrIOV1.h 12297 2016-07-20 00:10:06Z dubrovin@SLAC.STANFORD.EDU
Author:
Mikhail Dubrovin
Interface

Definition at line 179 of file NDArrIOV1.h.


Member Typedef Documentation

template<typename TDATA, unsigned NDIM>
typedef TDATA pdscalibdata::NDArrIOV1< TDATA, NDIM >::data_t

Definition at line 185 of file NDArrIOV1.h.

template<typename TDATA, unsigned NDIM>
typedef unsigned pdscalibdata::NDArrIOV1< TDATA, NDIM >::shape_t

Definition at line 186 of file NDArrIOV1.h.


Member Enumeration Documentation

template<typename TDATA, unsigned NDIM>
enum pdscalibdata::NDArrIOV1::STATUS

Enumerator:
LOADED 
DEFAULT 
UNREADABLE 
UNDEFINED 

Definition at line 188 of file NDArrIOV1.h.


Constructor & Destructor Documentation

template<typename TDATA, unsigned NDIM>
pdscalibdata::NDArrIOV1< TDATA, NDIM >::NDArrIOV1 ( const std::string &  fname,
const unsigned  print_bits = 0377 
)

Three constructors provide different default initialization. Each of them create an object which holds the file name and pointer (0 before load) to ndarray. File name can be specified later in the get_ndarray(fname) method, but print_file() and print_ndarray() methods will complain about missing file name until it is specified. Constructor with missing default initialization. Empty ndarray will be returned if constants from file can not be loaded.

Parameters:
[in] fname - std::string file name
[in] print_bits - unsigned bit-word to control verbosity

Definition at line 35 of file NDArrIOV1.cpp.

template<typename TDATA, unsigned NDIM>
pdscalibdata::NDArrIOV1< TDATA, NDIM >::NDArrIOV1 ( const std::string &  fname,
const shape_t shape_def,
const TDATA &  val_def = TDATA(0),
const unsigned  print_bits = 0377 
)

Constructor with default ndarray of specified shape filled by a single value.

Parameters:
[in] fname - std::string file name
[in] shape_def - default shape of the ndarray (is used for shape crosscheck at readout and in case of missing file or metadata)
[in] val_def - value to fill all data elements by default(in case of missing file or metadata)
[in] print_bits - unsigned bit-word to control verbosity

Definition at line 51 of file NDArrIOV1.cpp.

template<typename TDATA, unsigned NDIM>
pdscalibdata::NDArrIOV1< TDATA, NDIM >::NDArrIOV1 ( const std::string &  fname,
const ndarray< const TDATA, NDIM > &  nda_def,
const unsigned  print_bits = 0377 
)

Constructor with externally defined default ndarray.

Parameters:
[in] fname - std::string file name
[in] nda_def - default ndarray, which will be returned if file is missing
[in] print_bits - unsigned bit-word to control verbosity

Definition at line 72 of file NDArrIOV1.cpp.

References ndarray< ElemType, NDim >::shape(), and ndarray< ElemType, NDim >::size().

template<typename TDATA, unsigned NDIM>
pdscalibdata::NDArrIOV1< TDATA, NDIM >::~NDArrIOV1 (  ) 

Destructor.

Definition at line 91 of file NDArrIOV1.cpp.

References src::psana_doc_info::info, and MsgLog.


Member Function Documentation

template<typename TDATA, unsigned NDIM>
ndarray< TDATA, NDIM > & pdscalibdata::NDArrIOV1< TDATA, NDIM >::get_ndarray ( const std::string &  fname = std::string()  ) 

Loads (if necessary) ndarray from file and returns it.

Parameters:
[in] fname std::string file name

Definition at line 324 of file NDArrIOV1.cpp.

References MsgLog.

Referenced by PSCalib::GenericCalibPars< TBASE >::common_mode(), main(), PSCalib::GenericCalibPars< TBASE >::pedestals(), PSCalib::GenericCalibPars< TBASE >::pixel_bkgd(), PSCalib::GenericCalibPars< TBASE >::pixel_gain(), PSCalib::GenericCalibPars< TBASE >::pixel_mask(), PSCalib::GenericCalibPars< TBASE >::pixel_rms(), PSCalib::GenericCalibPars< TBASE >::pixel_status(), PSCalib::GenericCalibPars< TBASE >::shape_of_ndarray(), PSCalib::GenericCalibPars< TBASE >::size_of_ndarray(), and test_cspad2x2().

template<typename TDATA, unsigned NDIM>
unsigned int pdscalibdata::NDArrIOV1< TDATA, NDIM >::ndim (  )  const [inline]

Returns number of dimensions of ndarray.

Definition at line 232 of file NDArrIOV1.h.

Referenced by pdscalibdata::NDArrIOV1< TDATA, NDIM >::print(), pdscalibdata::NDArrIOV1< TDATA, NDIM >::print_ndarray(), pdscalibdata::NDArrIOV1< TDATA, NDIM >::save_ndarray(), pdscalibdata::NDArrIOV1< TDATA, NDIM >::str_ndarray_info(), and pdscalibdata::NDArrIOV1< TDATA, NDIM >::str_shape().

template<typename TDATA, unsigned NDIM>
void pdscalibdata::NDArrIOV1< TDATA, NDIM >::print (  ) 

Access methods prints recognized templated parameters.

Definition at line 345 of file NDArrIOV1.cpp.

References src::psana_doc_info::info, MsgLog, and pdscalibdata::NDArrIOV1< TDATA, NDIM >::ndim().

Referenced by main().

template<typename TDATA, unsigned NDIM>
void pdscalibdata::NDArrIOV1< TDATA, NDIM >::print_file (  ) 

Prints input file line-by-line.

Definition at line 361 of file NDArrIOV1.cpp.

References src::psana_doc_info::info, MsgLog, and PsanaModuleDetectorXface::warning().

Referenced by main().

template<typename TDATA, unsigned NDIM>
void pdscalibdata::NDArrIOV1< TDATA, NDIM >::print_ndarray (  ) 

Loads (if necessary) ndarray from file and print it.

Definition at line 388 of file NDArrIOV1.cpp.

References src::psana_doc_info::info, MsgLog, pdscalibdata::NDArrIOV1< TDATA, NDIM >::ndim(), and ndarray< ElemType, NDim >::size().

Referenced by main().

template<typename TDATA, unsigned NDIM>
void pdscalibdata::NDArrIOV1< TDATA, NDIM >::save_ndarray ( const ndarray< const TDATA, NDIM > &  nda,
const std::string &  fname,
const std::vector< std::string > &  vcoms = std::vector< std::string >(),
const unsigned &  print_bits = 0377 
) [static]

Static method to save ndarray in file with internal metadata and external comments.

Parameters:
[in] nda ndarray to save in file
[in] fname std::string file name to save ndarray
[in] vcoms std::vector<std::string> vector of strings with comments; one-string comment per vector entry
[in] print_bits for output control; 0-print nothing, +1-info about saved files

Definition at line 437 of file NDArrIOV1.cpp.

References ex_all_dets::i, src::psana_doc_info::info, MsgLog, ex_andor3d::nda, pdscalibdata::NDArrIOV1< TDATA, NDIM >::ndim(), pdscalibdata::strEnvVar(), and pdscalibdata::strTimeStamp().

Referenced by main(), and ImgAlgos::saveNDArrayInFile().

template<typename TDATA, unsigned NDIM>
STATUS pdscalibdata::NDArrIOV1< TDATA, NDIM >::status (  )  [inline]

Returns enumerated status of calibration constants.

Definition at line 255 of file NDArrIOV1.h.

template<typename TDATA, unsigned NDIM>
std::string pdscalibdata::NDArrIOV1< TDATA, NDIM >::str_ndarray_info (  ) 

Returns string with info about ndarray.

Definition at line 405 of file NDArrIOV1.cpp.

References ndarray< ElemType, NDim >::data(), ex_all_dets::i, pdscalibdata::NDArrIOV1< TDATA, NDIM >::ndim(), and ndarray< ElemType, NDim >::size().

template<typename TDATA, unsigned NDIM>
std::string pdscalibdata::NDArrIOV1< TDATA, NDIM >::str_shape (  ) 

Returns string of shape.

Definition at line 425 of file NDArrIOV1.cpp.

References ex_all_dets::i, and pdscalibdata::NDArrIOV1< TDATA, NDIM >::ndim().

template<typename TDATA, unsigned NDIM>
std::string pdscalibdata::NDArrIOV1< TDATA, NDIM >::str_status (  ) 

Returns string with status of calibration constants.

Definition at line 159 of file NDArrIOV1.cpp.


The documentation for this class was generated from the following files:
Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7