Power Spectral Density Plots of rBCBG firing rates¶
- class analyseur.rbcbg.visual.powspec.VizPSD[source]¶
Bases:
objectView Power Spectral Density (PSD) Class.
Plot in axis
View
overall frequency content
temporal evolution of frequencies
Use Case:
Setup
from analyseur.rbcbg.loader import LoadRates from analyseur.rbcbg.visual.powspec import VizPSD loadFR = LoadRates("GPiSNr_model_9_percent_0.csv") t_sec, rates_Hz = loadFR.get_rates()
Power Spectral Density for the entire signal
binsz = 0.001 fig, ax = plt.subplots(figsize=(6, 10)) ax = VizPSD.plot_global_in_ax(ax, rates_Hz, binsz, nucleus="GPiSNr") plt.show()
Time-varying Power Spectrum
fig, ax = plt.subplots(figsize=(6, 10)) fig, ax = VizPSD.plot_tv_in_axis(fig, ax, rates_Hz, nucleus="GPiSNr") plt.show()
- classmethod plot_global_in_ax(ax, mu_rate_arr, binsz, nucleus=None, resolution=None, method=None, withbands=False, offset_title=None)[source]¶
PSD (log scale) │ │ ▲ │ ▲ ▲ │ ▲ ▲ │▲ ▲ │ ▲ │ ▲ │ ▲ │ ▲ │ ▲ │ ▲____ │ \______ │ \________ │ \______ └──────────────────────────────────────────→ f (Hz) strong low-freq power → high-freq attenuation
Given a matplotlib.pyplot.axis this draws the average (or single/global) power spectrum of the entire signal tells us the overall frequency content using
compute_for_rate().- Parameters:
ax – object matplotlib.pyplot.axis
mu_rate_array – array returned using
get_rates()binsz – integer or float
[OPTIONAL]
- Parameters:
nucleus – string; name of the nucleus
method – “welch” or “fft” or “fft-mag”
resolution – ~ 9.76 Hz = sampling_rate/1024 [default]
withbands – True or False [default]
offset_title – x-axis offset; scalar or None [default]
- Returns:
ax with respective plotting
- classmethod plot_tv_in_axis(fig, ax, mu_rate_arr, nucleus=None, resolution=None, offset_title=None)[source]¶
Frequency (Hz) │100 ───────────────────────────────────────────── │ 80 ───────────────────────────────────────────── │ 60 ────────────────:::::::::──────────────────── │ 40 ───────────:::::::::::::::───────────::::::::: │ 20 ───────::::::::::::::::::::::::::::::: ::::::: │ 10 ─────::::::::::::::::::::::::::::::::::::::::: │ 5 ────:::::::::::::::::::::::::::::::::::::::::: │ 0 ───────────────────────────────────────────── │ └──────────────────────────────────────────────────→ Time (s) 0 2 4 6 8 10 Legend: ":" → higher power "." → lower power " " → minimal / background power
Given a matplotlib.pyplot.figure and its matplotlib.pyplot.axis this draws the time-varying power spectrum telling us how frequencies evolve using
compute_spectrogram().- Parameters:
fig – object matplotlib.pyplot.figure
ax – object matplotlib.pyplot.axis
mu_rate_array – array returned using
get_rates()binsz – integer or float
[OPTIONAL]
- Parameters:
nucleus – string; name of the nucleus
resolution – ~ 9.76 Hz = sampling_rate/1024 [default]
offset_title – x-axis offset; scalar or None [default]
- Returns:
fig and ax with respective plotting