def _setCalibrations(self, evt): """ Method that sets the xtcav calibration values for a given run. """ # DONE in __init__ #if not self._camera: self._setDetectorDataObjects() #if not self._darkreference: self._loadDarkReference() #if not self._lasingoffreference: self._loadLasingOffReference() self._roixtcav = xtup.getXTCAVImageROI(self._valsxtp, evt) logger.debug('_roixtcav: %s' % str(self._roixtcav)) self._global_calibration = xtup.getGlobalXTCAVCalibration( self._valsxtp, evt) logger.debug('_global_calibration: %s' % str(self._global_calibration)) self._saturation_value = xtup.getCameraSaturationValue( self._valsxtp, evt) logger.debug('_saturation_value: %d' % self._saturation_value) if self._roixtcav and self._global_calibration and self._saturation_value: #Only reason to do this is to allow us to use same 'processImage' function #across lasing on/off shots self.parameters = LasingOnParameters(\ self.num_bunches, self.snr_filter,\ self.roi_expand, self.roi_fraction,\ self.island_split_method, self.island_split_par1,\ self.island_split_par2) self._calibrationsset = True
def _getCalibrationValues(nev, evt, xtcavroipars, xtcavcalibpars): """ Internal method. Sets calibration parameters for image processing Returns: roi: region of interest in image global_calibration: global parameters of xtcav machine saturation_value: value at which image is saturated and no longer valid first_image: index of first valid shot in run """ roi_xtcav = xtup.getXTCAVImageROI(xtcavroipars, evt) #logger.debug('roi_xtcav: %s' % str(roi_xtcav)) global_calibration = xtup.getGlobalXTCAVCalibration( xtcavcalibpars, evt) #logger.debug('global_calibration: %s' % str(global_calibration)) saturation_value = xtup.getCameraSaturationValue(xtcavcalibpars, evt) #logger.debug('saturation_value: %s' % str(saturation_value)) logger.info('Event %2d CalibrationValues: roi_xtcav: %s\t global_calibration: %s\t saturation_value: %s'%\ (nev, str(roi_xtcav), str(global_calibration), str(saturation_value))) resp = (roi_xtcav, global_calibration, saturation_value) return None if None in resp else resp
def _getImageROI(self, nev, evt, xtcavpars): self.ROI = xtup.getXTCAVImageROI(xtcavpars, evt) logger.info('\t Event %2d ImageROI: %s' % (nev, str(self.ROI))) return self.ROI is not None
def _getImageROI(self, nev, evt, camraw, valsxtp): self.ROI = xtup.getXTCAVImageROI(valsxtp, evt) logger.info('\t Event %2d ImageROI: %s' % (nev, str(self.ROI))) return self.ROI is not None