Versions Compared

Key

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

...

Like the other frameworks, pyana is an executable that loops through the XTC file and calls all
requested user modules at certain transitions. All the analysts need to do is to fill in the
relevant functions in their user analysis module:

Toggle Cloak
idkappe
code

Cloak
idkappe

Point detector delay scan

...

Panel

For the following two examples, check out the latest version of the pyana_examples package:

Code Block
none
none

addpkg 

...

pyana_examples HEAD
scons

Point detector delay scan

Panel

Open an editor and save the following in a file named pyana.cfg:

Code Block
none
none

...


    def event( self, evt, env ) :

...


        ipmN_raw = evt.get(TypeId.Type.Id_IpimbData, "XppSb3Ipm-1|Ipimb-0")
        ipmN_fex = evt.get(TypeId.Type.Id_IpmFex, "XppSb3Ipm-1|Ipimb-0")

        ipmN_norm = ipmN_fex.sum

...


        ipmS_raw = evt.get(TypeId.Type.Id_IpimbData, "XppSb3Pim-1|Ipimb-0" )
        ipmS_fex = evt.get(TypeId.Type.Id_IpmFex, "XppSb3Pim-1|Ipimb-0" )

        ipm_sig = ipmS_fex.channel[1]

...


        pc = evt.getPhaseCavity()
        phasecav1 = pc.fFitTime1
        phasecav2 = pc.fFitTime2
        charge1 = pc.fCharge1
        charge2 = pc.fCharge2

...

[pyana]

modules pyana_examples.xppt_delayscan

[pyana_examples.xppt_delayscan]
controlpv = fs2:ramp_angsft_target
ipimb_norm = XppSb3Ipm-1|Ipimb-0
ipimb_sig = XppSb3Pim-1|Ipimb-0
threshold = 0
outputfile = point_scan_delay.npy

Run pyana (start with 200 events):

Code Block
none
none

pyana -n 200 /reg/d/psdm/XPP/xppi0310/xtc/e81-r0098-s0*

Toggle Cloak
iddelayscan
Highlighting of some code snippets from xppt_delayscan.py:

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

...