Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNT] - Name update for new version #205

Merged
merged 67 commits into from
Sep 23, 2023
Merged
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
cd24360
name updates: sweep comments
TomDonoghue Apr 15, 2021
912e4a7
name update: fooof_obj -> model_obj
TomDonoghue Apr 15, 2021
c147a97
name update: fooofed_spectrum_ -> modeled_spectrum
TomDonoghue Apr 15, 2021
9fedefc
name update: data objs
TomDonoghue Apr 15, 2021
e1d365c
name update: object util funcs
TomDonoghue Apr 15, 2021
6c21a54
name update: custom error names
TomDonoghue Apr 15, 2021
fbc904e
bumb version for breaking change
TomDonoghue Apr 16, 2021
4d04f3f
name update: get_fooof -> get_model
TomDonoghue Apr 16, 2021
55dd13d
name updates: sweep on notes, IO, and utils
TomDonoghue Apr 16, 2021
4f0d7bf
name updates: move away from fm & fg in module
TomDonoghue Apr 16, 2021
bcd4ea9
name update: FOOOFGroup -> PSDGroup
TomDonoghue Apr 16, 2021
a3e4e13
name update: FOOOF object -> PSD
TomDonoghue Apr 16, 2021
df907da
name update: rename module
TomDonoghue Apr 16, 2021
bf4883d
Naming: update README descriptions
TomDonoghue Apr 16, 2021
051d306
lints & minor docstring updates
TomDonoghue Apr 16, 2021
3dcd52d
name update: update tutorials
TomDonoghue Apr 16, 2021
9317163
name update: update examples
TomDonoghue Apr 17, 2021
173085d
name update: motivations
TomDonoghue Apr 17, 2021
5099f03
name update: update doc site files
TomDonoghue Apr 17, 2021
04c8af1
naming: update API list
TomDonoghue Apr 17, 2021
7212313
name update: update FAQ for name, and quick edits
TomDonoghue Apr 17, 2021
76d3f5b
merge from main
TomDonoghue May 5, 2021
169ae8e
fix group naming
TomDonoghue May 5, 2021
ab1288f
clean up tests - drop explicit save_fig
TomDonoghue May 10, 2021
aca28b6
update preprint links to pubs
TomDonoghue May 10, 2021
8178d15
merge annot update
TomDonoghue May 10, 2021
be68d60
fix annot update
TomDonoghue May 10, 2021
1aad0ac
actually fix annot upate
TomDonoghue May 10, 2021
d9d34de
update sim name to sim_*
TomDonoghue May 10, 2021
32c0d2f
update docs for sim name update
TomDonoghue May 10, 2021
cf56d7c
various docsite updates & fixes
TomDonoghue May 10, 2021
50ad870
update file names
TomDonoghue May 20, 2021
08b7eec
update name in root files
TomDonoghue May 27, 2021
5bcfdfe
fix merge
TomDonoghue Jun 29, 2023
043c0a4
fix pytest import
TomDonoghue Jun 29, 2023
14ef825
fix sim doctests
TomDonoghue Jun 29, 2023
4eac4c5
update module name in workflow file
TomDonoghue Jun 29, 2023
42d457f
fix doctest for subsample spectra
TomDonoghue Jun 29, 2023
eb23f2f
fix merge
TomDonoghue Jun 30, 2023
b1d89fc
fix merge
TomDonoghue Jun 30, 2023
f09be73
merge lints
TomDonoghue Jun 30, 2023
c4655ef
update object names to SpectralModel
TomDonoghue Jun 30, 2023
8a7980e
fix merge new PRs
TomDonoghue Jun 30, 2023
a125aff
fix merge main for version number
TomDonoghue Jun 30, 2023
3434702
fix merge for other language readme info
TomDonoghue Jun 30, 2023
798de66
fix merge of rst fixes, etc
TomDonoghue Jun 30, 2023
b4953ed
update version number to rc0
TomDonoghue Jun 30, 2023
9fa8dc8
fix merge
TomDonoghue Jul 8, 2023
3930fd2
fix reference to fooof in group object
TomDonoghue Jul 8, 2023
92794ab
merge 1.1
TomDonoghue Jul 22, 2023
00d112f
update merges for 2.0
TomDonoghue Jul 22, 2023
901c9b1
fix doctest from merge
TomDonoghue Jul 22, 2023
bd01b61
merge udpates from 1.1 doc updates
TomDonoghue Jul 22, 2023
9fd116c
merge 1.1 init updates
TomDonoghue Jul 22, 2023
d33a0ff
fix dev demo import
TomDonoghue Jul 22, 2023
23f3d57
fix merge
TomDonoghue Jul 25, 2023
7f2bca4
fix / update to ModelRunModes
TomDonoghue Jul 25, 2023
a08e1bd
fix merge
TomDonoghue Aug 3, 2023
9824829
fix merge (for real)
TomDonoghue Aug 3, 2023
9702942
fix get data
TomDonoghue Aug 3, 2023
a1a946a
Merge branch 'main' into name
TomDonoghue Aug 3, 2023
3db3559
merge new version number
TomDonoghue Aug 3, 2023
da5d53a
merge optimize branch
TomDonoghue Sep 13, 2023
c0019a2
fix jacobians test import
TomDonoghue Sep 13, 2023
4a1ca34
fix merge
TomDonoghue Sep 13, 2023
9d854fd
fix merge
TomDonoghue Sep 13, 2023
313fb23
replace version
TomDonoghue Sep 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
name updates: sweep on notes, IO, and utils
  • Loading branch information
TomDonoghue committed Apr 16, 2021
commit 55dd13dbb41f5ca747795177445d0142310fb72b
2 changes: 1 addition & 1 deletion fooof/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""FOOOF - Fitting Oscillations & One-Over F"""
"""SpecParam - spectral parameterization."""

from .version import __version__

2 changes: 1 addition & 1 deletion fooof/analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Analysis sub-module for FOOOF."""
"""Analysis sub-module for model parameters and related metrics."""

from .error import compute_pointwise_error_fm, compute_pointwise_error_fg
from .periodic import get_band_peak_fm, get_band_peak_fg
26 changes: 13 additions & 13 deletions fooof/core/io.py
Original file line number Diff line number Diff line change
@@ -61,9 +61,9 @@ def fpath(file_path, file_name):
return full_path


def save_fm(fm, file_name, file_path=None, append=False,
save_results=False, save_settings=False, save_data=False):
"""Save out data, results and/or settings from a FOOOF object into a JSON file.
def save_model(fm, file_name, file_path=None, append=False,
save_results=False, save_settings=False, save_data=False):
"""Save out data, results and/or settings from a model object into a JSON file.

Parameters
----------
@@ -119,9 +119,9 @@ def save_fm(fm, file_name, file_path=None, append=False,
raise ValueError("Save file not understood.")


def save_fg(fg, file_name, file_path=None, append=False,
save_results=False, save_settings=False, save_data=False):
"""Save out results and/or settings from FOOOFGroup object. Saves out to a JSON file.
def save_group(fg, file_name, file_path=None, append=False,
save_results=False, save_settings=False, save_data=False):
"""Save out results and/or settings from group object. Saves out to a JSON file.

Parameters
----------
@@ -153,16 +153,16 @@ def save_fg(fg, file_name, file_path=None, append=False,
# Save to string specified file, do not append
if isinstance(file_name, str) and not append:
with open(fpath(file_path, fname(file_name, 'json')), 'w') as f_obj:
_save_fg(fg, f_obj, save_results, save_settings, save_data)
_save_group(fg, f_obj, save_results, save_settings, save_data)

# Save to string specified file, appending
elif isinstance(file_name, str) and append:
with open(fpath(file_path, fname(file_name, 'json')), 'a') as f_obj:
_save_fg(fg, f_obj, save_results, save_settings, save_data)
_save_group(fg, f_obj, save_results, save_settings, save_data)

# Save to file-object specified file
elif isinstance(file_name, io.IOBase):
_save_fg(fg, file_name, save_results, save_settings, save_data)
_save_group(fg, file_name, save_results, save_settings, save_data)

else:
raise ValueError("Save file not understood.")
@@ -226,8 +226,8 @@ def load_jsonlines(file_name, file_path):
break


def _save_fg(fg, f_obj, save_results, save_settings, save_data):
"""Helper function for saving FOOOFGroup - saves data given a file object.
def _save_group(fg, f_obj, save_results, save_settings, save_data):
"""Helper function for saving a group object - saves data given a file object.

Parameters
----------
@@ -245,11 +245,11 @@ def _save_fg(fg, f_obj, save_results, save_settings, save_data):

# Since there is a single set of object settings, save them out once, at the top
if save_settings:
save_fm(fg, file_name=f_obj, file_path=None, append=False, save_settings=True)
save_model(fg, file_name=f_obj, file_path=None, append=False, save_settings=True)

# For results & data, loop across all data and/or models, and save each out to a new line
if save_results or save_data:
for ind in range(len(fg.group_results)):
fm = fg.get_model(ind, regenerate=False)
save_fm(fm, file_name=f_obj, file_path=None, append=False,
save_model(fm, file_name=f_obj, file_path=None, append=False,
save_results=save_results, save_data=save_data)
18 changes: 9 additions & 9 deletions fooof/core/strings.py
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ def gen_version_str(concise=False):
# Header
'=',
'',
'FOOOF - VERSION',
'SpecParam - VERSION',
'',

# Version information
@@ -120,7 +120,7 @@ def gen_settings_str(model_obj, description=False, concise=False):
# Header
'=',
'',
'FOOOF - SETTINGS',
'SpecParam - SETTINGS',
'',

# Settings - include descriptions if requested
@@ -167,7 +167,7 @@ def gen_freq_range_str(model_obj, concise=False):
# Header
'=',
'',
'FOOOF - FIT RANGE',
'SpecParam - FIT RANGE',
'',

# Frequency range information information
@@ -203,7 +203,7 @@ def gen_methods_report_str(concise=False):
# Header
'=',
'',
'FOOOF - REPORTING',
'SpecParam - REPORTING',
'',

# Methods report information
@@ -234,8 +234,8 @@ def gen_methods_text_str(model_obj=None):
"""

template = (
"The FOOOF algorithm (version {}) was used to parameterize "
"neural power spectra. Settings for the algorithm were set as: "
"The periodic & aperiodic spectral parameterization algorithm (version {}) "
"was used to parameterize neural power spectra. Settings for the algorithm were set as: "
"peak width limits : {}; "
"max number of peaks : {}; "
"minimum peak height : {}; "
@@ -287,7 +287,7 @@ def gen_results_fm_str(fm, concise=False):
# Header
'=',
'',
' FOOOF - POWER SPECTRUM MODEL',
'POWER SPECTRUM MODEL',
'',

# Frequency range and resolution
@@ -364,7 +364,7 @@ def gen_results_fg_str(fg, concise=False):
# Header
'=',
'',
' FOOOF - GROUP RESULTS',
'GROUP RESULTS',
'',

# Group information
@@ -431,7 +431,7 @@ def gen_issue_str(concise=False):
# Header
'=',
'',
'FOOOF - ISSUE REPORTING',
'SpecParam - ISSUE REPORTING',
'',

# Reporting bugs
38 changes: 19 additions & 19 deletions fooof/objs/fit.py
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@

from fooof.core.items import OBJ_DESC
from fooof.core.info import get_indices
from fooof.core.io import save_fm, load_json
from fooof.core.io import save_model, load_json
from fooof.core.reports import save_report_fm
from fooof.core.modutils import copy_doc_func_to_method
from fooof.core.utils import group_three, check_array_dim
@@ -324,52 +324,52 @@ def add_data(self, freqs, power_spectrum, freq_range=None, clear_results=True):
self._prepare_data(freqs, power_spectrum, freq_range, 1)


def add_settings(self, fooof_settings):
def add_settings(self, settings):
"""Add settings into object from a ModelSettings object.

Parameters
----------
fooof_settings : ModelSettings
settings : ModelSettings
A data object containing the settings for a power spectrum model.
"""

for setting in OBJ_DESC['settings']:
setattr(self, setting, getattr(fooof_settings, setting))
setattr(self, setting, getattr(settings, setting))

self._check_loaded_settings(fooof_settings._asdict())
self._check_loaded_settings(settings._asdict())


def add_meta_data(self, fooof_meta_data):
def add_meta_data(self, meta_data):
"""Add data information into object from a SpectrumMetaData object.

Parameters
----------
fooof_meta_data : SpectrumMetaData
meta_data : SpectrumMetaData
A meta data object containing meta data information.
"""

for meta_dat in OBJ_DESC['meta_data']:
setattr(self, meta_dat, getattr(fooof_meta_data, meta_dat))
setattr(self, meta_dat, getattr(meta_data, meta_dat))

self._regenerate_freqs()


def add_results(self, fooof_result):
def add_results(self, results):
"""Add results data into object from a FitResults object.

Parameters
----------
fooof_result : FitResults
results : FitResults
A data object containing the results from fitting a power spectrum model.
"""

self.aperiodic_params_ = fooof_result.aperiodic_params
self.gaussian_params_ = fooof_result.gaussian_params
self.peak_params_ = fooof_result.peak_params
self.r_squared_ = fooof_result.r_squared
self.error_ = fooof_result.error
self.aperiodic_params_ = results.aperiodic_params
self.gaussian_params_ = results.gaussian_params
self.peak_params_ = results.peak_params
self.r_squared_ = results.r_squared
self.error_ = results.error

self._check_loaded_results(fooof_result._asdict())
self._check_loaded_results(results._asdict())


def report(self, freqs=None, power_spectrum=None, freq_range=None, plt_log=False):
@@ -647,15 +647,15 @@ def save_report(self, file_name, file_path=None, plt_log=False):
save_report_fm(self, file_name, file_path, plt_log)


@copy_doc_func_to_method(save_fm)
@copy_doc_func_to_method(save_model)
def save(self, file_name, file_path=None, append=False,
save_results=False, save_settings=False, save_data=False):

save_fm(self, file_name, file_path, append, save_results, save_settings, save_data)
save_model(self, file_name, file_path, append, save_results, save_settings, save_data)


def load(self, file_name, file_path=None, regenerate=True):
"""Load in a FOOOF formatted JSON file to the current object.
"""Load in a data file to the current object.

Parameters
----------
6 changes: 3 additions & 3 deletions fooof/objs/group.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
from fooof.core.errors import NoModelError
from fooof.core.reports import save_report_fg
from fooof.core.strings import gen_results_fg_str
from fooof.core.io import save_fg, load_jsonlines
from fooof.core.io import save_group, load_jsonlines
from fooof.core.modutils import copy_doc_func_to_method, safe_import

###################################################################################################
@@ -406,11 +406,11 @@ def save_report(self, file_name, file_path=None):
save_report_fg(self, file_name, file_path)


@copy_doc_func_to_method(save_fg)
@copy_doc_func_to_method(save_group)
def save(self, file_name, file_path=None, append=False,
save_results=False, save_settings=False, save_data=False):

save_fg(self, file_name, file_path, append, save_results, save_settings, save_data)
save_group(self, file_name, file_path, append, save_results, save_settings, save_data)


def load(self, file_name, file_path=None):
2 changes: 1 addition & 1 deletion fooof/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Tests for FOOOF."""
"""Tests for the spectral parameterization module."""
Loading