def get_group(self, inds): """Get a FOOOFGroup object with the specified sub-selection of model fits. Parameters ---------- inds : array_like of int or array_like of bool Indices to extract from the object. If a boolean mask, True indicates indices to select. Returns ------- fg : FOOOFGroup The requested selection of results data loaded into a new FOOOFGroup object. """ # Check and convert indices encoding to list of int inds = check_inds(inds) # Initialize a new FOOOFGroup object, with same settings as current FOOOFGroup fg = FOOOFGroup(*self.get_settings(), verbose=self.verbose) # Add data for specified power spectra, if available # The power spectra are inverted back to linear, as they are re-logged when added to FOOOF if self.has_data: fg.add_data(self.freqs, np.power(10, self.power_spectra[inds, :])) # If no power spectrum data available, copy over data information & regenerate freqs else: fg.add_meta_data(self.get_meta_data()) # Add results for specified power spectra fg.group_results = [self.group_results[ind] for ind in inds] return fg
def drop(self, inds): """Drop one or more model fit results from the object. Parameters ---------- inds : int or array_like of int or array_like of bool Indices to drop model fit results for. If a boolean mask, True indicates indices to drop. Notes ----- This method sets the model fits as null, and preserves the shape of the model fits. """ for ind in check_inds(inds): fm = self.get_fooof(ind) fm._reset_data_results(clear_results=True) self.group_results[ind] = fm.get_results()