-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroot_spec_python.py
More file actions
executable file
·43 lines (28 loc) · 888 Bytes
/
root_spec_python.py
File metadata and controls
executable file
·43 lines (28 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 19 10:41:36 2016
@author: claessen
"""
import numpy as np
import ROOT as r
import matplotlib.pyplot as plt
f = r.TFile("~/Dokumente/katydid_files/spectrogram/powerspectrogram.root")
print f.ls()
h = f.Get("PowerSpectrogram_0")
print h.ls()
imax = h.GetNbinsX()
jmax = h.GetNbinsY()
a = np.zeros([int(imax), int(jmax)])
for i in range(int(imax)):
for j in range(int(jmax)):
a[i,j] = h.GetBinContent(i,j)
np.savetxt("spectrogram_data/out_1.txt", a)
X = h.GetXaxis()
Y = h.GetYaxis()
xax = np.linspace(X.GetXmin(), X.GetXmax(), int(imax))
yax = np.linspace(Y.GetXmin(), Y.GetXmax(), int(jmax))
np.savetxt("spectrogram_data/xaxis_1.txt", xax)
np.savetxt("spectrogram_data/yaxis_1.txt", yax)
#tmeta = open("outmeta.txt", "w")
#tmeta.write("\n" + h.GetTitle()+"\n"+X.GetTitle()+"\n"+Y.GetTitle())
#tmeta.close()