def __init__(self, parent=None): QMainWindow.__init__(self, parent) self.create_main_frame() self.params = calibrate(plot=False) self.temp = 5 os.makedirs("temp", exist_ok=True) self.restore()
def set_options(self): dlg = optionsDialog(self) if (dlg.exec_() == QDialog.Accepted): self.temp = dlg.getValues() self.params = calibrate(0, self.temp) if self.sample: self.sample.set_temp(self.temp)
def load(cls, path): files = np.load(path) pos = files['pos'] _points = files['points'].tolist() sp = files['spectra'] try: params = calibrate(0,files['temp']) except: params = calibrate(0) for spec in sp: spec[1] = params _spectra = list(map(lambda x: SpectrumAnalyser.from_array(x),sp)) try: fname=files['name'] except: fname=os.path.splitext(os.path.basename(path))[0] return cls(name = fname,bl=pos[0],br=pos[1],tl=pos[4],tr=pos[3],c=pos[2],points = _points, spectra = _spectra)
def __init__(self,spectrum,params=None,peaks=None,noise=None,toeV=True): self.shift_is_held = False self.spectrum = spectrum self.params = calibrate(plot=False) if params is None else params self.peaks = [] if peaks is None else peaks self.Boron = [0,0] self.Ratio = [0,0] self.noise = [0,0] if noise is None else noise self.coords = [] self.cidclick = None self.analyse(toeV)
def __init__(self,name="",bl=[0,0],br=[4,0],tl=[4,4],tr=[4,4],c=None,points=[],spectra=[],temp=5): self.shift_is_held = False self.bottom_left=bl self.bottom_right= br self.top_left = tl self.top_right = tr self.cut= c self.transParam = self.get_transform() self.temp = temp self.params = calibrate(0,temp=self.temp) self.points = points self.spectra = spectra self.name = name
def showcalib(self): temp = self.getValues() calibrate(plot=True, temp=temp)
def set_temp(self,temp): self.temp =temp self.params = calibrate(0,temp) for sp in self.spectra: sp.params = self.params sp.update()
""" Created on Wed May 30 15:44:04 2018 @author: sylvain.finot """ from Calibrate import calibrate from SpectrumAnalyser import SpectrumAnalyser from sample import sample import time import matplotlib.pyplot as plt from report import report import numpy as np start_time = time.clock() params = calibrate(plot=False) #spectrumA = SpectrumAnalyser.from_csv('06-04-2018\\NDT38\\5\\Spot7_10kV_mag2984k_5K_t100s_slit0-1mm',params) #spectrumA.plot() #spectrumA = SpectrumAnalyser.from_csv('NDT33\\1\\Spot7_10kV_mag2984k_5K_t100s_slit0-1mm',params) #spectrumA.plot() #spectrum = SpectrumAnalyser.from_csv("""..\\14062018\\06-04-2018\\NDT38\\6\\Spot7_10kV_mag2984k_5K_t100s_slit0-1mm""") #spectrum.plot() #NDT38 = sample(name="NDT38", # bl=[5.15141,-0.93662], # br=[9.16087, -1.30639], # tl=[4.80728,-4.92088], # c=[8.84821, -4.53165], # tr=[8.46323, -5.27961]) #NDT38 = sample(name="NDT38", # bl=[5.15141,-0.93662],