Esempio n. 1
0
    def _broaden_lines_bands(self, df):
        ''' Divide over chuncks not to process to many lines in memory at the
        same time (note that this is not where the parallelisation is done: all
        lines are processed on the same core)
        Band specific version: returns a list of all broadened vibrational
        bands :

        Implementation
        -----------
        note: there is no more splitting over line chuncks of given different
        (NotImplemented). This may result in large arrays and MemoryErrors for
        extreme spectral ranges. If that ever happens we may have to insert
        a chunck splitting loop in the band groupby loop

        See _calc_lineshape for more information
        '''

        # Reactivate one-time warnings for new run
        reset_warnings(self.warnings)
        # --------------------------

        gb = df.groupby('band')

        abscoeff_bands = {}
        pb = ProgressBar(len(gb), active=self.verbose)
        for i, (band, dg) in enumerate(gb):
            line_profile = self._calc_lineshape(dg)
            (wavenumber,
             absorption) = self._apply_lineshape(dg.S, line_profile,
                                                 dg.shiftwav)
            abscoeff_bands[band] = absorption
            pb.update(i)
        pb.done()

        return wavenumber, abscoeff_bands
Esempio n. 2
0
    def _broaden_lines_noneq_bands(self, df):
        ''' Divide over chuncks not to process to many lines in memory at the
        same time (note that this is not where the parallelisation is done: all
        lines are processed on the same core)
        Band specific version: returns a list of all broadened vibrational
        bands

        Implementation
        -----------
        note: there is no more splitting over line chuncks of given different
        (NotImplemented). This may result in large arrays and MemoryErrors for
        extreme spectral ranges. If that ever happens we may have to insert
        a chunck splitting loop in the band groupby loop

        See _calc_lineshape for more information
        '''

        # Reactivate one-time warnings for new run
        reset_warnings(self.warnings)
        # --------------------------

        abscoeff_bands = {}
        emisscoeff_bands = {}

        gb = df.groupby('band')
        chunksize = self.misc.chunksize  # used for DLM keyword in 0.9.20 until proper implementation is done

        pb = ProgressBar(len(gb), active=self.verbose)
        for i, (band, dg) in enumerate(gb):
            if chunksize == 'DLM':
                line_profile_DLM, wL, wG, wL_dat, wG_dat = self._calc_lineshape_DLM(
                    dg)
                (wavenumber, absorption) = self._apply_lineshape_DLM(
                    dg.S.values, line_profile_DLM, dg.shiftwav.values, wL, wG,
                    wL_dat, wG_dat)
                (_, emission) = self._apply_lineshape_DLM(
                    dg.Ei.values, line_profile_DLM, dg.shiftwav.values, wL, wG,
                    wL_dat, wG_dat)

            else:
                line_profile = self._calc_lineshape(dg)
                (wavenumber,
                 absorption) = self._apply_lineshape(dg.S.values, line_profile,
                                                     dg.shiftwav.values)
                (_, emission) = self._apply_lineshape(dg.Ei.values,
                                                      line_profile,
                                                      dg.shiftwav.values)
            abscoeff_bands[band] = absorption  #
            emisscoeff_bands[band] = emission
            pb.update(i)
        pb.done()

        return wavenumber, abscoeff_bands, emisscoeff_bands