Page History
...
Code Block | ||||
---|---|---|---|---|
| ||||
def event(self, evt, env):
ipm = evt.getSharedIpimbValue("HFX-DG3-IMB-02")
# or equivalently:
# ipm = evt.get(xtc.TypeId.Type.Id_SharedIpimb, "HFX-DG3-IMB-02")
try:
### Raw data ###
# arrays of 4 numbers:
ch = [ipm.ipimbData.channel0(),
ipm.ipimbData.channel1(),
ipm.ipimbData.channel2(),
ipm.ipimbData.channel3()]
ch_volt = [ipm.ipimbData.channel0Volts(),
ipm.ipimbData.channel1Volts(),
ipm.ipimbData.channel2Volts(),
ipm.ipimbData.channel3Volts()]
### Feature-extracted data ###
# array of 4 numbers:
fex_channels = ipm.ipmFexData.channel
# scalars:
fex_sum = ipm.ipmFexData.sum
fex_xpos = ipm.ipmFexData.xpos
fex_ypos = ipm.ipmFexData.ypos
except:
pass
|
Acqiris waveform data
This method can be used for any detector/device that has Acqiris waveform data. Edit the self.address field to get the detector of your choice.
...
Note that imsave saves the image only, pixel by pixel. If you want a view of the figure itself, lower resolution, you can save it from the interactive window you get from plt.show().
CsPad data
Here's an example of getting CsPad data from an event:
Code Block | ||||
---|---|---|---|---|
| ||||
def event(self,evt,env):
quads = evt.getCsPadQuads(self.img_source, env)
if not quads :
print '*** cspad information is missing ***'
return
# dump information about quadrants
print "Number of quadrants: %d" % len(quads)
for q in quads:
print " Quadrant %d" % q.quad()
print " virtual_channel: %s" % q.virtual_channel()
print " lane: %s" % q.lane()
print " tid: %s" % q.tid()
print " acq_count: %s" % q.acq_count()
print " op_code: %s" % q.op_code()
print " seq_count: %s" % q.seq_count()
print " ticks: %s" % q.ticks()
print " fiducials: %s" % q.fiducials()
print " frame_type: %s" % q.frame_type()
print " sb_temp: %s" % map(q.sb_temp, range(4))
# image data as 3-dimentional array
data = q.data()
|
data2 will give you the third section stored, but be aware that sections sometimes are missing,
and in this case you'll need to check with the configuration information that you can obtain in beginjob:
Code Block | ||||
---|---|---|---|---|
| ||||
def beginjob(self,evt,env):
config = env.getConfig(xtc.TypeId.Type.Id_CspadConfig, self.img_source)
if not config:
print '*** cspad config object is missing ***'
return
quads = range(4)
print
print "Cspad configuration"
print " N quadrants : %d" % config.numQuads()
print " Quad mask : %#x" % config.quadMask()
print " payloadSize : %d" % config.payloadSize()
print " badAsicMask0 : %#x" % config.badAsicMask0()
print " badAsicMask1 : %#x" % config.badAsicMask1()
print " asicMask : %#x" % config.asicMask()
print " numAsicsRead : %d" % config.numAsicsRead()
try:
# older versions may not have all methods
print " roiMask : [%s]" % ', '.join([hex(config.roiMask(q)) for q in quads])
print " numAsicsStored: %s" % str(map(config.numAsicsStored, quads))
except:
pass
print " sections : %s" % str(map(config.sections, quads))
print
|
Overview
Content Tools