Skip to content

Commit

Permalink
add to init & avoid circular imports
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDonoghue committed Feb 20, 2024
1 parent 6ac7c0f commit b551ef1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions neurodsp/plts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
from .spectral import (plot_power_spectra, plot_spectral_hist,
plot_scv, plot_scv_rs_lines, plot_scv_rs_matrix)
from .timefrequency import plot_timefrequency
from .combined import plot_timeseries_and_spectrum
6 changes: 4 additions & 2 deletions neurodsp/plts/combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import matplotlib.pyplot as plt

from neurodsp.spectral import compute_spectrum
from neurodsp.utils.data import create_times
from neurodsp.spectral.utils import trim_spectrum
from neurodsp.plts.spectral import plot_power_spectra
from neurodsp.plts.time_series import plot_time_series
from neurodsp.plts.utils import savefig
Expand Down Expand Up @@ -43,6 +41,10 @@ def plot_timeseries_and_spectrum(sig, fs, ts_range=None, f_range=None, spectrum_
These arguments are passed to both plot axes.
"""

# Import spectal functions locally to avoid circular imports
from neurodsp.spectral import compute_spectrum
from neurodsp.spectral.utils import trim_spectrum

# Allow for defining color as 'color' (since one line per plot), rather than 'colors'
if 'color' in plt_kwargs:
plt_kwargs['colors'] = plt_kwargs.pop('color')
Expand Down

0 comments on commit b551ef1

Please sign in to comment.