src::AreaDetector Namespace Reference


Classes

class  AreaDetector
 ----------------------------- More...

Functions

def __init__
 -----------------------------
def set_source
 -----------------------------
def print_members
 -----------------------------
def print_attributes
 -----------------------------
def set_print_bits
 -----------------------------
def set_env
 -----------------------------
def set_do_offset
 -----------------------------
def runnum
 -----------------------------
def is_cspad
 -----------------------------
def is_cspad2x2
 -----------------------------
def ndim
 -----------------------------
def size
 -----------------------------
def shape
 -----------------------------
def loading_status
 -----------------------------
def do_reshape_2d_to_3d
 -----------------------------
def pedestals
 -----------------------------
def rms
 -----------------------------
def gain
 -----------------------------
def mask_calib
 -----------------------------
def bkgd
 -----------------------------
def status
 -----------------------------
def status_as_mask
 -----------------------------
def mask_neighbors
 -----------------------------
def mask_edges
 -----------------------------
def gain_mask
 -----------------------------
def gain_mask_non_zero
 -----------------------------
def common_mode
 -----------------------------
def instrument
 -----------------------------
def print_config
 -----------------------------
def raw_data
 -----------------------------
def raw
 -----------------------------
def common_mode_apply
 -----------------------------
def common_mode_correction
 -----------------------------
def calib_data
 -----------------------------
def set_gain_mask_factor
 -----------------------------
def calib
 -----------------------------
def mask
 -----------------------------
def mask_comb
 -----------------------------
def geometry
 ----------------------------- Geometry info
def coords_x
def coords_y
def coords_z
def coords_xy
def coords_xyz
def areas
def mask_geo
def indexes_x
def indexes_y
def indexes_xy
def point_indexes
def pixel_size
def move_geo
def tilt_geo
def image_xaxis
def image_yaxis
def image
def ndarray_from_image
def save_txtnda
 -----------------------------
def save_asdaq
 -----------------------------
def load_txtnda
 -----------------------------
def photons
 -----------------------------
def shape_config
 -----------------------------

Variables

string __version__ = "$Revision: 12946 $"
tuple ntest = int(sys.argv[1])
tuple ds = psana.DataSource(dsname)
tuple env = ds.env()
tuple cls = env.calibStore()
tuple eviter = ds.events()
tuple evt = eviter.next()
tuple rnum = evt.run()
tuple det = AreaDetector(src, env, pbits=0)
tuple nda = det.pedestals(rnum)
tuple t0_sec = time()
tuple nda = det.raw(evt)


Function Documentation

def src::AreaDetector::__init__ (   self,
  src,
  env,
  pbits = 0,
  iface = 'P' 
)

-----------------------------

Constructor of the class AreaDetector.

   Parameters
   ----------
   src   : str       - data source, ex: 'CxiDs2.0:Cspad.0'
   env   : psana.Env - environment, ex: env=ds.env(), where ds=psana.DataSource('exp=cxif5315:run=169')
   pbits : int       - print control bit-word
   iface : char      - preferable interface: 'C' - C++ (everything) or 'P' - Python based (everything except common mode) 

Definition at line 195 of file AreaDetector.py.

def src::AreaDetector::set_source (   self,
  srcpar,
  set_sub = True 
)

-----------------------------

Sets data source parameter.

   Parameters
   ----------
   srcpar  : str  - regular source or its alias, ex.: 'XppEndstation.0:Rayonix.0' or 'rayonix'
   set_sub : bool - default=True - propagates source parameter to low level package  

Definition at line 234 of file AreaDetector.py.

def src::AreaDetector::print_members (   self  ) 

-----------------------------

Depricated method renamed to print_attributes() 

Definition at line 265 of file AreaDetector.py.

def src::AreaDetector::print_attributes (   self  ) 

-----------------------------

Prints some of object attributes.

Definition at line 272 of file AreaDetector.py.

def src::AreaDetector::set_print_bits (   self,
  pbits 
)

-----------------------------

Sets print-control bitword.

   Parameter
   ---------
   pbits : int - print-control bitword, ex.: 0377 (octal) 

Definition at line 287 of file AreaDetector.py.

def src::AreaDetector::set_env (   self,
  env 
)

-----------------------------

Sets environment variable.

   Parameter
   ---------
   env : psana.Env() - psana environment variable, ex.: env=ds.env()

Definition at line 300 of file AreaDetector.py.

def src::AreaDetector::set_do_offset (   self,
  do_offset = False 
)

-----------------------------

Switch mode of the Camera type of detector.

   Parameter
   ---------
   do_offset : bool - control parameter to turn on/off Camera intensity offset, default=False

Definition at line 313 of file AreaDetector.py.

def src::AreaDetector::runnum (   self,
  par 
)

-----------------------------

Returns integer run number from different options of input parameter.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   int - run number

Definition at line 325 of file AreaDetector.py.

def src::AreaDetector::is_cspad (   self  ) 

-----------------------------

Returns True/False for CSPAD/other detector type

   Returns
   -------
   bool - True if current detector is CSPAD, False otherwise.

Definition at line 340 of file AreaDetector.py.

def src::AreaDetector::is_cspad2x2 (   self  ) 

-----------------------------

Returns True/False for CSPAD2x2/other detector type

   Returns
   -------
   bool - True if current detector is CSPAD2x2, False otherwise.

Definition at line 351 of file AreaDetector.py.

def src::AreaDetector::ndim (   self,
  par 
)

-----------------------------

Definition at line 363 of file AreaDetector.py.

Referenced by ImgAlgos::NDArrAverage::collectStatForType(), ImgAlgos::saveNDArrayInFile(), and ImgAlgos::saveNDArrInEvent().

def src::AreaDetector::size (   self,
  par 
)

-----------------------------

Returns size of the detector pixel-array.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   int - size of the detector numpy pixel-array (number of pixels)

Definition at line 383 of file AreaDetector.py.

def src::AreaDetector::shape (   self,
  par = 0 
)

-----------------------------

Returns shape of the detector pixel-array.

   For all detectors except cspad2x2 shape is the same as in DAQ. 

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - shape of the detector pixel-array, ex. for cspad (32,185,388).

Definition at line 402 of file AreaDetector.py.

def src::AreaDetector::loading_status (   self,
  par,
  calibtype = None 
)

-----------------------------

Returns loading status of calibration constants of specified type.
   Parameters
   ----------
   rnum      : int - run number
   calibtype : int - enumerated value from the list
               gu.PEDESTALS, PIXEL_STATUS, PIXEL_RMS, PIXEL_GAIN, PIXEL_MASK, PIXEL_BKGD, COMMON_MODE.

   Returns
   -------
   int - enumerated value from the list gu.LOADED, DEFAULT, UNREADABLE, UNDEFINED, WRONGSIZE, NONFOUND.

Definition at line 440 of file AreaDetector.py.

def src::AreaDetector::do_reshape_2d_to_3d (   self,
  flag = False 
)

-----------------------------

For Chuck - if flag is True - reshape 2-d arrays to 3-d.
   Parameters
   ----------
   flag : bool - False(def)/True 

Definition at line 457 of file AreaDetector.py.

def src::AreaDetector::pedestals (   self,
  par 
)

-----------------------------

Returns per-pixel array of pedestals (dark run intensities) from calib directory.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - per-pixel values loaded for calibration type pedestals.

Definition at line 525 of file AreaDetector.py.

Referenced by cspad_mod::DataProxyT< DataType, ElemType >::getTypedImpl(), and cspad_mod::DataProxy2x2::getTypedImpl().

def src::AreaDetector::rms (   self,
  par 
)

-----------------------------

Returns per-pixel array of RMS values from calib directory.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - per-pixel values loaded for calibration type pixel_rms.

Definition at line 542 of file AreaDetector.py.

def src::AreaDetector::gain (   self,
  par 
)

-----------------------------

Returns per-pixel array of gain factors from calib directory.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - per-pixel values loaded for calibration type pixel_gain.

Definition at line 559 of file AreaDetector.py.

def src::AreaDetector::mask_calib (   self,
  par 
)

-----------------------------

Returns per-pixel array of mask from calib directory.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - per-pixel values loaded for calibration type pixel_mask.

Definition at line 576 of file AreaDetector.py.

def src::AreaDetector::bkgd (   self,
  par 
)

-----------------------------

Returns per-pixel array of background intensities from calib directory.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - per-pixel values loaded for calibration type pixel_bkgd.

Definition at line 593 of file AreaDetector.py.

def src::AreaDetector::status (   self,
  par 
)

-----------------------------

Returns array of pixel-status from calib directory.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - per-pixel values loaded for calibration type pixel_status.
            status bits: 0 - good pixel
                         1 - saturated intensity
                         2 - hot rms
                         4 - cold
                         8 - cold rms

Definition at line 610 of file AreaDetector.py.

def src::AreaDetector::status_as_mask (   self,
  par,
  mode = 0 
)

-----------------------------

Returns per-pixel array of mask generated from pixel_status.

   Parameter
   ---------
   par  : int or psana.Event() - integer run number or psana event object.
   mode : int - 0/1/2 masks zero/four/eight neighbors around each bad pixel

   Returns
   -------
   np.array - mask generated from calibration type pixel_status (1/0 for status 0/>0, respectively).

Definition at line 632 of file AreaDetector.py.

def src::AreaDetector::mask_neighbors (   self,
  mask,
  allnbrs = True 
)

-----------------------------

Returns n-d array of mask with masked neighbors on each 2-d segment.

   Parameter
   ---------
   mask    : np.array - input mask of good/bad (1/0) pixels
   allnbrs : bool - False/True masks 4/8 of neighbors around each bad pixel

   Returns
   -------
   np.array - mask with masked neighbors, shape = mask.shape

Definition at line 655 of file AreaDetector.py.

def src::AreaDetector::mask_edges (   self,
  mask,
  mrows = 1,
  mcols = 1 
)

-----------------------------

Returns n-d array of mask with masked mrows and mcols edges on each 2-d segment.

   Parameter
   ---------
   mask  : np.array - input mask of good/bad (1/0) pixels
   mrows : int - number of edge rows to mask
   mcols : int - number of edge columns to mask

   Returns
   -------
   np.array - mask with masked edges, shape = mask.shape

Definition at line 671 of file AreaDetector.py.

def src::AreaDetector::gain_mask (   self,
  par,
  gain = None 
)

-----------------------------

Returns per-pixel array with gain mask evaluated from detector configuration data.

   Parameter
   ---------
   par  : int or psana.Event() - integer run number or psana event object.
   gain : float - gain factor; mask will be multiplied by this factor if it is specified.

   Returns
   -------
   np.array - per-pixel gain mask; (int16) 1/0 or (float) gain/1 for low/high gain pixels.

Definition at line 688 of file AreaDetector.py.

def src::AreaDetector::gain_mask_non_zero (   self,
  par,
  gain = None 
)

-----------------------------

The same as gain_mask, but return None if ALL pixels have high gain.

   Parameter
   ---------
   par  : int or psana.Event() - integer run number or psana event object.
   gain : float - gain factor; mask will be multiplied by this factor if it is specified.

   Returns
   -------
   np.array - per-pixel gain mask; (int16) 1/0 or (float) gain/1 for low/high gain pixels.

Definition at line 704 of file AreaDetector.py.

def src::AreaDetector::common_mode (   self,
  par 
)

-----------------------------

Returns array of common mode correction parameters.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - values loaded for calibration type common_mode.

Definition at line 720 of file AreaDetector.py.

Referenced by ImgAlgos::CSPadCommonModeCorrection::getAndProcessDataset().

def src::AreaDetector::instrument (   self  ) 

-----------------------------

Returns name of instrument.

   Returns
   -------
   str - name of instrument, ex.: 'AMO', 'XPP', 'SXR', 'CXI, 'MEC', 'XCS', etc.   

Definition at line 737 of file AreaDetector.py.

def src::AreaDetector::print_config (   self,
  evt 
)

-----------------------------

Prints configuration parameters if available.

   Parameter
   ---------
   evt : psana.Event() - psana event object.

Definition at line 749 of file AreaDetector.py.

def src::AreaDetector::raw_data (   self,
  evt 
)

-----------------------------

Alias for depricated method renamed to raw(evt) 

Definition at line 761 of file AreaDetector.py.

def src::AreaDetector::raw (   self,
  evt 
)

-----------------------------

Returns per-pixel array of intensities from raw data.

   Parameter
   ---------
   evt : psana.Event() - psana event object.

   Returns
   -------
   np.array - per-pixel intensities [ADU] of raw data.

Definition at line 769 of file AreaDetector.py.

Referenced by psana_examples::DumpAcqiris::event(), ImgAlgos::AcqirisArrProducer::print_wf_in_event(), and ImgAlgos::AcqirisArrProducer::proc_and_put_wf_in_event().

def src::AreaDetector::common_mode_apply (   self,
  par,
  nda,
  cmpars = None,
  kwargs 
)

-----------------------------

Apply common mode correction algorithm.

   Apply common mode correction to nda (assuming that nda is data ndarray with subtracted pedestals)
   nda.dtype = np.float32 (or 64) is considered only, because common mode does not make sense for int data.
   If cmpars is not None then this sequence is used to override default common mode parameters coming from
   calib/.../common_mode/...

   Parameters
   ----------
   par    : int or psana.Event() - integer run number or psana event object.
   nda    : np.array - input: raw data with subtracted pedestals, output: cm corrected data.
   cmpars : list - common mode parameters, ex.: (1,50,50,100).
            By default uses parameters from calib directory. 

   Returns
   -------
   I/O parameter nda : np.array - per-pixel corrected intensities.

Definition at line 801 of file AreaDetector.py.

def src::AreaDetector::common_mode_correction (   self,
  par,
  nda,
  cmpars = None 
)

-----------------------------

Returns per-pixel array of common mode correction offsets.
  
   Parameters
   ----------
   par    : int or psana.Event() - integer run number or psana event object.
   nda    : np.array - raw data with subtracted pedestals. Input data is not modified.
   cmpars : list - common mode parameters, ex.: (1,50,50,100)
            By default uses parameters from calib directory. 

   Returns
   -------
   np.array - per-pixel common mode correction offsets.

Definition at line 843 of file AreaDetector.py.

def src::AreaDetector::calib_data (   self,
  evt 
)

-----------------------------

Alias for depricated method renamed to calib.

Definition at line 863 of file AreaDetector.py.

Referenced by pypsalg::AreaDetHist::AreaDetHist(), and pypsalg::AreaDetHist::update().

def src::AreaDetector::set_gain_mask_factor (   self,
  gfactor = 6.85 
)

-----------------------------

Sets the gain factor which is passed to gain_mask(...) in the det.calib and det.image methods.

Definition at line 875 of file AreaDetector.py.

def src::AreaDetector::calib (   self,
  evt,
  cmpars = None,
  mbits = 1,
  kwargs 
)

-----------------------------

Returns per-pixel array of calibrated data intensities.

   Gets raw data ndarray, applys baic corrections and return thus calibrated data.
   Applied corrections:
   - pedestal subtraction, returns det.raw(evt) if file with pedestals is missing   
   - apply common mode correction
   - gain_mask or "hybrid" gain from configuration object for CSPAD(2x2) only
   - gain if pixel_gain calibration file is available
   - apply mask generated from pixel status ("bad pixels"
     from calibration).  Optionally apply other masks if
     "mbits" parameter set
  
   Parameters
   ----------
   evt    : psana.Event() - psana event object.
   cmpars : list - common mode parameters, ex.: (1,50,50,100)
            By default uses parameters from calib directory. 
   mbits  : int - mask control bit-word.  optional.
            defaults to 1.  Bit definitions:
         + 1  - pixel_status ("bad pixels" deployed by calibman)
         + 2  - pixel_mask (deployed by user in "pixel_mask" calib dir)
         + 4  - edge pixels
         + 8  - big "central" pixels of a cspad2x1
         + 16 - unbonded pixels
         + 32 - unbonded pixel with four neighbors
         + 64 - unbonded pixel with eight neighbors

   Returns
   -------
   np.array - per-pixel array of calibrated intensities from data.

Definition at line 882 of file AreaDetector.py.

def src::AreaDetector::mask (   self,
  par,
  calib = False,
  status = False,
  edges = False,
  central = False,
  unbond = False,
  unbondnbrs = False,
  unbondnbrs8 = False 
)

-----------------------------

Returns per-pixel array with mask values (per-pixel product of all requested masks).

   Parameters
   ----------
   par     : int or psana.Event() - integer run number or psana event object.
   calib   : bool - True/False = on/off mask from calib directory.
   status  : bool - True/False = on/off mask generated from calib pixel_status. 

   Other parameters make sense for cspad 2x1 sensors only:
   edges      : bool - True/False = on/off mask of edges. 
   central    : bool - True/False = on/off mask of two central columns. 
   unbond     : bool - True/False = on/off mask of unbonded pixels.
   unbondnbrs : bool - True/False = on/off mask of unbonded pixel with four neighbors. 
   unbondnbrs8: bool - True/False = on/off mask of unbonded pixel with eight neighbors. 

   Returns
   -------
   np.array - per-pixel mask values 1/0 for good/bad pixels.

Definition at line 974 of file AreaDetector.py.

def src::AreaDetector::mask_comb (   self,
  par,
  mbits = 0 
)

-----------------------------

Returns per-pixel array with combined mask controlled by mbits bit-word.

   This method has same functionality as method mask(...) but under control of a single bit-word mbits. 

   Parameters
   ----------
   par   : int or psana.Event() - integer run number or psana event object.
   mbits : int - mask control bit-word.
         = 0  - returns None
         + 1  - pixel_status ("bad pixels" deployed by calibman)
         + 2  - pixel_mask (deployed by user in "pixel_mask" calib dir)
         + 4  - edge pixels
         + 8  - big "central" pixels of a cspad2x1
         + 16 - unbonded pixels
         + 32 - unbonded pixel with four neighbors
         + 64 - unbonded pixel with eight neighbors

   Returns
   -------
   np.array - per-pixel mask values 1/0 for good/bad pixels.

Definition at line 1013 of file AreaDetector.py.

def src::AreaDetector::geometry (   self,
  par 
)

----------------------------- Geometry info

Creates and returns detector geometry object.

   Parameter
   ---------
   par : psana.Event() | int - psana event object or run number

   Returns
   -------
   PSCalib.GeometryAccess - detector geometry object.

Definition at line 1058 of file AreaDetector.py.

def src::AreaDetector::coords_x (   self,
  par 
)

Returns per-pixel array of x coordinates.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - array of pixel x coordinates.

Definition at line 1073 of file AreaDetector.py.

def src::AreaDetector::coords_y (   self,
  par 
)

Returns per-pixel array of y coordinates.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - array of pixel y coordinates.

Definition at line 1089 of file AreaDetector.py.

def src::AreaDetector::coords_z (   self,
  par 
)

Returns per-pixel array of z coordinates.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - array of pixel z coordinates.

Definition at line 1105 of file AreaDetector.py.

def src::AreaDetector::coords_xy (   self,
  par 
)

Returns per-pixel arrays of x and y coordinates.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - 2 arrays of pixel x and y coordinates, respectively.

Definition at line 1121 of file AreaDetector.py.

def src::AreaDetector::coords_xyz (   self,
  par 
)

Returns per-pixel arrays of x, y, and z coordinates.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - 3 arrays of pixel x, y, and z coordinates, respectively.

Definition at line 1137 of file AreaDetector.py.

def src::AreaDetector::areas (   self,
  par 
)

Returns per-pixel array of pixel area.

   Parameter
   ---------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   np.array - array of pixel areas.

Definition at line 1153 of file AreaDetector.py.

def src::AreaDetector::mask_geo (   self,
  par,
  mbits = 255 
)

Returns per-pixel array with mask controlled by mbits bit-word.

   Parameters
   ----------
   par   : int or psana.Event() - integer run number or psana event object.
   mbits : int - mask control bit-word.
         = 0 - returns None
         + 1 - edges     
         + 2 - central   
         + 4 - unbond    
         + 8 - unbondnbrs

   Returns
   -------
   np.array - per-pixel mask values 1/0 for good/bad pixels.

Definition at line 1169 of file AreaDetector.py.

def src::AreaDetector::indexes_x (   self,
  par,
  pix_scale_size_um = None,
  xy0_off_pix = None,
  do_update = False 
)

Returns array of pixel integer x indexes.

   Parameters
   ----------
   par               : int or psana.Event() - integer run number or psana event object.
   pix_scale_size_um : float - pixel scale size [um] which is used to convert coordinate in index.
   xy0_off_pix       : list of floats - image (x,y) origin offset in order to make all indexes positively defined.
   do_update         : bool - force to update cached array.

   Returns
   -------
   np.array - array of pixel x indexes.

Definition at line 1191 of file AreaDetector.py.

def src::AreaDetector::indexes_y (   self,
  par,
  pix_scale_size_um = None,
  xy0_off_pix = None,
  do_update = False 
)

Returns array of pixel integer y indexes.

   Parameters
   ----------
   par               : int or psana.Event() - integer run number or psana event object.
   pix_scale_size_um : float - pixel scale size [um] which is used to convert coordinate in index.
   xy0_off_pix       : list of floats - image (x,y) origin offset in order to make all indexes positively defined.
   do_update         : bool - force to update cached array.

   Returns
   -------
   np.array - array of pixel y indexes.

Definition at line 1210 of file AreaDetector.py.

def src::AreaDetector::indexes_xy (   self,
  par,
  pix_scale_size_um = None,
  xy0_off_pix = None,
  do_update = False 
)

Returns two arrays of pixel integer x and y indexes.

   Parameters
   ----------
   par               : int or psana.Event() - integer run number or psana event object.
   pix_scale_size_um : float - pixel scale size [um] which is used to convert coordinate in index.
   xy0_off_pix       : list of floats - image (x,y) origin offset in order to make all indexes positively defined.
   do_update         : bool - force to update cached array.

   Returns
   -------
   (np.array, np.array) - list of two arrays of pixel x and y indexes, respectively.

Definition at line 1229 of file AreaDetector.py.

def src::AreaDetector::point_indexes (   self,
  par,
  pxy_um = (0,0,
  pix_scale_size_um = None,
  xy0_off_pix = None 
)

Returns (ix, iy) indexes of the point (x,y) specified in [um].

   Parameters
   ----------
   par               : int or psana.Event() - integer run number or psana event object.
   pxy_um            : list of two float values - coordinates of the point in the detector frame, default (0,0)
   pix_scale_size_um : float - pixel scale size [um] which is used to convert coordinate in index.
   xy0_off_pix       : list of floats - image (x,y) origin offset in order to make all indexes positively defined.

   Returns
   -------
   tuple - (ix, iy) tuple of two indexes associated with input point coordinates.

Definition at line 1248 of file AreaDetector.py.

def src::AreaDetector::pixel_size (   self,
  par 
)

Returns pixel scale size in [um]. 

   Parameters
   ----------
   par : int or psana.Event() - integer run number or psana event object.

   Returns
   -------
   float - pixel size in [um].

Definition at line 1267 of file AreaDetector.py.

def src::AreaDetector::move_geo (   self,
  par,
  dx,
  dy,
  dz 
)

Moves detector. 

   Parameters
   ----------
   par : int or psana.Event() - integer run number or psana event object.
   dx, dy, dz : float - three coordinate increments [um] of the detector motion. 

Definition at line 1283 of file AreaDetector.py.

def src::AreaDetector::tilt_geo (   self,
  par,
  dtx,
  dty,
  dtz 
)

Tilts detector. 

   Parameters
   ----------
   par : int or psana.Event() - integer run number or psana event object.
   dtx, dty, dtz : float - three angular increments [deg] of the detector tilt. 

Definition at line 1295 of file AreaDetector.py.

def src::AreaDetector::image_xaxis (   self,
  par,
  pix_scale_size_um = None,
  x0_off_pix = None 
)

Returns array of pixel x coordinates associated with image x-y grid.

   Parameters
   ----------
   par : int or psana.Event() - integer run number or psana event object.
   pix_scale_size_um : float - pixel scale size [um] which is used to convert coordinate in index.
   x0_off_pix        : float - origin x coordinate offset in number of pixels

   Returns
   -------
   np.array - array of pixel x coordinates of image x-y grid.

Definition at line 1307 of file AreaDetector.py.

def src::AreaDetector::image_yaxis (   self,
  par,
  pix_scale_size_um = None,
  y0_off_pix = None 
)

Returns array of pixel x coordinates associated with image x-y grid.

   Parameters
   ----------
   par : int or psana.Event() - integer run number or psana event object.
   pix_scale_size_um : float - pixel scale size [um] which is used to convert coordinate in index.
   y0_off_pix        : float - origin y coordinate offset in number of pixels

   Returns
   -------
   np.array - array of pixel y coordinates of image x-y grid.

Definition at line 1324 of file AreaDetector.py.

def src::AreaDetector::image (   self,
  evt,
  nda_in = None,
  pix_scale_size_um = None,
  xy0_off_pix = None,
  do_update = False 
)

Returns 2-d array of intensities for imaging.

   Parameters
   ----------
   evt               : psana.Event() - psana event object.
   nda_in            : input n-d array which needs to be converted in image; default - use calib methood.
   pix_scale_size_um : float - pixel scale size [um] which is used to convert coordinate in index.
   xy0_off_pix       : list of floats - image (x,y) origin offset in order to make all indexes positively defined.
   do_update         : bool - force to update cached array.

   Returns
   -------
   np.array - 2-d array of intensities for imaging.

Definition at line 1341 of file AreaDetector.py.

def src::AreaDetector::ndarray_from_image (   self,
  par,
  image,
  pix_scale_size_um = None,
  xy0_off_pix = None,
  do_update = False 
)

Returns n-d array of intensities extracted from image using image bin indexes.

   Parameters
   ----------
   par               : int or psana.Event() - integer run number or psana event object.
   image             : np.array - input 2-d array which will be converted to n-d array.
   pix_scale_size_um : float - pixel scale size [um] which is used to convert coordinate in index.
   xy0_off_pix       : list of floats - image (x,y) origin offset in order to make all indexes positively defined.
   do_update         : bool - force to update cached array.

   Returns
   -------
   np.array - n-d array of intensities made from image.

Definition at line 1373 of file AreaDetector.py.

def src::AreaDetector::save_txtnda (   self,
  fname = 'nda.txt',
  ndarr = None,
  cmts = (),
  fmt = '%.1f',
  verbos = False,
  addmetad = True 
)

-----------------------------

Saves n-d array in the formatted text file with hash-type cumments and metadata.

   Parameters
   ----------
   fname    : str - output file name.
   ndarr    : np.array - array of numerical values to save in text file.
   cmts     : list of str - list of strings which will be saved as comments in the file header.
   fmt      : str - format of values in the file.
   verbose  : bool - True/False = on/off messages from this method (about saved file etc.)
   addmetad : bool - True/False = on/off saving methadata (data type, and shape info) in file.

Definition at line 1397 of file AreaDetector.py.

def src::AreaDetector::save_asdaq (   self,
  fname = 'nda.txt',
  ndarr = None,
  cmts = (),
  fmt = '%.1f',
  verbos = False,
  addmetad = True 
)

-----------------------------

Saves per-pixel n-d array shaped and ordered as in DAQ.

   The same functionality as in the method save_txtnda(...), but array is shuffled to DAQ order. 
   Currently re-shuffle pixels for cspad2x2 only from natural shape=(2,185,388) to daq shape (185,388,2).
   For all other detectors n-d array is saved unchanged. 

   Parameters
   ----------
   fname    : str - output file name.
   ndarr    : np.array - array of numerical values to save in text file.
   cmts     : list of str - list of strings which will be saved as comments in the file header.
   fmt      : str - format of values in the file.
   verbose  : bool - True/False = on/off messages from this method (about saved file etc.)
   addmetad : bool - True/False = on/off saving methadata (data type, and shape info) in file.

Definition at line 1417 of file AreaDetector.py.

def src::AreaDetector::load_txtnda (   self,
  fname 
)

-----------------------------

Returns n-d array loaded from specified formatted text file.

   Parameters
   ----------
   fname : str - input file name.

   Returns
   -------
   np.array - array with values loaded from file,
              shaped in accordance with metadata (if available).
              If metadata is missing, output array will have 2- or 1-d shape;
              spaces and '\n' characters in the text file are used to find the shape of the array. 

Definition at line 1439 of file AreaDetector.py.

def src::AreaDetector::photons (   self,
  evt,
  nda_calib = None,
  mask = None,
  adu_per_photon = None 
)

-----------------------------

Returns 2-d or 3-d array of integer number of merged photons - algorithm suggested by Chuck.

   Parameters
   ----------
   evt            : psana.Event() - psana event object.
   nda_calib      : (float, double, int, int16) numpy.array - calibrated data, float number of photons per pixel.
   mask           : (uint8) numpy.array user defined mask.
   adu_per_photon : float conversion factor which is applied as nda_calib/adu_per_photon.

   Returns
   -------
   np.array - 2-d or 3-d array of integer number of merged photons.

Definition at line 1458 of file AreaDetector.py.

def src::AreaDetector::shape_config (   self,
  env 
)

-----------------------------

Definition at line 1489 of file AreaDetector.py.


Variable Documentation

string src::AreaDetector::__version__ = "$Revision: 12946 $" [static]

Definition at line 173 of file AreaDetector.py.

tuple src::AreaDetector::ntest = int(sys.argv[1]) [static]

Definition at line 1507 of file AreaDetector.py.

tuple src::AreaDetector::ds = psana.DataSource(dsname) [static]

Definition at line 1515 of file AreaDetector.py.

tuple src::AreaDetector::env = ds.env() [static]

Definition at line 1517 of file AreaDetector.py.

tuple src::AreaDetector::cls = env.calibStore() [static]

Definition at line 1518 of file AreaDetector.py.

Referenced by psana_python::moduleFactory().

tuple src::AreaDetector::eviter = ds.events() [static]

Definition at line 1519 of file AreaDetector.py.

tuple src::AreaDetector::evt = eviter.next() [static]

Definition at line 1520 of file AreaDetector.py.

tuple src::AreaDetector::rnum = evt.run() [static]

Definition at line 1521 of file AreaDetector.py.

tuple src::AreaDetector::det = AreaDetector(src, env, pbits=0) [static]

Definition at line 1525 of file AreaDetector.py.

tuple src::AreaDetector::nda = det.pedestals(rnum) [static]

Definition at line 1527 of file AreaDetector.py.

tuple src::AreaDetector::t0_sec = time() [static]

Definition at line 1531 of file AreaDetector.py.

tuple src::AreaDetector::nda = det.raw(evt) [static]

Definition at line 1532 of file AreaDetector.py.


Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7