Commit 0b9caedb authored by Alessandro Mirone's avatar Alessandro Mirone
Browse files

ritorno indietro a prima di aggiunger from future ...

parent f8e909f7
......@@ -3,6 +3,7 @@ from __future__ import division
from __future__ import print_function
from PyQt4 import Qt, QtGui, QtCore
import sys
from six.moves import range
if sys.platform =="win32":
rootdir = "c:\\users\\aless\\src\\xrstoolssuperresolution\\xrstools\\WIZARD\\methods"
else:
......@@ -75,7 +76,7 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
print( " STACK AGGIUNGO ", sourceIndex.data().toString(), " con rowcount ", self.model.rowCount(sourceIndex ) )
todo = range( self.model.rowCount(sourceIndex ) )
todo = list(range( self.model.rowCount(sourceIndex )))
stack = [ ( iter(todo) , sourceIndex ) ]
print( stack)
......@@ -83,7 +84,7 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
while len(stack):
try:
it, si = stack[-1]
ir = it.next()
ir = next(it)
for ic in range(4):
print( ic)
sourceIndex = self.model.index( ir,ic, si)
......@@ -104,7 +105,7 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
My_loop.exec_()
print( " STACK AGGIUNGO ", sourceIndex.data().toString(), " con rowcount ", self.model.rowCount(sourceIndex ) )
todo = range( self.model.rowCount(sourceIndex ) )
todo = list(range( self.model.rowCount(sourceIndex )))
stack.append( ( iter(todo) , sourceIndex ) )
except StopIteration:
stack = stack[:-1]
......
......@@ -6,6 +6,7 @@ from __future__ import print_function
import os
import sys
from PyQt4 import Qt, QtCore, QtGui
from six.moves import range
list = []
# QList<QStandardItem *> list;
......
......@@ -65,7 +65,7 @@ class functor_sigterm_handler:
def swissknife_runner( yamltext, where, ret_dico ):
mydata = yaml.load(yamltext)
mname, mydata = mydata.items()[0]
mname, mydata = list(mydata.items())[0]
print( mydata)
if "MPI_N_PROCS" in mydata:
MPI_N_PROCS = mydata["MPI_N_PROCS"]
......@@ -167,7 +167,7 @@ class Functor_Compose_A_Scan_Address:
elif isinstance(vb,list):
return va+"/scans/Scan%03d/"%vb[0]
else:
raise Exception, " unprepared for this instance : "+str(vb) +" from "+ str(b.value)
raise Exception(" unprepared for this instance : "+str(vb) +" from "+ str(b.value))
class Functor_Compose_An_Absolute_Address:
def __init__(self, take_first=0, is_retrieved_scan=0):
......@@ -244,7 +244,7 @@ def dic2yaml_extraction_scan_with_recentering(dicodic):
def dic2yaml_response_fit(dicodic):
print( dicodic.keys())
print( list(dicodic.keys()))
s = "superR_fit_responses:\n"
s = s+ " foil_scan_address : %s \n" % dicodic["response_scan_address"].render()
s = s+ " nref : %s \n" % dicodic["nref"].render ()
......
......@@ -48,7 +48,7 @@ class functor_sigterm_handler:
def swissknife_runner( yamltext, where ):
mydata = yaml.load(yamltext)
mname, mydata = mydata.items()[0]
mname, mydata = list(mydata.items())[0]
print( mydata)
if "MPI_N_PROCS" in mydata:
MPI_N_PROCS = mydata["MPI_N_PROCS"]
......@@ -119,7 +119,7 @@ def dic2yaml_resynt_fit(dicodic):
def dic2yaml_response_fit(dicodic):
print( dicodic.keys())
print( list(dicodic.keys()))
s = "superR_fit_responses:\n"
s = s+ " foil_scan_address : %s \n" % dicodic["response_scan_address"].render()
s = s+ " nref : %s \n" % dicodic["nref"].render ()
......
......@@ -59,7 +59,7 @@ class functor_sigterm_handler:
def swissknife_runner( yamltext, where, ret_dico ):
mydata = yaml.load(yamltext)
mname, mydata = mydata.items()[0]
mname, mydata = list(mydata.items())[0]
print( mydata)
if "MPI_N_PROCS" in mydata:
MPI_N_PROCS = mydata["MPI_N_PROCS"]
......@@ -154,7 +154,7 @@ class Functor_Compose_A_Scan_Address:
elif isinstance(vb,list):
return va+"/scans/Scan%03d/"%vb[0]
else:
raise Exception, " unprepared for this instance : "+str(vb) +" from "+ str(b.value)
raise Exception(" unprepared for this instance : "+str(vb) +" from "+ str(b.value))
class Functor_Compose_An_Absolute_Address:
def __init__(self, take_first=0, is_retrieved_scan=0):
......@@ -187,7 +187,7 @@ class Functor_Compose_An_Absolute_Address:
def dic2yaml_response_fit(dicodic):
print( dicodic.keys())
print( list(dicodic.keys()))
s = "superR_fit_responses:\n"
s = s+ " foil_scan_address : %s \n" % dicodic["response_scan_address"].render()
s = s+ " nref : %s \n" % dicodic["nref"].render ()
......
......@@ -58,7 +58,7 @@ class functor_sigterm_handler:
def swissknife_runner( yamltext, where, ret_dico ):
mydata = yaml.load(yamltext)
mname, mydata = mydata.items()[0]
mname, mydata = list(mydata.items())[0]
print( mydata)
if "MPI_N_PROCS" in mydata:
MPI_N_PROCS = mydata["MPI_N_PROCS"]
......@@ -177,7 +177,7 @@ class Functor_Compose_A_Scan_Address:
elif isinstance(vb,list):
return va+"/scans/Scan%03d/"%vb[0]
else:
raise Exception, " unprepared for this instance : "+str(vb) +" from "+ str(b.value)
raise Exception(" unprepared for this instance : "+str(vb) +" from "+ str(b.value))
class Functor_Compose_An_Absolute_Address:
def __init__(self, take_first=0, is_retrieved_scan=0):
......@@ -246,7 +246,7 @@ def dic2yaml_extraction_scan(dicodic):
def dic2yaml_response_fit(dicodic):
print( dicodic.keys())
print( list(dicodic.keys()))
s = "superR_fit_responses:\n"
s = s+ " foil_scan_address : %s \n" % dicodic["response_scan_address"].render()
s = s+ " nref : %s \n" % dicodic["nref"].render ()
......
......@@ -59,7 +59,7 @@ class functor_sigterm_handler:
def swissknife_runner( yamltext, where, ret_dico ):
mydata = yaml.load(yamltext)
mname, mydata = mydata.items()[0]
mname, mydata = list(mydata.items())[0]
print( mydata)
if "MPI_N_PROCS" in mydata:
MPI_N_PROCS = mydata["MPI_N_PROCS"]
......@@ -151,7 +151,7 @@ class Functor_Compose_A_Scan_Address:
elif isinstance(vb,list):
return va+"/scans/Scan%03d/"%vb[0]
else:
raise Exception, " unprepared for this instance : "+str(vb) +" from "+ str(b.value)
raise Exception(" unprepared for this instance : "+str(vb) +" from "+ str(b.value))
class Functor_Compose_An_Absolute_Address:
def __init__(self, take_first=0, is_retrieved_scan=0):
......@@ -184,7 +184,7 @@ class Functor_Compose_An_Absolute_Address:
def dic2yaml_response_fit(dicodic):
print( dicodic.keys())
print( list(dicodic.keys()))
s = "superR_fit_responses:\n"
s = s+ " foil_scan_address : %s \n" % dicodic["response_scan_address"].render()
s = s+ " nref : %s \n" % dicodic["nref"].render ()
......
......@@ -59,7 +59,7 @@ class functor_sigterm_handler:
def swissknife_runner( yamltext, where, ret_dico ):
mydata = yaml.load(yamltext)
mname, mydata = mydata.items()[0]
mname, mydata = list(mydata.items())[0]
print( mydata)
if "MPI_N_PROCS" in mydata:
MPI_N_PROCS = mydata["MPI_N_PROCS"]
......@@ -157,7 +157,7 @@ class Functor_Compose_A_Scan_Address:
elif isinstance(vb,list):
return va+"/scans/Scan%03d/"%vb[0]
else:
raise Exception, " unprepared for this instance : "+str(vb) +" from "+ str(b.value)
raise Exception(" unprepared for this instance : "+str(vb) +" from "+ str(b.value))
class Functor_Compose_An_Absolute_Address:
def __init__(self, take_first=0, is_retrieved_scan=0):
......@@ -190,7 +190,7 @@ class Functor_Compose_An_Absolute_Address:
def dic2yaml_response_fit(dicodic):
print( dicodic.keys())
print( list(dicodic.keys()))
s = "superR_fit_responses:\n"
s = s+ " foil_scan_address : %s \n" % dicodic["response_scan_address"].render()
s = s+ " nref : %s \n" % dicodic["nref"].render ()
......
......@@ -13,6 +13,8 @@ import collections
import inspect
import os
import importlib
from six.moves import map
from six.moves import zip
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
......@@ -411,7 +413,7 @@ def getMethod(options):
datadir = os.path.join( os.path.dirname( XRStools.__file__ ) , "data" )
chitables = glob.glob(datadir+"/chitable_*.dat")
chitables=map(os.path.basename,chitables)
chitables=list(map(os.path.basename,chitables))
####
analyzer["crystal_reflection"] = Parameter_Choices( "analyzer material (e.g. 'Si', 'Ge') and reflection.\n"
" Possibilities are given by the chitables in data directory : " +datadir,
......
......@@ -5,12 +5,13 @@ import numpy as np
from scipy import interpolate
from xrstools import xrs_read, theory, extraction
from pylab import *
from six.moves import range
# try loading old Si data (this is more complicated since this is not id16 data)
counters=[1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19]
data = np.loadtxt('xrstools/things/Ba24Si100_rawdata_APS11.dat')
tth = np.array(range(9,171,9))
tth = np.array(list(range(9,171,9)))
# initiate data
eloss = data[:,0]
......@@ -35,7 +36,7 @@ hf = theory.HFspectrum(basi,['Ba24Si100'],[1.0],correctasym=[[0.0,0.0]])
extr = extraction.extraction(basi,hf)
# apply energy dependent corrections to the experimental data (absorption, self-absorption, relativistic scattering cross section)
extr.energycorrect(range(17),10,2.3,0.1)
extr.energycorrect(list(range(17)),10,2.3,0.1)
# for a quick estimate of the core profile and if the edge is not too far into the compton profile:
......@@ -43,7 +44,7 @@ extr.energycorrect(range(17),10,2.3,0.1)
#extr.remquickval(range(13,17),[400,1000],[90,120],20)
# for extraction of the valence profile:
extr.removeelastic(range(13,17),[0,50],[800,850],overwrite=True,stoploop=False)
extr.removeelastic(list(range(13,17)),[0,50],[800,850],overwrite=True,stoploop=False)
......
......@@ -6,6 +6,7 @@ from __future__ import print_function
import numpy as np
from pylab import *
from six.moves import range
ion()
from xrstools import superresolution
......
......@@ -3,6 +3,7 @@ from __future__ import division
from __future__ import print_function
from xrstools import xrs_read
from pylab import *
from six.moves import range
ion()
# C K-edge 180 C, 3 bars
......
......@@ -6,6 +6,7 @@ from scipy import interpolate
from xrstools import xrs_read, theory, extraction
from xrstools.helpers import *
from pylab import *
from six.moves import range
ion()
# try loading old Si data
......@@ -72,7 +73,7 @@ plot(extr.eloss,extr.signals[:,0],extr.eloss,extr.J[:,0])
extr.extractval_test(8,linrange1=[340,470],linrange2=[1500,2500])
extr.getallvalprof(8,smoothgval=50.0,stoploop=False)
extr.remvalenceprof_test(range(9),eoffset=20.0)
extr.remvalenceprof_test(list(range(9)),eoffset=20.0)
ion()
clf()
......
......@@ -3,6 +3,7 @@ from __future__ import division
from __future__ import print_function
from xrstools import xrs_read, theory, extraction
from pylab import *
from six.moves import range
t = xrs_read.read_id20('/home/christoph/data/ch3898/raman',energycolumn='energy',monitorcolumn='kap4dio')
t.loadelastic(259)
......
......@@ -3,6 +3,7 @@ from __future__ import division
from __future__ import print_function
from xrstools import xrs_read, theory, extraction
import pylab
from six.moves import range
# create an instance of the read_id16 class from the xrs_read module
licl = xrs_read.read_id16('xrstools/things/licl_test_files/raman')
......@@ -54,9 +55,9 @@ hf = theory.HFspectrum(licl,['H2O'],[1.0],correctasym=[[0.0,0.0]])
extr = extraction.extraction(licl,hf)
# remove a constant from the raw data and scale the data to the Hartree-Fock edge jump
extr.removeconstpcore(range(9),[527.0,534.5],[545.0,588.0],weights=[1,1],stoploop=False)
extr.removeconstpcore(list(range(9)),[527.0,534.5],[545.0,588.0],weights=[1,1],stoploop=False)
# average over all 9 spectra
extr.averageqs(range(9))
extr.averageqs(list(range(9)))
# plot the result
pylab.plot(extr.eloss,extr.sqwav)
......
......@@ -5,6 +5,7 @@ import numpy as np
from scipy import interpolate
from xrstools import xrs_read, theory, extraction
from pylab import *
from six.moves import range
# try loading old Si data (this is more complicated since this is not id16 data)
counters=[3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19]
......@@ -52,7 +53,7 @@ hf = theory.HFspectrum(si,['Si'],[1.0],correctasym=[[1.5]],correctasym_pertth=[0
extr = extraction.extraction(si,hf)
# apply energy dependent corrections to the experimental data (absorption, self-absorption, relativistic scattering cross section)
extr.energycorrect(range(15),10,2.3,0.2)
extr.energycorrect(list(range(15)),10,2.3,0.2)
ion()
plot(extr.eloss,extr.signals[:,14],extr.eloss,extr.J[:,14])
......
......@@ -17,6 +17,7 @@ from pylab import *
from scipy import signal
from scipy.ndimage import measurements
import matplotlib.pyplot as plt
from six.moves import range
__metaclass__ = type # new style classes
......
......@@ -12,6 +12,8 @@ import pylab
import math
from scipy import interpolate, signal, integrate, constants, optimize, ndimage
import matplotlib.pyplot as plt
from six.moves import range
from six.moves import input
class extraction:
"""
......@@ -85,17 +87,17 @@ class extraction:
analyzerNames = ['VD','VU','VB','HR','HL','HB']
if type(whichq) == str:
if whichq.upper() == 'VD':
columns = range(0,12)
columns = list(range(0,12))
elif whichq.upper() == 'VU':
columns = range(12,24)
columns = list(range(12,24))
elif whichq.upper() == 'VB':
columns = range(24,36)
columns = list(range(24,36))
elif whichq.upper() == 'HL':
columns = range(36,48)
columns = list(range(36,48))
elif whichq.upper() == 'HR':
columns = range(48,60)
columns = list(range(48,60))
elif whichq.upper() == 'HB':
columns = range(60,72)
columns = list(range(60,72))
elif whichq not in analyzerNames:
print( 'Unknown keyword ' + '\'' + whichq + '\'' + '! Try one of these: \'VD\', \'VU\', \'VB\', \'HR\', \'HL\', \'HB\'.')
return
......@@ -225,7 +227,7 @@ class extraction:
plt.draw()
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
if overwrite:
self.signals[:,col] = self.signals[:,col] - yres
......@@ -261,7 +263,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = self.signals[:,col] - yres
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
# close the figure to show the next one
plt.ioff()
......@@ -324,7 +326,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = self.signals[:,col] - yres
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -394,7 +396,7 @@ class extraction:
plt.xlim(region1[0]-ewindow,region1[-1]+ewindow)
plt.autoscale(enable=True, axis='y')
plt.draw()
raw_input()
input()
def removepoly(self,whichq,emin,emax,polyorder=2.0,ewindow=100.0):
......@@ -426,7 +428,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = self.signals[:,col] - yres
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -626,7 +628,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = res[1]*self.signals[:,col] - yres
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -676,7 +678,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = res[2]*self.signals[:,col] - yres
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -809,7 +811,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = self.signals[:,col] - yres
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -853,7 +855,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = self.signals[:,col] - yres
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -1032,7 +1034,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = self.signals[:,col] - yres
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -1272,7 +1274,7 @@ class extraction:
self.background[:,col] = yres
self.sqw[:,col] = self.signals[:,col] - yres
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -1339,7 +1341,7 @@ class extraction:
plt.plot(self.eloss,self.signals[:,col]*res[7],self.eloss,yres,self.eloss,self.signals[:,col]*res[7]-yres ,self.eloss,self.C[:,col])
plt.legend(('scaled data','pearson','data - pearson','core'))
plt.draw()
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
self.background[:,col] = yres
......@@ -1389,7 +1391,7 @@ class extraction:
self.sqw[:,col] = subdata/res # scale the extracted data back to fit the HF core profile
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close() # close the figure to show the next one
plt.ioff()
......@@ -1446,7 +1448,7 @@ class extraction:
plt.xlabel('pz [a.u.]')
plt.ylabel('S(q,w) [1/eV]')
plt.draw()
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close()
self.valence[:,col] = extractedval
......@@ -1541,7 +1543,7 @@ class extraction:
plt.xlabel('pz [a.u.]')
plt.ylabel('S(q,w) [1/eV]')
plt.draw()
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close()
self.valence[:,col] = extractedval
......@@ -1620,7 +1622,7 @@ class extraction:
plt.plot(self.eloss,newvalence[:,n],self.eloss,newasym[:,n])
plt.draw()
if stoploop:
_ = raw_input("Press [enter] to continue.") # wait for input from the user
_ = input("Press [enter] to continue.") # wait for input from the user
plt.close()
if smoothgval > 0.0:
......@@ -1739,7 +1741,7 @@ class extraction:
def save_state_hdf5(self, filename, groupname, comment ="" ):
import h5py
h5 = h5py.File(filename,"a")
if( groupname in h5.keys() ):
if( groupname in list(h5.keys()) ):
del h5[groupname]
h5.require_group(groupname)
......
......@@ -5,6 +5,8 @@ import numpy as np
import scipy
import math
import sys
from six.moves import range
from six.moves import zip
def Fista(solution , problem, niter, niterLip):
......
......@@ -23,6 +23,7 @@ from matplotlib.colors import LogNorm
import matplotlib.patches
import math
import h5py
from six.moves import range
use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment