Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions fooof/objs/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,7 @@ def get_params(self, name, col=None):

Notes
-----
For further description of the data you can extract, check the FOOOFResults documentation.

If there is no data on periodic features, this method will return NaN.
If there are no fit peak (no peak parameters), this method will return NaN.
"""

if not self.has_model:
Expand Down
16 changes: 7 additions & 9 deletions fooof/objs/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ def get_params(self, name, col=None):

Notes
-----
For further description of the data you can extract, check the FOOOFResults documentation.
When extracting peak information ('peak_params' or 'gaussian_params'), an additional column
is appended to the returned array, indicating the index of the model that the peak came from.
"""

if not self.has_model:
Expand All @@ -375,21 +376,18 @@ def get_params(self, name, col=None):
# As a special case, peak_params are pulled out in a way that appends
# an extra column, indicating which FOOOF run each peak comes from
if name in ('peak_params', 'gaussian_params'):
out = np.array([np.insert(getattr(data, name), 3, index, axis=1)
for index, data in enumerate(self.group_results)])

# Collect peak data, appending the index of the model it comes from
out = np.vstack([np.insert(getattr(data, name), 3, index, axis=1)
for index, data in enumerate(self.group_results)])

# This updates index to grab selected column, and the last column
# This last column is the 'index' column (FOOOF object source)
if col is not None:
col = [col, -1]
else:
out = np.array([getattr(data, name) for data in self.group_results])

# Some data can end up as a list of separate arrays
# If so, concatenate it all into one 2d array
if isinstance(out[0], np.ndarray):
out = np.concatenate([arr.reshape(1, len(arr)) \
if arr.ndim == 1 else arr for arr in out], 0)

# Select out a specific column, if requested
if col is not None:
out = out[:, col]
Expand Down