コード例 #1
0
    def _loader(self):
        """
        Load a template from the database

        Returns
        -------
        meta: metadata of the spectra (header)
        lam: wavelengths
        flux: flux
        """
        try:
            self.wave_unit = units.validate_unit(self.wave_unit)
            self.flux_unit = units.validate_unit(self.flux_unit)
        except exceptions.SynphotError:  # Assumes angtroms and FLAM
            self.wave_unit = u.AA
            self.flux_unit = units.FLAM

    #   self.resolution = self.resolution * self.wave_unit

        if self.data_type == "fits":  # make try and except here to catch most problems
            meta, lam, flux = read_fits_spec(self.path,
                                             ext=1,
                                             wave_unit=self.wave_unit,
                                             flux_unit=self.flux_unit,
                                             wave_col=self.wave_column_name,
                                             flux_col=self.flux_column_name)
        else:
            meta, lam, flux = read_ascii_spec(self.path,
                                              wave_unit=self.wave_unit,
                                              flux_unit=self.flux_unit)

        return meta, lam, flux
コード例 #2
0
    def _loader(self):
        """
        Load a filter from the database

        Returns
        -------
        meta: metadata of the spectra (header)
        lam: wavelengths
        flux: flux
        """

        try:  # it should also try to read it from the file directly
            self.wave_unit = units.validate_unit(self.wave_unit)
        except exceptions.SynphotError:
            self.wave_unit = u.AA

        # make try and except here to catch most problems
        if self.data_type == "fits":
            meta, lam, trans = read_fits_spec(self.filename,
                                              ext=1,
                                              wave_unit=self.wave_unit)
            #      wave_col=self.wave_column_name, flux_col=self.trans_column_name)
        elif self.data_type == "ascii":
            meta, lam, trans = read_ascii_spec(self.filename,
                                               wave_unit=self.wave_unit)
            #          wave_col=self.wave_column_name, flux_col=self.trans_column_name)
            # , flux_unit=self._internal_flux_unit,
        lam = lam.to(u.AA)

        return meta, lam, trans.value
コード例 #3
0
    def _loader(self):
        """
        Load a filter from the database

        Returns
        -------
        meta: metadata of the spectra (header)
        lam: wavelengths
        flux: flux
        """

        try:  # it should also try to read it from the file directly
            self.wave_unit = units.validate_unit(self.wave_unit)
        except exceptions.SynphotError:
            self.wave_unit = u.AA

        if self.data_type == "fits":
            meta, lam, rvs = read_fits_spec(
                self.filename,
                ext=1,
                wave_unit=self.wave_unit,
                flux_unit=self.extinction_unit,
                # self._internal_flux_unit,
                wave_col=self.wave_column,
                flux_col=self.extinction_column)
        elif self.data_type == "ascii":
            meta, lam, rvs = read_ascii_spec(
                self.filename,
                wave_unit=self.wave_unit,
                flux_unit=self.extinction_unit,
                # self._internal_flux_unit,
                wave_col=self.wave_column,
                flux_col=self.extinction_column)

        return meta, lam, rvs