source: fact/tools/pyscripts/sandbox/dneise/spike_studies/save_spikes.py@ 15446

Last change on this file since 15446 was 13632, checked in by neise, 13 years ago
initial commit of my tests and so on
  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/usr/bin/python -tti
2
3# script, which saves a lot of information about
4# DRS spikes in a file, for further analysis.
5from pyfact import RawData
6from drs_spikes import DRSSpikes
7import numpy as np
8
9# I need a callback function for the call of DRSSpikes
10# this function should be a member of RawData,
11# so that it knows all necessary information
12# In order to do this, I should inherit from RawData
13# and just add one single function.
14class RD_spike_ana( RawData ):
15 def callback(self, drsspikes ):
16 print 'Event ID', self.event_id
17 print 'singles:'
18 for s in drsspikes.singles:
19 print np.unravel_index( s, (drsspikes.row, drsspikes.col) )
20
21def spike_callback(drsspikes):
22 print drsspikes.__dict__
23
24
25data_file_name = '/home/dominik/20120223_205.fits.gz'
26calib_file_name = '/home/dominik/20120223_202.drs.fits.gz'
27outfile = None
28
29run = RD_spike_ana( data_file_name, calib_file_name, return_dict=True)
30despike = DRSSpikes(user_action = run.callback)
31
32
33
34
35for event in run:
36 data = event['acal_data'][:,12:-12]
37 ddata = despike(data)
38
39 ret = raw_input('q for quit')
40 if 'q' in ret:
41 break
Note: See TracBrowser for help on using the repository browser.