Page History
...
This page holds a few example code-snippets for use in pyana analysis. The analysis is written in python and uses MatPlotLib.PyPlot for plotting of data. Compare with myana user examples to see how (some of) the same things can be done using the myana analysis framework.
Encoder data (delay scanner)
Code Block | ||||
---|---|---|---|---|
| ||||
def event(self,evt,env):
try:
encoder = evt.get(xtc.TypeId.Type.Id_EncoderData, self.enc_source )
encoder_value = encoder.value()
except:
print "No encoder found in this event"
return
|
You could combine it with phase cavity time, and compute a time delay from it, for example (I don't know the origin of these parameters!):
Code Block | ||||
---|---|---|---|---|
| ||||
# Encoder Parameters to convert to picoseconds
delay_a = -80.0e-6;
delay_b = 0.52168;
delay_c = 299792458;
delay_0 = 0;
delay_time = (delay_a * encoder_value + delay_b)*1.e-3 / delay_c)
delay_time = 2 * delay_time / 1.0e-12 + delay_0 + phase_cavity1
|
Time data
The time of the event can be obtained within the event function:
...
Overview
Content Tools