lowq  = range(12)
lowq.extend(range(36,60))
medq  = range(12,24)
highq = range(24,36)
highq.extend(range(60,72))

##############################################################################
# H2o example
##############################################################################

repertorio = "/scisoft/users/mirone/WORKS/Christoph/for_alessandro"
# repertorio = "/home/alex/WORKS/Christoph/for_alessandro"
# repertorio = "/home/christoph/data/ihr_feb15/"

h2o = xrs_read.read_id20(repertorio + '/hydra',monitorcolumn='kapraman')

image4roi =  h2o.SumDirect( [623] )

app=Qt.QApplication([])
w4r = roiSelectionWidget.mainwindow()
w4r.showImage( image4roi , xrs_rois.get_geo_informations(image4roi.shape) )
w4r.show()
app.exec_()

masks = w4r.getMasks()
print masks

print image4roi.shape

from xrstools import xrs_read, theory, extraction
from pylab import *

t = xrs_read.read_id20('/home/christoph/data/ch3898/raman',energycolumn='energy',monitorcolumn='kap4dio')
t.loadelastic(259)
t.getlinrois(259,numrois=3)

# t.loadloop([210,221,232,243],3)
t.loadscan([260],'edge1')
t.loadscan([263],'edge2')
t.loadscan([264],'edge3')
t.loadscan([265],'edge4')
t.loadscan([266],'edge5')
t.loadscan([267],'edge6')
t.loadscan([268],'edge7')
t.loadlong([258])

t.getrawdata()
t.getspectrum()
t.geteloss()

t.gettths(rhl=45.0,rhr=45.0,rhb=143.38,rvd=-45.0,rvu=87.66,rvb=121.88)

# plot the experimental data
for n in range(len(t.signals[0,:])):
	plot(t.eloss,t.signals[:,n],'-')

show()

#for n in range(len(t.signals[0,:])):
#	plot(t.energy,t.signals[:,n],[t.cenom[n],t.cenom[n]],[0,1]))
from xrstools import xrs_read, theory, extraction
from pylab import *
import numpy as np
ion()
h2so4 = xrs_read.read_id20('/home/christoph/data/ch3914/orig/raman',energycolumn='energy',monitorcolumn='kap4dio')
#h2so4 = xrs_read.read_id20('xrstools/things/h2so4_test_files/raman',energycolumn='energy',monitorcolumn='kap4dio')
h2so4.loadelastic([908,914])
h2so4.getzoomrois(908,numrois=12)

h2so4.loadloopdirect([909,915],5)

h2so4.getrawdata()
h2so4.getspectrum()
h2so4.geteloss()

plot(h2so4.eloss,np.sum(h2so4.signals,axis=1))