コード例 #1
0
ファイル: ComboCode.py プロジェクト: FungKu01/ComboCode
 def runStatistics(self):
     
     '''
     Run the statistics module.
     
     '''
     
     self.pacsstats = None
     self.spirestats = None
     self.resostats = None
     if self.statistics and self.pacs <> None:
         print '************************************************'
         print '**** Doing PACS statistics for %s.'%self.star_name
         print '************************************************'
         self.pacsstats = UnresoStats.UnresoStats(star_name=self.star_name,\
                                         path_code=self.path_gastronoom)
         self.pacsstats.setInstrument(instrument_name='PACS',\
                                      instrument_instance=self.pacs,\
                                      stat_method=self.stat_method)
         self.pacsstats.setModels(star_grid=self.star_grid)
         self.pacsstats.setRatios(chi2_type=self.stat_chi2)
         self.pacsstats.plotRatioWav(inputfilename=self.inputfilename)
     if self.statistics and self.spire <> None:
         print '************************************************'
         print '**** Doing SPIRE statistics for %s.'%self.star_name
         print '************************************************'
         self.spirestats = UnresoStats.UnresoStats(star_name=self.star_name,\
                                         path_code=self.path_gastronoom)
         self.spirestats.setInstrument(instrument_name='SPIRE',\
                                       instrument_instance=self.spire,\
                                       stat_method=self.stat_method)
         self.spirestats.setModels(star_grid=self.star_grid)
         self.spirestats.setRatios(chi2_type=self.stat_chi2)
         self.spirestats.plotRatioWav(inputfilename=self.inputfilename)
     if self.statistics:
         trans_sel = Transition.extractTransFromStars(self.star_grid,\
                                                      dtype='resolved')
         if not trans_sel:
             return
         print '************************************************'
         print '**** Doing statistics for spectrally resolved lines in %s.'\
               %self.star_name
         print '**** Use cc_session.resostats for more interactive tools.'
         print '************************************************'
         self.resostats = ResoStats.ResoStats(star_name=self.star_name,\
                                        path_code=self.path_gastronoom,\
                                        lll_p=self.stat_lll_p)
         self.resostats.setInstrument(trans_sel)
         self.resostats.setModels(star_grid=self.star_grid)
         self.resostats.setIntensities()
         if self.stat_print:
             self.resostats.printStats()
コード例 #2
0
    def setRatios(self, chi2_type='normal'):
        ''' 
        Find the peak to peak ratios of data versus model.
        
        The result are saved in the self.peak_ratios dictionary, see 
        __init__.__doc__()
        
        @keyword chi2_type: The type of chi-squared calculated for integrated 
                            fluxes. 'normal' for the usual kind, 'log' for chi2
                            of the log of the integrated fluxes and noise. 
                            
                            (default: normal)
        @type chi2_type: string
        
        '''

        inst = self.instrument
        print '***********************************'
        print '** Calculating integrated/peak intensity ratios for %s.'\
              %inst.instrument

        #-- Make a sample selection of Transition()s.
        sample_trans = Transition.extractTransFromStars(self.star_grid,\
                                                        dtype=inst.instrument)

        #-- Set the tolerance: a factor that is multiplied with half the
        #   wavelength resolution of data when looking for the peak value
        #   around a central wavelength in the data. As a default, this is
        #   equal to the PACS_OVERSAMPLING. No point in changing this.
        self.tolerance = inst.oversampling

        for ifn,(fn,dwav) in enumerate(zip(inst.data_filenames,\
                                           inst.data_wave_list)):
            #-- Create a list of sample transitions
            self.sample_trans[fn] = [trans
                                     for trans in sample_trans
                                     if trans.wavelength*10**4 >= dwav[0]\
                                        and trans.wavelength*10**4 <= dwav[-2]]
            #-- Get the central wavelength of the lines, corrected for
            #   Doppler shift due to vlsr of the central source. In micron.
            self.central_mwav[fn] = [
                t.wavelength * 10**4 * 1. / (1 - inst.vlsr / t.c)
                for t in self.sample_trans[fn]
            ]

            self.__setPeakRatios(ifn, fn)
            if inst.linefit <> None:
                self.__setIntRatios(ifn, fn, chi2_type=chi2_type)

        self.calcChiSquared()
        print '***********************************'
コード例 #3
0
ファイル: UnresoStats.py プロジェクト: FungKu01/ComboCode
 def setRatios(self,chi2_type='normal'):
     
     ''' 
     Find the peak to peak ratios of data versus model.
     
     The result are saved in the self.peak_ratios dictionary, see 
     __init__.__doc__()
     
     @keyword chi2_type: The type of chi-squared calculated for integrated 
                         fluxes. 'normal' for the usual kind, 'log' for chi2
                         of the log of the integrated fluxes and noise. 
                         
                         (default: normal)
     @type chi2_type: string
     
     '''
     
     inst = self.instrument
     print '***********************************'
     print '** Calculating integrated/peak intensity ratios for %s.'\
           %inst.instrument
     
     #-- Make a sample selection of Transition()s.
     sample_trans = Transition.extractTransFromStars(self.star_grid,\
                                                     dtype=inst.instrument)
     
     #-- Set the tolerance: a factor that is multiplied with half the 
     #   wavelength resolution of data when looking for the peak value 
     #   around a central wavelength in the data. As a default, this is 
     #   equal to the PACS_OVERSAMPLING. No point in changing this.
     self.tolerance = inst.oversampling
     
     for ifn,(fn,dwav) in enumerate(zip(inst.data_filenames,\
                                        inst.data_wave_list)):
         #-- Create a list of sample transitions
         self.sample_trans[fn] = [trans
                                  for trans in sample_trans
                                  if trans.wavelength*10**4 >= dwav[0]\
                                     and trans.wavelength*10**4 <= dwav[-2]]
         #-- Get the central wavelength of the lines, corrected for 
         #   Doppler shift due to vlsr of the central source. In micron.
         self.central_mwav[fn] = [t.wavelength*10**4*1./(1-inst.vlsr/t.c)
                                  for t in self.sample_trans[fn]]
         
         self.__setPeakRatios(ifn,fn)
         if inst.linefit <> None:
             self.__setIntRatios(ifn,fn,chi2_type=chi2_type)
     
     self.calcChiSquared()
     print '***********************************'
コード例 #4
0
    def setLineStrengths(self):
        ''' 
        Find the peak to peak ratios of data versus model.
        
        The result are saved in the self.peak_ratios dictionary, see 
        __init__.__doc__()
        
        '''

        inst = self.instrument
        print '***********************************'
        print '** Gathering model and observed line strengths for %s.'\
              %inst.instrument

        #-- Make a sample selection of Transition()s.
        sample_trans = Transition.extractTransFromStars(self.star_grid,\
                                                        dtype=inst.instrument)

        #-- Set the tolerance: a factor that is multiplied with half the
        #   wavelength resolution of data when looking for the peak value
        #   around a central wavelength in the data. As a default, this is
        #   equal to the PACS_OVERSAMPLING. No point in changing this.
        self.tolerance = inst.oversampling

        for ifn,(fn,dwav) in enumerate(zip(inst.data_filenames,\
                                           inst.data_wave_list)):
            #-- Create a list of sample transitions
            self.sample_trans[fn] = [trans
                                     for trans in sample_trans
                                     if trans.wavelength*10**4 >= dwav[0]\
                                        and trans.wavelength*10**4 <= dwav[-2]]
            #-- Get the central wavelength of the lines, corrected for
            #   Doppler shift due to vlsr of the central source. In micron.
            self.central_mwav[fn] = [
                t.wavelength * 10**4 * 1. / (1 - inst.vlsr / t.c)
                for t in self.sample_trans[fn]
            ]

            self.__setPeakRatios(ifn, fn)
            if not inst.linefit is None:
                self.__setIntRatios(ifn, fn)

        print '***********************************'
コード例 #5
0
ファイル: UnresoStats.py プロジェクト: IvS-KULeuven/ComboCode
 def setLineStrengths(self):
     
     ''' 
     Find the peak to peak ratios of data versus model.
     
     The result are saved in the self.peak_ratios dictionary, see 
     __init__.__doc__()
     
     '''
     
     inst = self.instrument
     print '***********************************'
     print '** Gathering model and observed line strengths for %s.'\
           %inst.instrument
     
     #-- Make a sample selection of Transition()s.
     sample_trans = Transition.extractTransFromStars(self.star_grid,\
                                                     dtype=inst.instrument)
     
     #-- Set the tolerance: a factor that is multiplied with half the 
     #   wavelength resolution of data when looking for the peak value 
     #   around a central wavelength in the data. As a default, this is 
     #   equal to the PACS_OVERSAMPLING. No point in changing this.
     self.tolerance = inst.oversampling
     
     for ifn,(fn,dwav) in enumerate(zip(inst.data_filenames,\
                                        inst.data_wave_list)):
         #-- Create a list of sample transitions
         self.sample_trans[fn] = [trans
                                  for trans in sample_trans
                                  if trans.wavelength*10**4 >= dwav[0]\
                                     and trans.wavelength*10**4 <= dwav[-2]]
         #-- Get the central wavelength of the lines, corrected for 
         #   Doppler shift due to vlsr of the central source. In micron.
         self.central_mwav[fn] = [t.wavelength*10**4*1./(1-inst.vlsr/t.c)
                                  for t in self.sample_trans[fn]]
         
         self.__setPeakRatios(ifn,fn)
         if not inst.linefit is None:
             self.__setIntRatios(ifn,fn)
     
     print '***********************************'