Versions Compared

Key

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

...

Cloak
iddelayscan
  • Fetching the ControlPV information:
    ControlPV is available from the env object, and since it only changes at the beginning
    of each calibration cycle, the begincalibcycle function is the appropriate place to get it:
    none
    The ControlConfig object may contain several pvControl and pvMonitor objects. In this case
    there's only one, but make sure the name matches anyway: none
  • Fetching the IPIMB and PhaseCavity information:
    All the other information that we need, is available through the evt object, and
    event member function is the place to get it:
    none
    Use "XppSb3Ipm-1|Ipimb-0" (a.k.a. IPM3) sum of all channels for normalization and filtering
    none
    Use "XppSb3Pim-1|Ipimb-0" (a.k.a. PIM3) channel 1 as signal
    none
    Get the phase cavity:
    none
    Compute delay time and fill histograms
    none

Image peak finding

Here are a collection of useful algorithms for image analysis: http://docs.scipy.org/doc/scipy/reference/ndimage.html

...

CSPad images and tile arangements

CSPad data structure

...

The python code for this pyana module example resides in XtcExplorer/src/pyana_image.py.

Panel

Try some plotting of CSPad data using xtcexplorer. Launch the explorer and load xpp48712 run 66 (a dark run):

Code Block
none
none

elements = evt.getCsPadQuads(self.source, env)

elements here is a python list of ElementV1 or ElementV2 (or later versions) objects, each representing one quadrant. The list is not ordered, so to know which quadrant you have, you have to check with element.quad(). To store a local array of the whole CSPad detector, you can do the following.

...

xtcexplorer /reg/d/psdm/XPP/xpp48712/xtc/e153-r0066-s00-c00.xtc
  • *Look through a couple of events, then "Quit Pyana" and edit the configuration file. Add an output file name, and switch to "NoDisplay" and run 100 events to collect an average of dark images.
  • With darks collected, load another file from the same experiment: run 141. Edit the pyana configuration file to use the file you just generated to subtract darks. Run the explorer in "SlideShow" mode again.
  • Change the color scale of the plot by left and right clicking on the colorbar.

CSPad data structure

CSPad data in xtc is a list of elements. In pyana get the list from the evt (event) object (notice the need for the env (environment) object too!):

Code Block
none
none

...

elements 

...

= evt.getCsPadQuads(

...

self

...

.source, env

...

)

elements here is a python list of ElementV1 or ElementV2 (or later versions) objects, each representing one quadrant. The list is not ordered, so to know which quadrant you have, you have to check with element.quad(). To store a local array of the whole CSPad detector, you can do the following.

  • In beginjob, find out from the configuration object what part of the CSPad was in use (sometimes sections are missing):
    Code Block
    none
    none
    
    def beginjob ( self, evt, env ) : 
     : 
    
           config = env.getConfig(xtc.TypeId.Type.Id_CspadConfig, self.source)
            if not config:
           config     = env.getConfig(xtc.TypeId.Type.Id_CspadConfig, self.source)
            if not config:
                print '*** cspad config object is missing ***'
                return
                    
            quads = range(4)
     
            # memorize this list of sections for later
            self.sections = map(config.sections, quads)
    
  • In each event, get the current CSPad data:
    Code Block
    none
    none
    def event(self, evt, env): 
        elements = evt.getCsPadQuads(self.source,env)
    
        pixel_array = np.zeros((4,8,185,388), dtype="uint16")
        
        for element in elements: 
            data = element.data() # the 3-dimensional data array (list of 2d sections)
            quad = element.quad() # current quadrant number (integer value)
     
            # if any sections are missing, insert zeros
            if len( data ) < 8 :
                zsec = np.zeros( (185,388), dtype=data.dtype)
                for i in range (8) :
                    if i not in self.sections[quad] :
                        data = np.insert( data, i, zsec, axis=0 )
    
            pixel_array[quad] = data
    

...

For how to find the correct constants for each experiment, look at the CSPad alignment page.

...

Try some plotting of CSPad data using xtcexplorer. Launch the explorer and load xpp48712 run 66 (a dark run):

...


xtcexplorer /reg/d/psdm/XPP/xpp48712/xtc/e153-r0066-s00-c00.xtc

...

.

Non-interactive batch analysis

...