예제 #1
0
    def read_table(self, file_path):
        """
        Read a pre-computed table from <file_path>. 

        Parameters
        ----------
        file_path: str
            Path to file.
        """
        print('Reading mie table from file: {}'.format(file_path))
        self._mono_disperse._wavelen1, self._mono_disperse._wavelen2, self._mono_disperse._deltawave, \
            self._mono_disperse._pardens, self._mono_disperse._partype, self._mono_disperse._rindex, \
            self._mono_disperse._distflag, self.size_distribution._nretab, self.size_distribution._nvetab, \
            self._maxleg = self.read_table_header(file_path)

        self._mono_disperse._wavelencen = core.get_center_wavelen(
            wavelen1=self.mono_disperse._wavelen1,
            wavelen2=self.mono_disperse._wavelen2)

        self._wavelength = self._mono_disperse._wavelencen

        self.size_distribution.reff, self.size_distribution.veff, self._extinct, self._ssalb, \
            self._nleg, self.legcoef, table_type = core.read_poly_table(
                mietabfile=file_path,
                nretab=self.size_distribution.nretab,
                nvetab=self.size_distribution.nvetab,
                ndist=self.size_distribution.ndist,
                maxleg=self.maxleg)
        self._table_type = table_type.decode()
        self.init_intepolators()
예제 #2
0
    def set_wavelength_integration(self,
                                   wavelength_band,
                                   wavelength_averaging=False,
                                   wavelength_resolution=0.001):
        """
        Set the wavelength integration parameters to compute a scattering table.
        
        Parameters
        ----------
        wavelength_band: (float, float)
            (minimum, maximum) wavelength in microns. 
            This defines the spectral band over which to integrate, if both are equal monochrome quantities are computed. 
        wavelength_averaging: bool
            True - average scattering properties over the wavelength_band.
            False - scattering properties of the central wavelength. 
        wavelength_resolution: float
            The distance between two wavelength samples in the band. Used only if wavelength_averaging is True.
        """
        self._wavelen1, self._wavelen2 = wavelength_band
        assert self._wavelen1 <= self._wavelen2, 'Minimum wavelength is smaller than maximum'

        avgflag = 'C'
        if self._wavelen1 == self._wavelen2:
            deltawave = -1
        elif wavelength_averaging:
            avgflag = 'A'
            deltawave = wavelength_resolution

        self._avgflag = avgflag
        self._deltawave = deltawave

        self._wavelencen = core.get_center_wavelen(wavelen1=self._wavelen1,
                                                   wavelen2=self._wavelen2)

        if (self._partype == 'W') or (self._partype == 'I'):
            self._rindex = core.get_refract_index(partype=self._partype,
                                                  wavelen1=self._wavelen1,
                                                  wavelen2=self._wavelen2)
        elif (self._partype == 'A') and isinstance(self._rindex,
                                                   RefractiveIndexTable):
            self._rindex = self._rindex.get_monochrome_refractive_index(
                self._wavelencen)
예제 #3
0
    def read_table(self, file_path):
        """
        Read a pre-computed table from <file_path>. 
    
        Parameters
        ----------
        file_path: str
            Path to file.
        """

        print('Reading mie table from file: {}'.format(file_path))
        self._wavelen1, self._wavelen2, self._deltawave, self._pardens, \
            self._partype, self._rindex, self._nsize, self._maxleg = self.read_table_header(file_path)

        self._wavelencen = core.get_center_wavelen(wavelen1=self._wavelen1,
                                                   wavelen2=self._wavelen2)

        self._radii, self._extinct, self._scatter, self._nleg, self._legcoef, table_type = \
            core.read_mono_table(
                mietabfile=file_path,
                nrtab=self._nsize,
                maxleg=self._maxleg
            )
        self._table_type = table_type.decode()