def load(self, file_name='FOOOF_results', file_path=None, regenerate=True): """Load in FOOOF file. Reads in a FOOOF formatted JSON file. Parameters ---------- file_name : str or FileObject, optional File from which to load data. file_path : str, optional Path to directory from which to load. If not provided, loads from current directory. regenerate : bool, optional, default: True Whether to regenerate the model fit from the loaded data, if data is available. """ # Reset data in object, so old data can't interfere self._reset_data_results() # Load JSON file, add to self and check loaded data data = load_json(file_name, file_path) self._add_from_dict(data) self._check_loaded_settings(data) self._check_loaded_results(data) # Regenerate model components, based on what's available if regenerate: if self.freq_res: self._regenerate_freqs() if np.all(self.freqs) and np.all(self.aperiodic_params_): self._regenerate_model()
def load(self, file_name='fooof_data', file_path=''): """Load in FOOOF file. Reads in a JSON file. Parameters ---------- file_name : str or FileObject, optional File from which to load data. file_path : str, optional Path to directory from which to load. If not provided, loads from current directory. """ # Reset data in object, so old data can't interfere self._reset_data_results() # Load JSON file, add to self and check loaded data data = load_json(file_name, file_path) self._add_from_dict(data) self._check_loaded_settings(data) self._check_loaded_results(data)