| 1 | #!/usr/bin/python -tt
|
|---|
| 2 | #
|
|---|
| 3 | # Example
|
|---|
| 4 | # * looping over RawData class object
|
|---|
| 5 | #
|
|---|
| 6 |
|
|---|
| 7 | from pyfact import RawData
|
|---|
| 8 | from plotters import Plotter
|
|---|
| 9 | from drs_spikes import DRSSpikes
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 | #define filenames
|
|---|
| 13 | data_filename = 'data/20120223_210.fits.gz'
|
|---|
| 14 | calib_filename = 'data/20120223_206.drs.fits.gz'
|
|---|
| 15 |
|
|---|
| 16 | #make a RawData object
|
|---|
| 17 | run = RawData(data_filename, calib_filename, return_dict = True)
|
|---|
| 18 |
|
|---|
| 19 | #make a Plotter class ... this is an easy way for plotting ... but there are
|
|---|
| 20 | # many was to plot data ... without this class ... it was written for convenience, but there is no strong reason to use it...
|
|---|
| 21 | myplotter = Plotter('titel of the plot', xlabel='time in slices', ylabel='amplitude calibrated data ... in mV')
|
|---|
| 22 |
|
|---|
| 23 | # make a DRSSpike object ... this object is
|
|---|
| 24 | #DRS_spike_remover = DRSSpikes()
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | for event in run:
|
|---|
| 28 | print 'event id:', event['event_id']
|
|---|
| 29 | print 'trigger type', int(event['trigger_type'].value)
|
|---|
| 30 | data = event['acal_data']
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | #if you like to have also the DRS spikes removed ... do:
|
|---|
| 35 | #data = DRS_spike_remover( data )
|
|---|
| 36 |
|
|---|
| 37 | myplotter( data[23] , 'pixel 23' )
|
|---|
| 38 |
|
|---|
| 39 | #if you like to skip the first 12slices and the last 12slices this can be done like this
|
|---|
| 40 | #myplotter( data[23, 12:-12] , 'pixel 23 skiped first 12 and last 12 slices :-)' )
|
|---|
| 41 |
|
|---|
| 42 | answer = raw_input('hit <Enter> to go on .... hit "q" to quit')
|
|---|
| 43 | if 'q' in answer:
|
|---|
| 44 | break
|
|---|