示例#1
0
    def get_lim_mjds(self, raw_data_dir: str) -> list:
        """
        Get minimum and maximum MJD for complete sample.

        This function is not necessary if you are working with
        SNPCC data. The values are hard coded in the class.

        Parameters
        ----------
        raw_data_dir: str
            Complete path to raw data directory.

        Returns
        -------
        limits: list
            List of extreme MJDs for entire sample: [min_MJD, max_MJD].
        """
        files_list = _get_files_list(raw_data_dir, 'DES_SN')
        # store MJDs
        min_day = []
        max_day = []

        for each_file in progressbar.progressbar(files_list):
            light_curve_data = LightCurve()
            light_curve_data.load_snpcc_lc(
                os.path.join(raw_data_dir, each_file))
            min_day.append(min(light_curve_data.photometry['mjd'].values))
            max_day.append(max(light_curve_data.photometry['mjd'].values))
            self.min_epoch = min(min_day)
            self.max_epoch = max(max_day)

        return [min(min_day), max(max_day)]
示例#2
0
    def _get_current_sample_features(self, file_name: str, raw_data_dir: str,
                                     queryable_criteria: int,
                                     days_since_observation: int,
                                     telescope_names: list,
                                     telescope_sizes: list,
                                     spec_SNR: int) -> LightCurve:
        """
        Reads a SNPCC file and updates time domain features

        Parameters
        ----------
        file_name
            SNPCC file name
        raw_data_dir: str
            Complete path to raw data directory
        queryable_criteria: int [1 or 2] (optional)
            Criteria to determine if an obj is queryable.
            1 -> r-band cut on last measured photometric point.
            2 -> last obs was further than a given limit,
                 use Bazin estimate of flux today. Otherwise, use
                 the last observed point.
            Default is 1.
        days_since_observation: int (optional)
            Day since last observation to consider for spectroscopic
            follow-up without the need to extrapolate light curve.
            Only used if "queryable_criteria == 2". Default is 2.
        telescope_names: list (optional)
            Names of the telescopes under consideration for spectroscopy.
            Only used if "get_cost == True".
            Default is ["4m", "8m"].
        telescope_sizes: list (optional)
            Primary mirrors diameters of potential spectroscopic telescopes.
            Only used if "get_cost == True".
            Default is [4, 8].
        spec_SNR: float (optional)
            SNR required for spectroscopic follow-up. Default is 10.
        """
        light_curve_data = LightCurve()
        light_curve_data.load_snpcc_lc(os.path.join(raw_data_dir, file_name))
        light_curve_data = self._process_each_light_curve(
            light_curve_data, queryable_criteria, days_since_observation,
            telescope_names, telescope_sizes, spec_SNR, self._kwargs)
        return light_curve_data