Commit b8712718 authored by myron's avatar myron
Browse files

fixing non regression tests

parent 27217b28
...@@ -46,8 +46,8 @@ class MaskImageWidget(sole_MaskImageWidget.MaskImageWidget): ...@@ -46,8 +46,8 @@ class MaskImageWidget(sole_MaskImageWidget.MaskImageWidget):
self.plotImage(update = False) self.plotImage(update = False)
self._emitMaskChangedSignal() self._emitMaskChangedSignal()
return return
# super(MaskImageWidget, self)._graphSignal(ddict, ownsignal) super(MaskImageWidget, self)._graphSignal(ddict, ownsignal)
sole_MaskImageWidget.MaskImageWidget._graphSignal(self, ddict, ownsignal) # sole_MaskImageWidget.MaskImageWidget._graphSignal(self, ddict, ownsignal)
def dragEnterEvent(self,event): def dragEnterEvent(self,event):
......
...@@ -380,7 +380,7 @@ class edge_extraction: ...@@ -380,7 +380,7 @@ class edge_extraction:
self.sqwav = self.avsignals*res[0] - yres self.sqwav = self.avsignals*res[0] - yres
self.sqwaverr = self.averrors*res[0] self.sqwaverr = self.averrors*res[0]
def removeCorePearsonAv(self,element,edge,range1,range2,weights=[2,1],HFcore_shift=0.0,guess=None,scaling=None,return_background=False): def removeCorePearsonAv(self,element,edge,range1,range2,weights=[2,1],HFcore_shift=0.0,guess=None,scaling=None,return_background=False, show_plots = True):
""" """
**removeCorePearsonAv** **removeCorePearsonAv**
""" """
...@@ -461,11 +461,13 @@ class edge_extraction: ...@@ -461,11 +461,13 @@ class edge_extraction:
print( 'The fit parameters are: ', res) print( 'The fit parameters are: ', res)
yres = pearson7_zeroback(self.eloss,res[0:4]) + np.polyval(res[4:6],self.eloss) yres = pearson7_zeroback(self.eloss,res[0:4]) + np.polyval(res[4:6],self.eloss)
plt.plot(self.eloss,the_signals*scaling,self.eloss,yres+HF_core,self.eloss,the_signals*scaling-yres,self.eloss,HF_core)
plt.legend(('scaled data','pearson + linear + core','data - (pearson + linear)','core'))
plt.draw()
pyplot.show() if show_plots:
plt.plot(self.eloss,the_signals*scaling,self.eloss,yres+HF_core,self.eloss,the_signals*scaling-yres,self.eloss,HF_core)
plt.legend(('scaled data','pearson + linear + core','data - (pearson + linear)','core'))
plt.draw()
pyplot.show()
self.sqwav = the_signals*scaling - yres self.sqwav = the_signals*scaling - yres
self.sqwaverr = self.averrors*scaling*HF_core_norm/exp_norm self.sqwaverr = self.averrors*scaling*HF_core_norm/exp_norm
......
...@@ -114,13 +114,14 @@ if AUTOMATIC_TEST : ...@@ -114,13 +114,14 @@ if AUTOMATIC_TEST :
QTest.qWait(delay) QTest.qWait(delay)
QTest.mouseMove( myw.graph , pos= qt.QPoint( pos1[0] ,pos1[1]), delay=-1) QTest.mouseMove( myw.graph , pos= qt.QPoint( pos1[0] ,pos1[1]), delay=-1)
QTest.qWait(delay) QTest.qWait(delay)
myw.graph.onMousePress( pos1[0], pos1[1], "left" ) print(myw.graph)
# QTest.mousePress( myw.graph , qt.Qt.LeftButton, pos= qt.QPoint( pos1[0] ,pos1[1]), delay=10) # myw.graph.onMousePress( pos1[0], pos1[1], "left" )
QTest.mousePress( myw.graph , qt.Qt.LeftButton, pos= qt.QPoint( pos1[0] ,pos1[1]), delay=10)
QTest.qWait(delay) QTest.qWait(delay)
QTest.mouseMove( myw.graph , pos= qt.QPoint( pos2[0] ,pos2[1]), delay=10) QTest.mouseMove( myw.graph , pos= qt.QPoint( pos2[0] ,pos2[1]), delay=10)
QTest.qWait(delay) QTest.qWait(delay)
# QTest.mouseRelease( myw.graph , qt.Qt.LeftButton, pos= qt.QPoint( pos2[0] ,pos2[1]), delay=10) QTest.mouseRelease( myw.graph , qt.Qt.LeftButton, pos= qt.QPoint( pos2[0] ,pos2[1]), delay=10)
myw.graph.onMouseRelease( pos2[0], pos2[1], "left" ) # myw.graph.onMouseRelease( pos2[0], pos2[1], "left" )
QTest.qWait(delay) QTest.qWait(delay)
QTest.mouseClick( w4r.globalSpotDectionWidget.relabeliseButton ,qt.Qt.LeftButton, pos= qt.QPoint(3,3)) QTest.mouseClick( w4r.globalSpotDectionWidget.relabeliseButton ,qt.Qt.LeftButton, pos= qt.QPoint(3,3))
QTest.qWait(delay) QTest.qWait(delay)
...@@ -159,10 +160,13 @@ lw.get_spectrum_new(method='sum', include_elastic=True) ...@@ -159,10 +160,13 @@ lw.get_spectrum_new(method='sum', include_elastic=True)
lw.get_tths(rvd=28.0, rvu=28.0, rvb=65.0, rhr=30.0, rhl=30.0, rhb=143.0, order=[0, 1, 2, 3, 4, 5]) lw.get_tths(rvd=28.0, rvu=28.0, rvb=65.0, rhr=30.0, rhl=30.0, rhb=143.0, order=[0, 1, 2, 3, 4, 5])
lw_ex = xrs_extraction.edge_extraction(lw,['H2O'],[1.0],{'O':['K']}) lw_ex = xrs_extraction.edge_extraction(lw,['H2O'],[1.0],{'O':['K']})
print("QUI 1 ")
# O edge low-q # O edge low-q
lw_ex.analyzerAverage(lowq, errorweighing=False) lw_ex.analyzerAverage(lowq, errorweighing=False)
lw_ex.removeCorePearsonAv('O','K',[250.0,534.0],[570.0,600.0],weights=[2,1],HFcore_shift=-5.0, guess= [-1.07743447e+03, 8.42895443e+02, 4.99035465e+01, 3193e+01, -3.80090286e-07, 2.73774370e-03, 5.11920401e+03],scaling=1.2) lw_ex.removeCorePearsonAv('O','K',[250.0,534.0],[570.0,600.0],weights=[2,1],HFcore_shift=-5.0, guess= [-1.07743447e+03, 8.42895443e+02, 4.99035465e+01, 3193e+01, -3.80090286e-07, 2.73774370e-03, 5.11920401e+03],scaling=1.2, show_plots = True)
lw_ex.save_average_Sqw(os.path.join(save_path,'h2o_sum_lq.dat'), emin=00.0, emax=610.0, normrange=[520.,600.]) lw_ex.save_average_Sqw(os.path.join(save_path,'h2o_sum_lq.dat'), emin=00.0, emax=610.0, normrange=[520.,600.])
print("QUI OK")
def check_results(fn_a, fn_b): def check_results(fn_a, fn_b):
...@@ -199,7 +203,7 @@ check_results( os.path.join(save_path,'h2o_sum_lq.dat') , "h2o_sum_lq_ref.dat" ...@@ -199,7 +203,7 @@ check_results( os.path.join(save_path,'h2o_sum_lq.dat') , "h2o_sum_lq_ref.dat"
# O edge med-q # O edge med-q
lw_ex.analyzerAverage(medq,errorweighing=False) lw_ex.analyzerAverage(medq,errorweighing=False)
lw_ex.removeCorePearsonAv('O','K',[300.0,534.0],[570.0,600.0], weights=[2,1], HFcore_shift=-5.0, guess=[-1.39664220e+03 , 1.03655696e+03 , 7.67728511e+02, 7.30355600e+02, 7.93995221e-04, -4.76580011e-01, -1.37652621e+03], scaling=1.2) lw_ex.removeCorePearsonAv('O','K',[300.0,534.0],[570.0,600.0], weights=[2,1], HFcore_shift=-5.0, guess=[-1.39664220e+03 , 1.03655696e+03 , 7.67728511e+02, 7.30355600e+02, 7.93995221e-04, -4.76580011e-01, -1.37652621e+03], scaling=1.2, show_plots = False)
lw_ex.save_average_Sqw(save_path+'/h2o_sum_mq.dat', emin=0.0, emax=610.0, normrange=[520.0,600.0]) lw_ex.save_average_Sqw(save_path+'/h2o_sum_mq.dat', emin=0.0, emax=610.0, normrange=[520.0,600.0])
...@@ -208,7 +212,7 @@ check_results( os.path.join(save_path,'h2o_sum_mq.dat') , "h2o_sum_mq_ref.dat" ...@@ -208,7 +212,7 @@ check_results( os.path.join(save_path,'h2o_sum_mq.dat') , "h2o_sum_mq_ref.dat"
# O edge high-q # O edge high-q
lw_ex.analyzerAverage(highq,errorweighing=False) lw_ex.analyzerAverage(highq,errorweighing=False)
lw_ex.removeCorePearsonAv('O','K',[52.0,534.0],[570.0,600.0],weights=[2,1], guess=[ 3.40779687e+02, 2.57030454e+02, 1.27747244e+03, 4.55875194e-01, -8.59501907e-06, 1.39969288e-02, 2.60071705e+00], HFcore_shift=-5.0,scaling=3.55) lw_ex.removeCorePearsonAv('O','K',[52.0,534.0],[570.0,600.0],weights=[2,1], guess=[ 3.40779687e+02, 2.57030454e+02, 1.27747244e+03, 4.55875194e-01, -8.59501907e-06, 1.39969288e-02, 2.60071705e+00], HFcore_shift=-5.0,scaling=3.55, show_plots = False)
lw_ex.save_average_Sqw(save_path+'/h2o_sum_hq.dat', emin=0.0, emax=600.0, normrange=[520.0,600.0]) lw_ex.save_average_Sqw(save_path+'/h2o_sum_hq.dat', emin=0.0, emax=600.0, normrange=[520.0,600.0])
...@@ -243,7 +247,7 @@ lw_ex = xrs_extraction.edge_extraction(lw,['H2O'],[1.0],{'O':['K']}) ...@@ -243,7 +247,7 @@ lw_ex = xrs_extraction.edge_extraction(lw,['H2O'],[1.0],{'O':['K']})
# O edge low-q # O edge low-q
lw_ex.analyzerAverage(lowq, errorweighing=False) lw_ex.analyzerAverage(lowq, errorweighing=False)
lw_ex.removeCorePearsonAv('O','K',[250.0,534.0],[570.0,600.0],weights=[2,1],HFcore_shift=-5.0, guess= [-1.07743447e+03, 8.42895443e+02, 4.99035465e+01, 3193e+01, -3.80090286e-07, 2.73774370e-03, 5.11920401e+03],scaling=1.2) lw_ex.removeCorePearsonAv('O','K',[250.0,534.0],[570.0,600.0],weights=[2,1],HFcore_shift=-5.0, guess= [-1.07743447e+03, 8.42895443e+02, 4.99035465e+01, 3193e+01, -3.80090286e-07, 2.73774370e-03, 5.11920401e+03],scaling=1.2, show_plots = False)
lw_ex.save_average_Sqw(save_path+'/h2o_pixel_lq.dat', emin=00.0, emax=610.0, normrange=[520.,600.]) lw_ex.save_average_Sqw(save_path+'/h2o_pixel_lq.dat', emin=00.0, emax=610.0, normrange=[520.,600.])
check_results( os.path.join(save_path,'h2o_pixel_lq.dat') , "h2o_pixel_lq_ref.dat" ) check_results( os.path.join(save_path,'h2o_pixel_lq.dat') , "h2o_pixel_lq_ref.dat" )
...@@ -252,7 +256,7 @@ check_results( os.path.join(save_path,'h2o_pixel_lq.dat') , "h2o_pixel_lq_ref.da ...@@ -252,7 +256,7 @@ check_results( os.path.join(save_path,'h2o_pixel_lq.dat') , "h2o_pixel_lq_ref.da
# O edge med-q # O edge med-q
lw_ex.analyzerAverage(medq,errorweighing=False) lw_ex.analyzerAverage(medq,errorweighing=False)
lw_ex.removeCorePearsonAv('O','K',[300.0,534.0],[570.0,600.0], weights=[2,1], HFcore_shift=-5.0, guess=[-1.39664220e+03 , 1.03655696e+03 , 7.67728511e+02, 7.30355600e+02, 7.93995221e-04, -4.76580011e-01, -1.37652621e+03], scaling=1.2) lw_ex.removeCorePearsonAv('O','K',[300.0,534.0],[570.0,600.0], weights=[2,1], HFcore_shift=-5.0, guess=[-1.39664220e+03 , 1.03655696e+03 , 7.67728511e+02, 7.30355600e+02, 7.93995221e-04, -4.76580011e-01, -1.37652621e+03], scaling=1.2, show_plots = False)
lw_ex.save_average_Sqw(save_path+'/h2o_pixel_mq.dat', emin=0.0, emax=610.0, normrange=[520.0,600.0]) lw_ex.save_average_Sqw(save_path+'/h2o_pixel_mq.dat', emin=0.0, emax=610.0, normrange=[520.0,600.0])
check_results( os.path.join(save_path,'h2o_pixel_mq.dat') , "h2o_pixel_mq_ref.dat" ) check_results( os.path.join(save_path,'h2o_pixel_mq.dat') , "h2o_pixel_mq_ref.dat" )
...@@ -260,7 +264,7 @@ check_results( os.path.join(save_path,'h2o_pixel_mq.dat') , "h2o_pixel_mq_ref.da ...@@ -260,7 +264,7 @@ check_results( os.path.join(save_path,'h2o_pixel_mq.dat') , "h2o_pixel_mq_ref.da
# O edge high-q # O edge high-q
lw_ex.analyzerAverage(highq,errorweighing=False) lw_ex.analyzerAverage(highq,errorweighing=False)
lw_ex.removeCorePearsonAv('O','K',[52.0,534.0],[570.0,600.0],weights=[2,1], guess=[ 3.40779687e+02, 2.57030454e+02, 1.27747244e+03, 4.55875194e-01, -8.59501907e-06, 1.39969288e-02, 2.60071705e+00], HFcore_shift=-5.0,scaling=3.55) lw_ex.removeCorePearsonAv('O','K',[52.0,534.0],[570.0,600.0],weights=[2,1], guess=[ 3.40779687e+02, 2.57030454e+02, 1.27747244e+03, 4.55875194e-01, -8.59501907e-06, 1.39969288e-02, 2.60071705e+00], HFcore_shift=-5.0,scaling=3.55, show_plots = False)
lw_ex.save_average_Sqw(save_path+'/h2o_pixel_hq.dat', emin=0.0, emax=600.0, normrange=[520.0,600.0]) lw_ex.save_average_Sqw(save_path+'/h2o_pixel_hq.dat', emin=0.0, emax=600.0, normrange=[520.0,600.0])
check_results( os.path.join(save_path,'h2o_pixel_hq.dat') , "h2o_pixel_hq_ref.dat" ) check_results( os.path.join(save_path,'h2o_pixel_hq.dat') , "h2o_pixel_hq_ref.dat" )
...@@ -375,11 +375,11 @@ myw.lineEdit_outputPrefix.setText("non_reg_output_gui_raman") ...@@ -375,11 +375,11 @@ myw.lineEdit_outputPrefix.setText("non_reg_output_gui_raman")
myw.pushButton_saveAnalysis.clicked.emit(True) myw.pushButton_saveAnalysis.clicked.emit(True)
qWait( ms=40) qWait( ms=40)
qWait( ms=400000) qWait( ms=40)
check_results("non_reg_output_gui_raman_lowq.txt","non_reg_output_gui_raman_reference_lowq.txt") check_results("non_reg_output_gui_raman_lowq.txt","non_reg_output_gui_raman_reference_lowq.txt")
check_results("non_reg_output_gui_raman_mediumq.txt","non_reg_output_gui_raman_reference_mediumq.txt") check_results("non_reg_output_gui_raman_mediumq.txt","non_reg_output_gui_raman_reference_mediumq.txt")
check_results("non_reg_output_gui_raman_highq.txt","non_reg_output_gui_raman_reference_highq.txt") check_results("non_reg_output_gui_raman_highq.txt","non_reg_output_gui_raman_reference_highq.txt")
print(" OK " ) print(" OK " )
qWait( ms=400000) qWait( ms=40)
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