Skip to content

Commit 4f53829

Browse files
committed
finish lint: use docs updates & other small fixes
1 parent 5f1d94a commit 4f53829

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

specparam/objs/event.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ def fit(self, freqs=None, spectrograms=None, freq_range=None, peak_org=None,
226226
Data is optional, if data has already been added to the object.
227227
"""
228228

229-
# ToDo: here because of circular import - updates / refactors should fix & move
230-
#from specparam.objs.group import _progress
231-
232229
if spectrograms is not None:
233230
self.add_data(freqs, spectrograms, freq_range)
234231

@@ -274,7 +271,7 @@ def drop(self, drop_inds=None, window_inds=None):
274271
null_model = SpectralModel(*self.get_settings()).get_results()
275272

276273
drop_inds = drop_inds if isinstance(drop_inds, dict) else \
277-
{eind : winds for eind, winds in zip(check_inds(drop_inds), repeat(window_inds))}
274+
dict(zip(check_inds(drop_inds), repeat(window_inds)))
278275

279276
for eind, winds in drop_inds.items():
280277

specparam/sim/sim.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import numpy as np
44

55
from specparam.core.utils import check_iter, check_flat
6-
from specparam.core.modutils import docs_get_section, replace_docstring_sections
6+
from specparam.core.modutils import (docs_get_section, replace_docstring_sections,
7+
docs_replace_param)
78
from specparam.sim.params import collect_sim_params
89
from specparam.sim.gen import gen_freqs, gen_power_vals, gen_rotated_power_vals
910
from specparam.sim.transform import compute_rotation_offset
@@ -259,8 +260,11 @@ def sim_group_power_spectra(n_spectra, freq_range, aperiodic_params, periodic_pa
259260
else:
260261
return freqs, powers
261262

262-
# ToDo: need an update to docstring to replace `n_spectra` with `n_windows`
263-
@replace_docstring_sections(docs_get_section(sim_group_power_spectra.__doc__, 'Parameters'))
263+
264+
@replace_docstring_sections(\
265+
docs_replace_param(docs_get_section(\
266+
sim_group_power_spectra.__doc__, 'Parameters'),
267+
'n_spectra', 'n_windows : int\n The number of time windows to generate.'))
264268
def sim_spectrogram(n_windows, freq_range, aperiodic_params, periodic_params,
265269
nlvs=0.005, freq_res=0.5, f_rotation=None, return_params=False):
266270
"""Simulate spectrogram.

specparam/tests/core/test_modutils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ def test_docs_replace_param(tdocstring):
4343

4444
new_param = 'updated : other\n This description has been dropped in.'
4545

46-
ndocstring = docs_replace_param(tdocstring, 'first', new_param)
47-
assert 'updated' in ndocstring
48-
assert 'first' not in ndocstring
49-
assert 'second' in ndocstring
50-
51-
ndocstring = docs_replace_param(tdocstring, 'second', new_param)
52-
assert 'updated' in ndocstring
53-
assert 'first' in ndocstring
54-
assert 'second' not in ndocstring
46+
ndocstring1 = docs_replace_param(tdocstring, 'first', new_param)
47+
assert 'updated' in ndocstring1
48+
assert 'first' not in ndocstring1
49+
assert 'second' in ndocstring1
50+
51+
ndocstring2 = docs_replace_param(tdocstring, 'second', new_param)
52+
assert 'updated' in ndocstring2
53+
assert 'first' in ndocstring2
54+
assert 'second' not in ndocstring2
5555

5656
def test_docs_append_to_section(tdocstring):
5757

0 commit comments

Comments
 (0)