Esempio n. 1
0
    def _check_loaded_results(self, data):
        """Check if results have been added and check data.

        Parameters
        ----------
        data : dict
            A dictionary of data that has been added to the object.
        """

        # If results loaded, check dimensions of peak parameters
        #  This fixes an issue where they end up the wrong shape if they are empty (no peaks)
        if set(get_obj_desc()['results']).issubset(set(data.keys())):
            self.peak_params_ = check_array_dim(self.peak_params_)
            self._gaussian_params = check_array_dim(self._gaussian_params)
Esempio n. 2
0
    def _check_loaded_results(self, data, regenerate=True):
        """Check if results added, check data, and regenerate model, if requested.

        Parameters
        ----------
        data : dict
            The dictionary of data that has been added to the object.
        regenerate : bool, optional
            Whether to regenerate the power_spectrum model. default : True
        """

        # If results loaded, check dimensions of osc/gauss parameters
        #  This fixes an issue where they end up the wrong shape if they are empty (no oscs)
        if set(get_obj_desc()['results']).issubset(set(data.keys())):
            self.peak_params_ = check_array_dim(self.peak_params_)
            self._gaussian_params = check_array_dim(self._gaussian_params)

        # Regenerate power_spectrum model & components
        if regenerate:
            if np.all(self.freqs) and np.all(self.background_params_):
                self._regenerate_model()