source: fact/tools/pyscripts/sandbox/dneise/spike_studies/spike_ana.py@ 14788

Last change on this file since 14788 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.3 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
8from plotters import Plotter
9import scipy.signal as signal
10# I need a callback function for the call of DRSSpikes
11# this function should be a member of RawData,
12# so that it knows all necessary information
13# In order to do this, I should inherit from RawData
14# and just add one single function.
15data_file_name = '/home/dominik/20120223_205.fits.gz'
16calib_file_name = '/home/dominik/20120223_202.drs.fits.gz'
17outfile = None
18
19run = RawData( data_file_name, calib_file_name, return_dict=True)
20despike = DRSSpikes()
21
22single_pattern = np.array( (-1,2,-1) )
23double_pattern = np.array( (-1,1,1,-1) )
24
25bins = None
26
27histplot = Plotter('hist')
28cplot = Plotter('corr')
29for event in run:
30 print event['event_id']
31 data = event['acal_data'][:,12:-12]
32
33 for pixel,sig in enumerate(data):
34 corr = signal.correlate( sig, single_pattern, 'same')
35 #cplot.name = corr+'_'+str(event['event_id']+'_'+str(pixel)
36 cplot(corr)
37 hist = np.histogram( corr, bins=1000, range=(0,2000) )
38 if bins == None:
39 bins = hist[0]
40 else:
41 bins += hist[0]
42
43 histplot(bins)
Note: See TracBrowser for help on using the repository browser.