Ejemplo n.º 1
0
    def PopulateResultData(self):

        SysConfiguration = ConfigParser.ConfigParser()
        SysConfiguration.read(['Configuration/SystemConfiguration.cfg'])
        ParallelProcessing = False
        LimitProcesses = None
        try:
            if int(SysConfiguration.get('SystemConfiguration', 'ParallelProcessing').strip())>0:
                ParallelProcessing = True
        except:
            print "no 'ParallelProcessing' option found, running sequentially..."
            pass

        try:
            if int(SysConfiguration.get('SystemConfiguration', 'LimitProcesses').strip())>0:
                LimitProcesses = int(SysConfiguration.get('SystemConfiguration', 'LimitProcesses').strip())
        except:
            pass

        nRocs = self.ParentObject.Attributes['NumberOfChips']
        directory = self.ParentObject.Attributes['SCurvePaths']['HRSCurves_{Rate}'.format(Rate=self.Attributes['Rate'])]
        refit = self.TestResultEnvironmentObject.Configuration['Fitting']['refit']

        print 'SCurve fitting...'
        HistoDict = BetterConfigParser()
        HistoDict.add_section('SCurveFitting')
        HistoDict.set('SCurveFitting','nTrigs', str(10))
        HistoDict.set('SCurveFitting','dir', '')
        HistoDict.set('SCurveFitting','ignoreValidityCheck', '1')
        HistoDict.set('SCurveFitting','inputFileName', self.ParentObject.ParentObject.HistoDict.get('HighRate', 'SCurveDataFileName'))

        ePerVcal =  self.TestResultEnvironmentObject.GradingParameters['StandardVcal2ElectronConversionFactor']
        fitter = SCurve_Fitting(refit,HistoDict = HistoDict,ePerVcal=ePerVcal, ParallelProcessing=ParallelProcessing, LimitProcesses=LimitProcesses)
        fitter.FitAllSCurve(directory, nRocs)
Ejemplo n.º 2
0
    def PopulateResultData(self):

        SysConfiguration = ConfigParser.ConfigParser()
        SysConfiguration.read(['Configuration/SystemConfiguration.cfg'])
        ParallelProcessing = False
        LimitProcesses = None
        try:
            if int(SysConfiguration.get('SystemConfiguration', 'ParallelProcessing').strip())>0:
                ParallelProcessing = True
        except:
            print "no 'ParallelProcessing' option found, running sequentially..."
            pass

        try:
            if int(SysConfiguration.get('SystemConfiguration', 'LimitProcesses').strip())>0:
                LimitProcesses = int(SysConfiguration.get('SystemConfiguration', 'LimitProcesses').strip())
        except:
            pass

        nRocs = self.ParentObject.Attributes['NumberOfChips']
        directory = self.ParentObject.Attributes['SCurvePaths']['HRSCurves_{Rate}'.format(Rate=self.Attributes['Rate'])]
        refit = self.TestResultEnvironmentObject.Configuration['Fitting']['refit']

        print 'SCurve fitting...'
        HistoDict = BetterConfigParser()
        HistoDict.add_section('SCurveFitting')
        HistoDict.set('SCurveFitting','nTrigs', str(10))
        HistoDict.set('SCurveFitting','dir', '')
        HistoDict.set('SCurveFitting','ignoreValidityCheck', '1')
        HistoDict.set('SCurveFitting','inputFileName', self.ParentObject.ParentObject.HistoDict.get('HighRate', 'SCurveDataFileName'))

        ePerVcal =  self.TestResultEnvironmentObject.GradingParameters['StandardVcal2ElectronConversionFactor']

        # compare current fit revision with saved revision
        FitRevDict = BetterConfigParser()
        fitRevFileName = directory + "/fits.rev"
        if os.path.isfile(fitRevFileName):

            try:
                FitRevDict.read(fitRevFileName)

                # if fit procedure changed -> refit
                if self.FitRevisionScurves > int(FitRevDict.get('FitRevisions', 'SCurves')):
                    print "info: fit procedure has changed, re-fitting..."
                    refit = True

                # if last fitting was not done completely (eg. STRG+C while fit...) -> refit
                if FitRevDict.get('Fit', 'Complete').strip().lower() != 'true':
                    print "info: last fit was incomplete! re-fitting..."
                    refit = True
            except:
                print "warning: could not read fit revision file!"

        else:
            FitRevDict.add_section('FitRevisions')
            FitRevDict.add_section('Fit')

        # unset complete flag in file
        FitRevDict.set('Fit','Complete', 'false')
        with open(fitRevFileName, 'wb') as fitRevFile:
            FitRevDict.write(fitRevFile)

        # do fitting
        fitter = SCurve_Fitting(refit=refit, HistoDict=HistoDict, ePerVcal=ePerVcal, ParallelProcessing=ParallelProcessing, LimitProcesses=LimitProcesses)
        fitter.FitAllSCurve(directory, nRocs)

        # update saved revision
        FitRevDict.set('FitRevisions','SCurves', str(self.FitRevisionScurves))

        # set complete flag in file
        FitRevDict.set('Fit','Complete', 'true')
        with open(fitRevFileName, 'wb') as fitRevFile:
            FitRevDict.write(fitRevFile)
Ejemplo n.º 3
0
    def PopulateResultData(self):

        SysConfiguration = ConfigParser.ConfigParser()
        SysConfiguration.read(['Configuration/SystemConfiguration.cfg'])

        ParallelProcessing = False
        LimitProcesses = None
        try:
            if int(SysConfiguration.get('SystemConfiguration', 'ParallelProcessing').strip())>0:
                ParallelProcessing = True
        except:
            print "no 'ParallelProcessing' option found, running sequentially..."
            pass

        try:
            if int(SysConfiguration.get('SystemConfiguration', 'LimitProcesses').strip())>0:
                LimitProcesses = int(SysConfiguration.get('SystemConfiguration', 'LimitProcesses').strip())
        except:
            pass

        print 'do fitting...'
        nRocs = self.Attributes['NumberOfChips']
        directory = self.RawTestSessionDataPath
        refit = self.TestResultEnvironmentObject.Configuration['Fitting']['refit']

        refitScurves = refit
        refitPHlin = refit
        refitPHtan = refit

        # compare current fit revision with saved revision
        FitRevDict = BetterConfigParser()
        fitRevFileName = directory + "/fits.rev"
        if os.path.isfile(fitRevFileName):

            try:
                FitRevDict.read(fitRevFileName)

                # if fit procedure changed -> refit
                if self.FitRevisionScurves > int(FitRevDict.get('FitRevisions', 'SCurves')):
                    print "info: fit procedure has changed, re-fitting scurves..."
                    refitScurves = True
                if self.FitRevisionPHlin > int(FitRevDict.get('FitRevisions', 'PHlin')):
                    print "info: fit procedure has changed, re-fitting ph lin..."
                    refitPHlin = True
                if self.FitRevisionPHtan > int(FitRevDict.get('FitRevisions', 'PHtan')):
                    print "info: fit procedure has changed, re-fitting ph tan..."
                    refitPHtan = True

                # if last fitting was not done completely (eg. STRG+C while fit...) -> refit
                if FitRevDict.get('Fit', 'Complete').strip().lower() != 'true':
                    print "info: last fit was incomplete! re-fitting all..."
                    refitScurves = True
                    refitPHlin = True
                    refitPHtan = True
            except:
                print "warning: could not read fit revision file!"

        else:
            FitRevDict.add_section('FitRevisions')
            FitRevDict.add_section('Fit')

        # unset complete flag in file
        FitRevDict.set('Fit','Complete', 'false')
        with open(fitRevFileName, 'wb') as fitRevFile:
            FitRevDict.write(fitRevFile)

        print 'SCurve fitting...'
        ePerVcal =  self.TestResultEnvironmentObject.GradingParameters['StandardVcal2ElectronConversionFactor']
        fitter = SCurve_Fitting(refit=refitScurves, HistoDict=self.ParentObject.HistoDict,ePerVcal=ePerVcal, ParallelProcessing=ParallelProcessing, LimitProcesses=LimitProcesses)
        fitter.FitAllSCurve(directory,nRocs)
        print 'linear PH fitting...'
        fitter = PH_Fitting(fitMode=0, refit=refitPHlin, HistoDict=self.ParentObject.HistoDict, ParallelProcessing=ParallelProcessing, LimitProcesses=LimitProcesses)
        fitter.FitAllPHCurves(directory,nRocs)
        print 'tanh PH fitting...'
        fitter = PH_Fitting(fitMode=3, refit=refitPHtan, HistoDict=self.ParentObject.HistoDict, ParallelProcessing=ParallelProcessing, LimitProcesses=LimitProcesses)
        fitter.FitAllPHCurves(directory,nRocs)

        # update saved revisions
        FitRevDict.set('FitRevisions','SCurves', str(self.FitRevisionScurves))
        FitRevDict.set('FitRevisions','PHlin', str(self.FitRevisionPHlin))
        FitRevDict.set('FitRevisions','PHtan', str(self.FitRevisionPHtan))

        # unset complete flag in file
        FitRevDict.set('Fit','Complete', 'true')
        with open(fitRevFileName, 'wb') as fitRevFile:
            FitRevDict.write(fitRevFile)

        print 'done'
Ejemplo n.º 4
0
    def PopulateResultData(self):

        SysConfiguration = ConfigParser.ConfigParser()
        SysConfiguration.read(['Configuration/SystemConfiguration.cfg'])

        ParallelProcessing = False
        LimitProcesses = None
        try:
            if int(SysConfiguration.get('SystemConfiguration', 'ParallelProcessing').strip())>0:
                ParallelProcessing = True
        except:
            print "no 'ParallelProcessing' option found, running sequentially..."
            pass

        try:
            if int(SysConfiguration.get('SystemConfiguration', 'LimitProcesses').strip())>0:
                LimitProcesses = int(SysConfiguration.get('SystemConfiguration', 'LimitProcesses').strip())
        except:
            pass

        print 'do fitting...'
        nRocs = self.Attributes['NumberOfChips']
        directory = self.RawTestSessionDataPath
        refit = self.TestResultEnvironmentObject.Configuration['Fitting']['refit']

        refitScurves = refit
        refitPHlin = refit
        refitPHtan = refit

        # compare current fit revision with saved revision
        FitRevDict = BetterConfigParser()
        fitRevFileName = directory + "/fits.rev"
        if os.path.isfile(fitRevFileName):

            try:
                FitRevDict.read(fitRevFileName)

                # if fit procedure changed -> refit
                if self.FitRevisionScurves > int(FitRevDict.get('FitRevisions', 'SCurves')):
                    print "info: fit procedure has changed, re-fitting scurves..."
                    refitScurves = True
                if self.FitRevisionPHlin > int(FitRevDict.get('FitRevisions', 'PHlin')):
                    print "info: fit procedure has changed, re-fitting ph lin..."
                    refitPHlin = True
                if self.FitRevisionPHtan > int(FitRevDict.get('FitRevisions', 'PHtan')):
                    print "info: fit procedure has changed, re-fitting ph tan..."
                    refitPHtan = True

                # if last fitting was not done completely (eg. STRG+C while fit...) -> refit
                if FitRevDict.get('Fit', 'Complete').strip().lower() != 'true':
                    print "info: last fit was incomplete! re-fitting all..."
                    refitScurves = True
                    refitPHlin = True
                    refitPHtan = True
            except:
                print "warning: could not read fit revision file! => needs re-fitting"
                refitScurves = True
                refitPHlin = True
                refitPHtan = True

        else:
            FitRevDict.add_section('FitRevisions')
            FitRevDict.add_section('Fit')
            print "info: this folder has never been analyzed with a recent version of MoReWeb => needs re-fitting"
            refitScurves = True
            refitPHlin = True
            refitPHtan = True

        # unset complete flag in file
        FitRevDict.set('Fit','Complete', 'false')
        with open(fitRevFileName, 'wb') as fitRevFile:
            FitRevDict.write(fitRevFile)

        print 'SCurve fitting...'
        ePerVcal =  self.TestResultEnvironmentObject.GradingParameters['StandardVcal2ElectronConversionFactor']
        fitter = SCurve_Fitting(refit=refitScurves, HistoDict=self.ParentObject.HistoDict,ePerVcal=ePerVcal, ParallelProcessing=ParallelProcessing, LimitProcesses=LimitProcesses)
        fitter.FitAllSCurve(directory,nRocs)
        print 'linear PH fitting...'
        fitter = PH_Fitting(fitMode=0, refit=refitPHlin, HistoDict=self.ParentObject.HistoDict, ParallelProcessing=ParallelProcessing, LimitProcesses=LimitProcesses)
        fitter.FitAllPHCurves(directory,nRocs)
        print 'tanh PH fitting...'
        fitter = PH_Fitting(fitMode=3, refit=refitPHtan, HistoDict=self.ParentObject.HistoDict, ParallelProcessing=ParallelProcessing, LimitProcesses=LimitProcesses)
        fitter.FitAllPHCurves(directory,nRocs)

        # update saved revisions
        FitRevDict.set('FitRevisions','SCurves', str(self.FitRevisionScurves))
        FitRevDict.set('FitRevisions','PHlin', str(self.FitRevisionPHlin))
        FitRevDict.set('FitRevisions','PHtan', str(self.FitRevisionPHtan))

        # unset complete flag in file
        FitRevDict.set('Fit','Complete', 'true')
        with open(fitRevFileName, 'wb') as fitRevFile:
            FitRevDict.write(fitRevFile)

        print 'done'
Ejemplo n.º 5
0
    def PopulateResultData(self):

        SysConfiguration = ConfigParser.ConfigParser()
        SysConfiguration.read(['Configuration/SystemConfiguration.cfg'])
        ParallelProcessing = False
        LimitProcesses = None
        try:
            if int(
                    SysConfiguration.get('SystemConfiguration',
                                         'ParallelProcessing').strip()) > 0:
                ParallelProcessing = True
        except:
            print "no 'ParallelProcessing' option found, running sequentially..."
            pass

        try:
            if int(
                    SysConfiguration.get('SystemConfiguration',
                                         'LimitProcesses').strip()) > 0:
                LimitProcesses = int(
                    SysConfiguration.get('SystemConfiguration',
                                         'LimitProcesses').strip())
        except:
            pass

        nRocs = self.ParentObject.Attributes['NumberOfChips']
        directory = self.ParentObject.Attributes['SCurvePaths'][
            'HRSCurves_{Rate}'.format(Rate=self.Attributes['Rate'])]
        refit = self.TestResultEnvironmentObject.Configuration['Fitting'][
            'refit']

        print 'SCurve fitting...'
        HistoDict = BetterConfigParser()
        HistoDict.add_section('SCurveFitting')
        HistoDict.set('SCurveFitting', 'nTrigs', str(10))
        HistoDict.set('SCurveFitting', 'dir', '')
        HistoDict.set('SCurveFitting', 'ignoreValidityCheck', '1')
        HistoDict.set(
            'SCurveFitting', 'inputFileName',
            self.ParentObject.ParentObject.HistoDict.get(
                'HighRate', 'SCurveDataFileName'))

        ePerVcal = self.TestResultEnvironmentObject.GradingParameters[
            'StandardVcal2ElectronConversionFactor']

        # compare current fit revision with saved revision
        FitRevDict = BetterConfigParser()
        fitRevFileName = directory + "/fits.rev"
        if os.path.isfile(fitRevFileName):

            try:
                FitRevDict.read(fitRevFileName)

                # if fit procedure changed -> refit
                if self.FitRevisionScurves > int(
                        FitRevDict.get('FitRevisions', 'SCurves')):
                    print "info: fit procedure has changed, re-fitting..."
                    refit = True

                # if last fitting was not done completely (eg. STRG+C while fit...) -> refit
                if FitRevDict.get('Fit', 'Complete').strip().lower() != 'true':
                    print "info: last fit was incomplete! re-fitting..."
                    refit = True
            except:
                print "warning: could not read fit revision file! => needs re-fitting"
                refit = True

        else:
            FitRevDict.add_section('FitRevisions')
            FitRevDict.add_section('Fit')
            print "info: never analyzed with recent version of MoReWeb => needs re-fitting"
            refit = True

        # unset complete flag in file
        FitRevDict.set('Fit', 'Complete', 'false')
        with open(fitRevFileName, 'wb') as fitRevFile:
            FitRevDict.write(fitRevFile)

        # do fitting
        fitter = SCurve_Fitting(refit=refit,
                                HistoDict=HistoDict,
                                ePerVcal=ePerVcal,
                                ParallelProcessing=ParallelProcessing,
                                LimitProcesses=LimitProcesses)
        fitter.FitAllSCurve(directory, nRocs)

        # update saved revision
        FitRevDict.set('FitRevisions', 'SCurves', str(self.FitRevisionScurves))

        # set complete flag in file
        FitRevDict.set('Fit', 'Complete', 'true')
        with open(fitRevFileName, 'wb') as fitRevFile:
            FitRevDict.write(fitRevFile)