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

Last change on this file since 15446 was 14207, checked in by neise, 13 years ago
works
  • Property svn:executable set to *
File size: 953 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 = '/fact/raw/2012/06/06/20120606_116.fits.gz'
11calib_filename = '/fact/raw/2012/06/06/20120606_112.drs.fits.gz'
12
13
14
15run = RawData(data_filename, calib_filename, use_CalFactFits = False, do_calibration = False)
16offset = run.blm / (2000./4096.)
17offset = offset.astype(int)
18roi = run.nroi
19npix = run.npix
20
21rootfile = TFile('test.root', "RECREATE")
22h = TH2F('h', 'diffs', npix, -0.5, npix-0.5, 2401, -1200.5, 1200.5)
23
24for event in run:
25 index = event['event_id'].value
26 print index, '/', run.nevents
27 data = event['data']
28
29 cal_data = data.copy()
30
31 for pixel in range(npix):
32 sc = event['start_cells'][pixel]
33 cal_data[pixel,:] -= offset[pixel,sc:sc+roi]
34 for d in np.diff(cal_data[pixel,:]):
35 h.Fill(pixel, d)
36
37h.Write()
38rootfile.Close()
Note: See TracBrowser for help on using the repository browser.