added unfiltered envelope in main plot
This commit is contained in:
parent
658b5011fd
commit
0f1fca8b18
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"python.formatting.provider": "autopep8"
|
||||||
|
}
|
@ -11,6 +11,9 @@ from thunderfish.powerspectrum import spectrogram, decibel
|
|||||||
|
|
||||||
from modules.filters import bandpass_filter, envelope, highpass_filter
|
from modules.filters import bandpass_filter, envelope, highpass_filter
|
||||||
from modules.filehandling import ConfLoader, LoadData
|
from modules.filehandling import ConfLoader, LoadData
|
||||||
|
from modules.plotstyle import PlotStyle
|
||||||
|
|
||||||
|
ps = PlotStyle()
|
||||||
|
|
||||||
|
|
||||||
def instantaneos_frequency(
|
def instantaneos_frequency(
|
||||||
@ -275,19 +278,19 @@ def main(datapath: str) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# compute envelopes
|
# compute envelopes
|
||||||
baseline_envelope = envelope(
|
baseline_envelope_unfiltered = envelope(
|
||||||
baseline, data.raw_rate, config.envelope_cutoff)
|
baseline, data.raw_rate, config.envelope_cutoff)
|
||||||
search_envelope = envelope(
|
search_envelope = envelope(
|
||||||
search, data.raw_rate, config.envelope_cutoff)
|
search, data.raw_rate, config.envelope_cutoff)
|
||||||
|
|
||||||
# highpass filter envelopes
|
# highpass filter envelopes
|
||||||
baseline_envelope = highpass_filter(
|
baseline_envelope = highpass_filter(
|
||||||
baseline_envelope,
|
baseline_envelope_unfiltered,
|
||||||
data.raw_rate,
|
data.raw_rate,
|
||||||
config.envelope_highpass_cutoff
|
config.envelope_highpass_cutoff
|
||||||
)
|
)
|
||||||
|
|
||||||
baseline_envelope = np.abs(baseline_envelope)
|
# baseline_envelope = np.abs(baseline_envelope)
|
||||||
# search_envelope = highpass_filter(
|
# search_envelope = highpass_filter(
|
||||||
# search_envelope,
|
# search_envelope,
|
||||||
# data.raw_rate,
|
# data.raw_rate,
|
||||||
@ -323,6 +326,7 @@ def main(datapath: str) -> None:
|
|||||||
int(window_edge), len(baseline_envelope) -
|
int(window_edge), len(baseline_envelope) -
|
||||||
int(window_edge)
|
int(window_edge)
|
||||||
)
|
)
|
||||||
|
baseline_envelope_unfiltered = baseline_envelope_unfiltered[valid]
|
||||||
baseline_envelope = baseline_envelope[valid]
|
baseline_envelope = baseline_envelope[valid]
|
||||||
search_envelope = search_envelope[valid]
|
search_envelope = search_envelope[valid]
|
||||||
|
|
||||||
@ -374,23 +378,22 @@ def main(datapath: str) -> None:
|
|||||||
|
|
||||||
# plot baseline instantaneos frequency
|
# plot baseline instantaneos frequency
|
||||||
axs[1, i].plot(baseline_freq_time, baseline_freq -
|
axs[1, i].plot(baseline_freq_time, baseline_freq -
|
||||||
np.median(baseline_freq), marker=".")
|
np.median(baseline_freq))
|
||||||
|
|
||||||
# plot waveform of filtered signal
|
# plot waveform of filtered signal
|
||||||
axs[2, i].plot(time_oi, baseline, c="k")
|
axs[2, i].plot(time_oi, baseline, c=ps.green)
|
||||||
|
|
||||||
# plot narrow filtered baseline
|
# plot broad filtered baseline
|
||||||
axs[2, i].plot(
|
axs[2, i].plot(
|
||||||
time_oi,
|
time_oi,
|
||||||
baseline_envelope,
|
broad_baseline,
|
||||||
c="orange",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# plot broad filtered baseline
|
# plot narrow filtered baseline envelope
|
||||||
axs[2, i].plot(
|
axs[2, i].plot(
|
||||||
time_oi,
|
time_oi,
|
||||||
broad_baseline,
|
baseline_envelope_unfiltered,
|
||||||
c="green",
|
c=ps.red
|
||||||
)
|
)
|
||||||
|
|
||||||
# plot waveform of filtered search signal
|
# plot waveform of filtered search signal
|
||||||
@ -400,7 +403,7 @@ def main(datapath: str) -> None:
|
|||||||
axs[3, i].plot(
|
axs[3, i].plot(
|
||||||
time_oi,
|
time_oi,
|
||||||
search_envelope,
|
search_envelope,
|
||||||
c="orange",
|
c=ps.red
|
||||||
)
|
)
|
||||||
|
|
||||||
# plot filtered and rectified envelope
|
# plot filtered and rectified envelope
|
||||||
@ -408,7 +411,7 @@ def main(datapath: str) -> None:
|
|||||||
axs[4, i].scatter(
|
axs[4, i].scatter(
|
||||||
(time_oi)[baseline_peaks],
|
(time_oi)[baseline_peaks],
|
||||||
baseline_envelope[baseline_peaks],
|
baseline_envelope[baseline_peaks],
|
||||||
c="red",
|
c=ps.red,
|
||||||
)
|
)
|
||||||
|
|
||||||
# plot envelope of search signal
|
# plot envelope of search signal
|
||||||
@ -416,7 +419,7 @@ def main(datapath: str) -> None:
|
|||||||
axs[5, i].scatter(
|
axs[5, i].scatter(
|
||||||
(time_oi)[search_peaks],
|
(time_oi)[search_peaks],
|
||||||
search_envelope[search_peaks],
|
search_envelope[search_peaks],
|
||||||
c="red",
|
c=ps.red,
|
||||||
)
|
)
|
||||||
|
|
||||||
# plot filtered instantaneous frequency
|
# plot filtered instantaneous frequency
|
||||||
@ -424,7 +427,7 @@ def main(datapath: str) -> None:
|
|||||||
axs[6, i].scatter(
|
axs[6, i].scatter(
|
||||||
baseline_freq_time[inst_freq_peaks],
|
baseline_freq_time[inst_freq_peaks],
|
||||||
np.abs(inst_freq_filtered)[inst_freq_peaks],
|
np.abs(inst_freq_filtered)[inst_freq_peaks],
|
||||||
c="red",
|
c=ps.red,
|
||||||
)
|
)
|
||||||
|
|
||||||
axs[6, i].set_xlabel("Time [s]")
|
axs[6, i].set_xlabel("Time [s]")
|
||||||
|
@ -13,7 +13,7 @@ search_boundary: 100
|
|||||||
envelope_cutoff: 25
|
envelope_cutoff: 25
|
||||||
|
|
||||||
# Cutoff frequency for envelope highpass filter
|
# Cutoff frequency for envelope highpass filter
|
||||||
envelope_highpass_cutoff: 5
|
envelope_highpass_cutoff: 4
|
||||||
|
|
||||||
# Cutoff frequency for envelope of envelope
|
# Cutoff frequency for envelope of envelope
|
||||||
envelope_envelope_cutoff: 5
|
envelope_envelope_cutoff: 5
|
||||||
|
@ -18,17 +18,17 @@ def PlotStyle() -> None:
|
|||||||
black = "#111116"
|
black = "#111116"
|
||||||
white = "#e0e4f7"
|
white = "#e0e4f7"
|
||||||
gray = "#6c6e7d"
|
gray = "#6c6e7d"
|
||||||
pink = "#f5c2e7"
|
|
||||||
purple = "#cba6f7"
|
|
||||||
red = "#f38ba8"
|
|
||||||
maroon = "#eba0ac"
|
|
||||||
orange = "#fab387"
|
|
||||||
yellow = "#f9e2af"
|
|
||||||
green = "#a6e3a1"
|
|
||||||
teal = "#94e2d5"
|
|
||||||
sky = "#89dceb"
|
|
||||||
sapphire = "#74c7ec"
|
|
||||||
blue = "#89b4fa"
|
blue = "#89b4fa"
|
||||||
|
sapphire = "#74c7ec"
|
||||||
|
sky = "#89dceb"
|
||||||
|
teal = "#94e2d5"
|
||||||
|
green = "#a6e3a1"
|
||||||
|
yellow = "#f9e2af"
|
||||||
|
orange = "#fab387"
|
||||||
|
maroon = "#eba0ac"
|
||||||
|
red = "#f38ba8"
|
||||||
|
purple = "#cba6f7"
|
||||||
|
pink = "#f5c2e7"
|
||||||
lavender = "#b4befe"
|
lavender = "#b4befe"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -218,7 +218,7 @@ def PlotStyle() -> None:
|
|||||||
plt.rcParams["image.cmap"] = 'cmo.haline'
|
plt.rcParams["image.cmap"] = 'cmo.haline'
|
||||||
# plt.rcParams["axes.xmargin"] = 0.1
|
# plt.rcParams["axes.xmargin"] = 0.1
|
||||||
# plt.rcParams["axes.ymargin"] = 0.15
|
# plt.rcParams["axes.ymargin"] = 0.15
|
||||||
plt.rcParams["axes.titlelocation"] = "center"
|
plt.rcParams["axes.titlelocation"] = "left"
|
||||||
plt.rcParams["axes.titlesize"] = BIGGER_SIZE
|
plt.rcParams["axes.titlesize"] = BIGGER_SIZE
|
||||||
# plt.rcParams["axes.titlepad"] = -10
|
# plt.rcParams["axes.titlepad"] = -10
|
||||||
plt.rcParams["legend.frameon"] = False
|
plt.rcParams["legend.frameon"] = False
|
||||||
@ -244,8 +244,8 @@ def PlotStyle() -> None:
|
|||||||
plt.rcParams["text.color"] = white
|
plt.rcParams["text.color"] = white
|
||||||
plt.rcParams["axes.facecolor"] = black # axes background color
|
plt.rcParams["axes.facecolor"] = black # axes background color
|
||||||
plt.rcParams["axes.edgecolor"] = gray # axes edge color
|
plt.rcParams["axes.edgecolor"] = gray # axes edge color
|
||||||
plt.rcParams["axes.grid"] = True # display grid or not
|
# plt.rcParams["axes.grid"] = True # display grid or not
|
||||||
plt.rcParams["axes.grid.axis"] = "y" # which axis the grid is applied to
|
# plt.rcParams["axes.grid.axis"] = "y" # which axis the grid is applied to
|
||||||
plt.rcParams["axes.labelcolor"] = white
|
plt.rcParams["axes.labelcolor"] = white
|
||||||
plt.rcParams["axes.axisbelow"] = True # draw axis gridlines and ticks:
|
plt.rcParams["axes.axisbelow"] = True # draw axis gridlines and ticks:
|
||||||
plt.rcParams["axes.spines.left"] = True # display axis spines
|
plt.rcParams["axes.spines.left"] = True # display axis spines
|
||||||
@ -254,18 +254,18 @@ def PlotStyle() -> None:
|
|||||||
plt.rcParams["axes.spines.right"] = False
|
plt.rcParams["axes.spines.right"] = False
|
||||||
plt.rcParams["axes.prop_cycle"] = cycler(
|
plt.rcParams["axes.prop_cycle"] = cycler(
|
||||||
'color', [
|
'color', [
|
||||||
'#f5c2e7',
|
|
||||||
'#cba6f7',
|
|
||||||
'#f38ba8',
|
|
||||||
'#eba0ac',
|
|
||||||
'#fab387',
|
|
||||||
'#f9e2af',
|
|
||||||
'#a6e3a1',
|
|
||||||
'#94e2d5',
|
|
||||||
'#89dceb',
|
|
||||||
'#74c7ec',
|
|
||||||
'#89b4fa',
|
|
||||||
'#b4befe',
|
'#b4befe',
|
||||||
|
'#89b4fa',
|
||||||
|
'#74c7ec',
|
||||||
|
'#89dceb',
|
||||||
|
'#94e2d5',
|
||||||
|
'#a6e3a1',
|
||||||
|
'#f9e2af',
|
||||||
|
'#fab387',
|
||||||
|
'#eba0ac',
|
||||||
|
'#f38ba8',
|
||||||
|
'#cba6f7',
|
||||||
|
'#f5c2e7',
|
||||||
])
|
])
|
||||||
plt.rcParams["xtick.color"] = gray # color of the ticks
|
plt.rcParams["xtick.color"] = gray # color of the ticks
|
||||||
plt.rcParams["ytick.color"] = gray # color of the ticks
|
plt.rcParams["ytick.color"] = gray # color of the ticks
|
||||||
|
Loading…
Reference in New Issue
Block a user