source: fact/tools/pyscripts/sandbox/dneise/fact_compress/basic.py@ 14206

Last change on this file since 14206 was 14206, checked in by neise, 12 years ago
initial
  • Property svn:executable set to *
File size: 943 bytes
Line 
1#!/usr/bin/python -tti
2#
3#
4
5from pyfact import RawData
6import sys
7from ROOT import TFile, TCanvas, TH2F, TTree, TStyle, TObject
8import numpy as np
9
10data_filename = '/media/DomsStick/20120223_205.fits.gz'
11calib_filename = '/media/DomsStick/20120223_206.drs.fits.gz'
12
13run = RawData(data_filename, calib_filename, use_CalFactFits = False, do_calibration = False)
14offset = run.blm / (2000./4096.)
15offset = offset.astype(int)
16roi = run.nroi
17npix = run.npix
18
19rootfile = TFile('test.root', "RECREATE")
20h = TH2F('h', 'diffs', npix, -0.5, npix-0.5, 2401, -1200.5, 1200.5)
21
22for event in run:
23 index = event['event_id'].value
24 print index, '/', run.nevents
25 data = event['data']
26
27 cal_data = data.copy()
28
29 for pixel in range(npix):
30 sc = event['start_cells'][pixel]
31 cal_data[pixel,:] -= offset[pixel,sc:sc+roi]
32 for d in np.diff(cal_data[pixel,:]):
33 h.Fill(pixel, d)
34
35h.Write()
36rootfile.Close()
Note: See TracBrowser for help on using the repository browser.