Exemplo n.º 1
0
    def synchro_on_scanning(self,sfscanning,timehistory,meashistory,sfscanrange=None):
        """
        Calculate the average of tensmon or humidity informations on each x-ray scans performed. A trick to improve rapidity of calculation have been set.
        @param sfscanning  : specfile of the scanning history
        @param timehistory,meashistory : time and values of measurements performed on tensmon of hummon.
        @param sfscanrange : list of scannumber to synchronize
        """
        scannumbers = SpecTools.get_NumberOfScans(sfscanning)
        averageshistory = []
        idx = 0
        if sfscanrange == None:
            scanrange = range(1,scannumbers+1)
        else:
            scanrange = sfscanrange

        for scan in scanrange:
            scan_starttime = SpecTools.get_ScanStartingTime(self.scanning,scan)
            idx_ini,val_ini = NumpyTools.find_nearest(scan_starttime,timehistory)
            idx = idx_ini
            scan_endtime   = SpecTools.get_ScanEndingTime(self.scanning,scan)
            idx_end,val_end = NumpyTools.find_nearest(scan_endtime,timehistory)
            idx = idx_end
            avghistory = numpy.mean(meashistory[idx_ini:idx_end])
            averageshistory.append(avghistory)
            print scan, scan_starttime, scan_endtime, idx_ini, idx_end, avghistory 
        self.scanning_scannumbers = range(1,scannumbers+1)
        self.scanning_measurements = numpy.array(averageshistory)
Exemplo n.º 2
0
 def set_scanning_specfile(self,sfpath):
     """
     Set the X-ray scanning specfile and retrieve the data
     @param sfpath : specfile path
     @type sfpath : string
     @return : 
     """
     self.scanning = SpecTools.specfile.Specfile(sfpath)
     self.numberofscans_scanning = SpecTools.get_NumberOfScans(self.scanning)
     instant_measurements = []
     for scannumber in range(0,self.numberofscans_scanning):
         instant_measurements.append(SpecTools.get_ScanStartingTime(self.scanning,scannumber+1))
     self.instant_measurements = numpy.array(instant_measurements)
Exemplo n.º 3
0
 def __init__(self,sfpath):
     """
     Set the specfile and retrieve the date and time history of the data measurement
     @param sfpath : specfile path
     @type sfpath : string
     """
     self.specfile = SpecTools.specfile.Specfile(sfpath)
     self.numberofscans = SpecTools.get_NumberOfScans(self.specfile)
     instant_measurements = []
     print 'Number of scans :',self.numberofscans
     for scannumber in range(0,self.numberofscans):
         instant_measurements.append(SpecTools.get_ScanStartingTime(self.specfile,scannumber+1))
     self.instant_measurements = numpy.array(instant_measurements)