Merge branch 'master' into chirp_simulation
This commit is contained in:
commit
3c5ab4381e
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"python.formatting.provider": "autopep8"
|
|
||||||
}
|
|
@ -1,12 +1,68 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
from IPython import embed
|
||||||
from pandas import read_csv
|
from pandas import read_csv
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Behavior:
|
class Behavior:
|
||||||
|
"""Load behavior data from csv file as class attributes
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
behavior_type:
|
||||||
|
behavioral_category:
|
||||||
|
comment_start:
|
||||||
|
comment_stop:
|
||||||
|
dataframe: pandas dataframe with all the data
|
||||||
|
duration_s:
|
||||||
|
media_file:
|
||||||
|
observation_date:
|
||||||
|
observation_id:
|
||||||
|
start_s:
|
||||||
|
stop_s:
|
||||||
|
total_length:
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, datapath: str) -> None:
|
def __init__(self, datapath: str) -> None:
|
||||||
csv_file = str(sorted(Path(datapath).glob('**/*.csv'))[0])
|
csv_file = str(sorted(Path(datapath).glob('**/*.csv'))[0])
|
||||||
self.dataframe = read_csv(csv_file, delimiter=',')
|
self.dataframe = read_csv(csv_file, delimiter=',')
|
||||||
|
for key in self.dataframe:
|
||||||
|
if ' ' in key:
|
||||||
|
new_key = key.replace(' ', '_')
|
||||||
|
if '(' in new_key:
|
||||||
|
new_key = new_key.replace('(', '')
|
||||||
|
new_key = new_key.replace(')', '')
|
||||||
|
new_key = new_key.lower()
|
||||||
|
setattr(self, new_key, np.array(self.dataframe[key]))
|
||||||
|
|
||||||
|
"""
|
||||||
|
1 - chasing onset
|
||||||
|
2 - chasing offset
|
||||||
|
3 - physical contact event
|
||||||
|
|
||||||
|
temporal encpding needs to be corrected ... not exactly 25FPS.
|
||||||
|
|
||||||
|
### correspinding python code ###
|
||||||
|
|
||||||
|
factor = 1.034141
|
||||||
|
LED_on_time_BORIS = np.load(os.path.join(folder_path, 'LED_on_time.npy'), allow_pickle=True)
|
||||||
|
last_LED_t_BORIS = LED_on_time_BORIS[-1]
|
||||||
|
real_time_range = times[-1] - times[0]
|
||||||
|
shift = last_LED_t_BORIS - real_time_range * factor
|
||||||
|
|
||||||
|
data = pd.read_csv(os.path.join(folder_path, file[1:-7] + '.csv'))
|
||||||
|
boris_times = data['Start (s)']
|
||||||
|
data_times = []
|
||||||
|
|
||||||
|
for Cevent_t in boris_times:
|
||||||
|
Cevent_boris_times = (Cevent_t - shift) / factor
|
||||||
|
data_times.append(Cevent_boris_times)
|
||||||
|
|
||||||
|
data_times = np.array(data_times)
|
||||||
|
behavior = data['Behavior']
|
||||||
|
"""
|
||||||
|
|
||||||
def main(datapath: str):
|
def main(datapath: str):
|
||||||
# behabvior is pandas dataframe with all the data
|
# behabvior is pandas dataframe with all the data
|
||||||
|
@ -3,21 +3,24 @@ import os
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from IPython import embed
|
from IPython import embed
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from scipy.stats import iqr
|
|
||||||
from scipy.signal import find_peaks
|
from scipy.signal import find_peaks
|
||||||
from scipy.ndimage import gaussian_filter1d
|
from scipy.ndimage import gaussian_filter1d
|
||||||
from thunderfish.dataloader import DataLoader
|
from thunderfish.dataloader import DataLoader
|
||||||
from thunderfish.powerspectrum import spectrogram, decibel
|
from thunderfish.powerspectrum import spectrogram, decibel
|
||||||
|
from sklearn.preprocessing import normalize
|
||||||
|
|
||||||
from modules.filters import bandpass_filter, envelope, highpass_filter
|
from modules.filters import bandpass_filter, envelope, highpass_filter
|
||||||
from modules.filehandling import ConfLoader
|
from modules.filehandling import ConfLoader, LoadData
|
||||||
|
from modules.plotstyle import PlotStyle
|
||||||
|
|
||||||
|
ps = PlotStyle()
|
||||||
|
|
||||||
|
|
||||||
def instantaneos_frequency(
|
def instantaneos_frequency(
|
||||||
signal: np.ndarray, samplerate: int
|
signal: np.ndarray, samplerate: int
|
||||||
) -> tuple[np.ndarray, np.ndarray]:
|
) -> tuple[np.ndarray, np.ndarray]:
|
||||||
"""
|
"""
|
||||||
Compute the instantaneous frequency of a signal.
|
Compute the instantaneous frequency of a signal.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
@ -136,22 +139,24 @@ def main(datapath: str) -> None:
|
|||||||
|
|
||||||
# load raw file
|
# load raw file
|
||||||
file = os.path.join(datapath, "traces-grid1.raw")
|
file = os.path.join(datapath, "traces-grid1.raw")
|
||||||
data = DataLoader(file, 60.0, 0, channel=-1)
|
# data = DataLoader(file, 60.0, 0, channel=-1)
|
||||||
|
|
||||||
|
data = LoadData(datapath)
|
||||||
|
|
||||||
# load wavetracker files
|
# load wavetracker files
|
||||||
time = np.load(datapath + "times.npy", allow_pickle=True)
|
# time = np.load(datapath + "times.npy", allow_pickle=True)
|
||||||
freq = np.load(datapath + "fund_v.npy", allow_pickle=True)
|
# freq = np.load(datapath + "fund_v.npy", allow_pickle=True)
|
||||||
powers = np.load(datapath + "sign_v.npy", allow_pickle=True)
|
# powers = np.load(datapath + "sign_v.npy", allow_pickle=True)
|
||||||
idx = np.load(datapath + "idx_v.npy", allow_pickle=True)
|
# idx = np.load(datapath + "idx_v.npy", allow_pickle=True)
|
||||||
ident = np.load(datapath + "ident_v.npy", allow_pickle=True)
|
# ident = np.load(datapath + "ident_v.npy", allow_pickle=True)
|
||||||
|
|
||||||
# load config file
|
# load config file
|
||||||
config = ConfLoader("chirpdetector_conf.yml")
|
config = ConfLoader("chirpdetector_conf.yml")
|
||||||
|
|
||||||
# set time window # <------------------------ Iterate through windows here
|
# set time window # <------------------------ Iterate through windows here
|
||||||
window_duration = config.window * data.samplerate
|
window_duration = config.window * data.raw_rate
|
||||||
window_overlap = config.overlap * data.samplerate
|
window_overlap = config.overlap * data.raw_rate
|
||||||
window_edge = config.edge * data.samplerate
|
window_edge = config.edge * data.raw_rate
|
||||||
|
|
||||||
# check if window duration is even
|
# check if window duration is even
|
||||||
if window_duration % 2 == 0:
|
if window_duration % 2 == 0:
|
||||||
@ -165,11 +170,11 @@ def main(datapath: str) -> None:
|
|||||||
else:
|
else:
|
||||||
raise ValueError("Window overlap must be even.")
|
raise ValueError("Window overlap must be even.")
|
||||||
|
|
||||||
raw_time = np.arange(data.shape[0]) / data.samplerate
|
raw_time = np.arange(data.raw.shape[0]) / data.raw_rate
|
||||||
|
|
||||||
# good chirp times for data: 2022-06-02-10_00
|
# good chirp times for data: 2022-06-02-10_00
|
||||||
t0 = (3 * 60 * 60 + 6 * 60 + 43.5) * data.samplerate
|
t0 = (3 * 60 * 60 + 6 * 60 + 43.5) * data.raw_rate
|
||||||
dt = 60 * data.samplerate
|
dt = 60 * data.raw_rate
|
||||||
|
|
||||||
window_starts = np.arange(
|
window_starts = np.arange(
|
||||||
t0,
|
t0,
|
||||||
@ -178,35 +183,52 @@ def main(datapath: str) -> None:
|
|||||||
dtype=int
|
dtype=int
|
||||||
)
|
)
|
||||||
# ask how many windows should be calulated
|
# ask how many windows should be calulated
|
||||||
nwindows = int(input("How many windows should be calculated (integer number)? "))
|
nwindows = int(
|
||||||
|
input("How many windows should be calculated (integer number)? "))
|
||||||
|
|
||||||
for start_index in window_starts[:nwindows]:
|
for start_index in window_starts[:nwindows]:
|
||||||
|
|
||||||
# make t0 and dt
|
# make t0 and dt
|
||||||
t0 = start_index / data.samplerate
|
t0 = start_index / data.raw_rate
|
||||||
dt = window_duration / data.samplerate
|
dt = window_duration / data.raw_rate
|
||||||
|
|
||||||
# set index window
|
# set index window
|
||||||
stop_index = start_index + window_duration
|
stop_index = start_index + window_duration
|
||||||
|
|
||||||
# t0 = 3 * 60 * 60 + 6 * 60 + 43.5
|
# t0 = 3 * 60 * 60 + 6 * 60 + 43.5
|
||||||
# dt = 60
|
# dt = 60
|
||||||
# start_index = t0 * data.samplerate
|
# start_index = t0 * data.raw_rate
|
||||||
# stop_index = (t0 + dt) * data.samplerate
|
# stop_index = (t0 + dt) * data.raw_rate
|
||||||
|
|
||||||
|
# calucate frequencies in wndow
|
||||||
|
median_freq = []
|
||||||
|
track_ids = []
|
||||||
|
for i, track_id in enumerate(np.unique(data.ident[~np.isnan(data.ident)])):
|
||||||
|
window_index = np.arange(len(data.idx))[
|
||||||
|
(data.ident == track_id) & (data.time[data.idx] >= t0) & (
|
||||||
|
data.time[data.idx] <= (t0 + dt))
|
||||||
|
]
|
||||||
|
median_freq.append(np.median(data.freq[window_index]))
|
||||||
|
track_ids.append(track_id)
|
||||||
|
median_freq = np.asarray(median_freq)
|
||||||
|
track_ids = np.asarray(track_ids)
|
||||||
|
|
||||||
# iterate through all fish
|
# iterate through all fish
|
||||||
for i, track_id in enumerate(np.unique(ident[~np.isnan(ident)])[:2]):
|
for i, track_id in enumerate(np.unique(data.ident[~np.isnan(data.ident)])):
|
||||||
|
|
||||||
# get indices for time array in time window
|
print(f"Track ID: {track_id}")
|
||||||
window_index = np.arange(len(idx))[
|
|
||||||
(ident == track_id) & (time[idx] >= t0) & (
|
window_index = np.arange(len(data.idx))[
|
||||||
time[idx] <= (t0 + dt))
|
(data.ident == track_id) & (data.time[data.idx] >= t0) & (
|
||||||
|
data.time[data.idx] <= (t0 + dt))
|
||||||
]
|
]
|
||||||
|
|
||||||
# get tracked frequencies and their times
|
# get tracked frequencies and their times
|
||||||
freq_temp = freq[window_index]
|
freq_temp = data.freq[window_index]
|
||||||
powers_temp = powers[window_index, :]
|
powers_temp = data.powers[window_index, :]
|
||||||
|
|
||||||
# time_temp = time[idx[window_index]]
|
# time_temp = time[idx[window_index]]
|
||||||
track_samplerate = np.mean(1 / np.diff(time))
|
track_samplerate = np.mean(1 / np.diff(data.time))
|
||||||
expected_duration = ((t0 + dt) - t0) * track_samplerate
|
expected_duration = ((t0 + dt) - t0) * track_samplerate
|
||||||
|
|
||||||
# check if tracked data available in this window
|
# check if tracked data available in this window
|
||||||
@ -224,12 +246,78 @@ def main(datapath: str) -> None:
|
|||||||
# get best electrode
|
# get best electrode
|
||||||
best_electrodes = np.argsort(np.nanmean(
|
best_electrodes = np.argsort(np.nanmean(
|
||||||
powers_temp, axis=0))[-config.electrodes:]
|
powers_temp, axis=0))[-config.electrodes:]
|
||||||
# <------------------------------------------ Iterate through electrodes
|
|
||||||
|
# frequency where second filter filters
|
||||||
|
search_window = np.arange(np.median(freq_temp)+config.search_df_lower, np.median(
|
||||||
|
freq_temp)+config.search_df_upper, config.search_res)
|
||||||
|
|
||||||
|
# search window in boolean
|
||||||
|
search_window_bool = np.ones(len(search_window), dtype=bool)
|
||||||
|
|
||||||
|
# get tracks that fall into search window
|
||||||
|
check_track_ids = track_ids[(median_freq > search_window[0]) & (
|
||||||
|
median_freq < search_window[-1])]
|
||||||
|
|
||||||
|
# iterate through theses tracks
|
||||||
|
if check_track_ids.size != 0:
|
||||||
|
|
||||||
|
for j, check_track_id in enumerate(check_track_ids):
|
||||||
|
|
||||||
|
q1, q2 = np.percentile(
|
||||||
|
data.freq[data.ident == check_track_id], config.search_freq_percentiles)
|
||||||
|
|
||||||
|
search_window_bool[(search_window > q1) & (
|
||||||
|
search_window < q2)] = False
|
||||||
|
|
||||||
|
# find gaps in search window
|
||||||
|
search_window_indices = np.arange(len(search_window))
|
||||||
|
|
||||||
|
# get search window gaps
|
||||||
|
search_window_gaps = np.diff(search_window_bool, append=np.nan)
|
||||||
|
nonzeros = search_window_gaps[np.nonzero(
|
||||||
|
search_window_gaps)[0]]
|
||||||
|
nonzeros = nonzeros[~np.isnan(nonzeros)]
|
||||||
|
|
||||||
|
# if the first value is -1, the array starst with true, so a gap
|
||||||
|
if nonzeros[0] == -1:
|
||||||
|
stops = search_window_indices[search_window_gaps == -1]
|
||||||
|
starts = np.append(
|
||||||
|
0, search_window_indices[search_window_gaps == 1])
|
||||||
|
|
||||||
|
# if the last value is -1, the array ends with true, so a gap
|
||||||
|
if nonzeros[-1] == 1:
|
||||||
|
stops = np.append(
|
||||||
|
search_window_indices[search_window_gaps == -1], len(search_window) - 1)
|
||||||
|
|
||||||
|
# else it starts with false, so no gap
|
||||||
|
if nonzeros[0] == 1:
|
||||||
|
stops = search_window_indices[search_window_gaps == -1]
|
||||||
|
starts = search_window_indices[search_window_gaps == 1]
|
||||||
|
|
||||||
|
# if the last value is -1, the array ends with true, so a gap
|
||||||
|
if nonzeros[-1] == 1:
|
||||||
|
stops = np.append(
|
||||||
|
search_window_indices[search_window_gaps == -1], len(search_window))
|
||||||
|
|
||||||
|
# get the frequency ranges of the gaps
|
||||||
|
search_windows = [search_window[x:y]
|
||||||
|
for x, y in zip(starts, stops)]
|
||||||
|
search_windows_lens = [len(x) for x in search_windows]
|
||||||
|
longest_search_window = search_windows[np.argmax(
|
||||||
|
search_windows_lens)]
|
||||||
|
|
||||||
|
search_freq = (
|
||||||
|
longest_search_window[1] - longest_search_window[0]) / 2
|
||||||
|
|
||||||
|
else:
|
||||||
|
search_freq = config.default_search_freq
|
||||||
|
|
||||||
|
print(f"Search frequency: {search_freq}")
|
||||||
|
|
||||||
for i, electrode in enumerate(best_electrodes):
|
for i, electrode in enumerate(best_electrodes):
|
||||||
|
|
||||||
# load region of interest of raw data file
|
# load region of interest of raw data file
|
||||||
data_oi = data[start_index:stop_index, :]
|
data_oi = data.raw[start_index:stop_index, :]
|
||||||
time_oi = raw_time[start_index:stop_index]
|
time_oi = raw_time[start_index:stop_index]
|
||||||
|
|
||||||
# plot wavetracker tracks to spectrogram
|
# plot wavetracker tracks to spectrogram
|
||||||
@ -251,61 +339,58 @@ def main(datapath: str) -> None:
|
|||||||
|
|
||||||
# track_id = ids
|
# track_id = ids
|
||||||
|
|
||||||
# frequency where second filter filters
|
|
||||||
search_freq = 50
|
|
||||||
|
|
||||||
# filter baseline and above
|
# filter baseline and above
|
||||||
baseline, search = double_bandpass(
|
baseline, search = double_bandpass(
|
||||||
data_oi[:, electrode], data.samplerate, freq_temp, search_freq
|
data_oi[:, electrode], data.raw_rate, freq_temp, search_freq
|
||||||
)
|
)
|
||||||
|
|
||||||
# compute instantaneous frequency on broad signal
|
# compute instantaneous frequency on broad signal
|
||||||
broad_baseline = bandpass_filter(
|
broad_baseline = bandpass_filter(
|
||||||
data_oi[:, electrode],
|
data_oi[:, electrode],
|
||||||
data.samplerate,
|
data.raw_rate,
|
||||||
lowf=np.mean(freq_temp)-5,
|
lowf=np.mean(freq_temp)-5,
|
||||||
highf=np.mean(freq_temp)+100
|
highf=np.mean(freq_temp)+100
|
||||||
)
|
)
|
||||||
|
|
||||||
# compute instantaneous frequency on narrow signal
|
# compute instantaneous frequency on narrow signal
|
||||||
baseline_freq_time, baseline_freq = instantaneos_frequency(
|
baseline_freq_time, baseline_freq = instantaneos_frequency(
|
||||||
baseline, data.samplerate
|
baseline, data.raw_rate
|
||||||
)
|
)
|
||||||
|
|
||||||
# compute envelopes
|
# compute envelopes
|
||||||
baseline_envelope = envelope(
|
baseline_envelope_unfiltered = envelope(
|
||||||
baseline, data.samplerate, config.envelope_cutoff)
|
baseline, data.raw_rate, config.envelope_cutoff)
|
||||||
search_envelope = envelope(
|
search_envelope = envelope(
|
||||||
search, data.samplerate, 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.samplerate,
|
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.samplerate,
|
# data.raw_rate,
|
||||||
# config.envelope_highpass_cutoff
|
# config.envelope_highpass_cutoff
|
||||||
# )
|
# )
|
||||||
|
|
||||||
# envelopes of filtered envelope of filtered baseline
|
# envelopes of filtered envelope of filtered baseline
|
||||||
baseline_envelope = envelope(
|
baseline_envelope = envelope(
|
||||||
np.abs(baseline_envelope),
|
np.abs(baseline_envelope),
|
||||||
data.samplerate,
|
data.raw_rate,
|
||||||
config.envelope_envelope_cutoff
|
config.envelope_envelope_cutoff
|
||||||
)
|
)
|
||||||
|
|
||||||
# search_envelope = bandpass_filter(
|
# search_envelope = bandpass_filter(
|
||||||
# search_envelope, data.samplerate, lowf=lowf, highf=highf)
|
# search_envelope, data.raw_rate, lowf=lowf, highf=highf)
|
||||||
|
|
||||||
# bandpass filter the instantaneous
|
# bandpass filter the instantaneous
|
||||||
inst_freq_filtered = bandpass_filter(
|
inst_freq_filtered = bandpass_filter(
|
||||||
baseline_freq,
|
baseline_freq,
|
||||||
data.samplerate,
|
data.raw_rate,
|
||||||
lowf=config.instantaneous_lowf,
|
lowf=config.instantaneous_lowf,
|
||||||
highf=config.instantaneous_highf
|
highf=config.instantaneous_highf
|
||||||
)
|
)
|
||||||
@ -321,13 +406,14 @@ 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]
|
||||||
|
|
||||||
# get inst freq valid snippet
|
# get inst freq valid snippet
|
||||||
valid_t0 = int(window_edge) / data.samplerate
|
valid_t0 = int(window_edge) / data.raw_rate
|
||||||
valid_t1 = baseline_freq_time[-1] - \
|
valid_t1 = baseline_freq_time[-1] - \
|
||||||
(int(window_edge) / data.samplerate)
|
(int(window_edge) / data.raw_rate)
|
||||||
|
|
||||||
inst_freq_filtered = inst_freq_filtered[(baseline_freq_time >= valid_t0) & (
|
inst_freq_filtered = inst_freq_filtered[(baseline_freq_time >= valid_t0) & (
|
||||||
baseline_freq_time <= valid_t1)]
|
baseline_freq_time <= valid_t1)]
|
||||||
@ -344,7 +430,13 @@ def main(datapath: str) -> None:
|
|||||||
broad_baseline = broad_baseline[valid]
|
broad_baseline = broad_baseline[valid]
|
||||||
search = search[valid]
|
search = search[valid]
|
||||||
|
|
||||||
# PEAK DETECTION --------------------------------------------------
|
# NORMALIZE ----------------------------------------------------
|
||||||
|
|
||||||
|
baseline_envelope = normalize([baseline_envelope])[0]
|
||||||
|
search_envelope = normalize([search_envelope])[0]
|
||||||
|
inst_freq_filtered = normalize([inst_freq_filtered])[0]
|
||||||
|
|
||||||
|
# PEAK DETECTION -----------------------------------------------
|
||||||
|
|
||||||
# detect peaks baseline_enelope
|
# detect peaks baseline_enelope
|
||||||
prominence = np.percentile(
|
prominence = np.percentile(
|
||||||
@ -368,27 +460,26 @@ def main(datapath: str) -> None:
|
|||||||
|
|
||||||
# plot spectrogram
|
# plot spectrogram
|
||||||
plot_spectrogram(
|
plot_spectrogram(
|
||||||
axs[0, i], data_oi[:, electrode], data.samplerate, t0)
|
axs[0, i], data_oi[:, electrode], data.raw_rate, t0)
|
||||||
|
|
||||||
# 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
|
||||||
@ -398,7 +489,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
|
||||||
@ -406,7 +497,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
|
||||||
@ -414,7 +505,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
|
||||||
@ -422,7 +513,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: 3
|
||||||
|
|
||||||
# Cutoff frequency for envelope of envelope
|
# Cutoff frequency for envelope of envelope
|
||||||
envelope_envelope_cutoff: 5
|
envelope_envelope_cutoff: 5
|
||||||
@ -31,3 +31,12 @@ search_prominence_percentile: 75
|
|||||||
# Instantaneous frequency peak detection parameters
|
# Instantaneous frequency peak detection parameters
|
||||||
instantaneous_prominence_percentile: 90
|
instantaneous_prominence_percentile: 90
|
||||||
|
|
||||||
|
# search freq parameter
|
||||||
|
search_df_lower: 25
|
||||||
|
search_df_upper: 100
|
||||||
|
search_res: 1
|
||||||
|
search_freq_percentiles:
|
||||||
|
- 5
|
||||||
|
- 95
|
||||||
|
default_search_freq: 50
|
||||||
|
|
||||||
|
@ -37,12 +37,13 @@ class LoadData:
|
|||||||
|
|
||||||
# load raw data
|
# load raw data
|
||||||
self.file = os.path.join(datapath, "traces-grid1.raw")
|
self.file = os.path.join(datapath, "traces-grid1.raw")
|
||||||
self.data = DataLoader(self.file, 60.0, 0, channel=-1)
|
self.raw = DataLoader(self.file, 60.0, 0, channel=-1)
|
||||||
self.samplerate = self.data.samplerate
|
self.raw_rate = self.raw.samplerate
|
||||||
|
|
||||||
# load wavetracker files
|
# load wavetracker files
|
||||||
self.time = np.load(datapath + "times.npy", allow_pickle=True)
|
self.time = np.load(datapath + "times.npy", allow_pickle=True)
|
||||||
self.freq = np.load(datapath + "fund_v.npy", allow_pickle=True)
|
self.freq = np.load(datapath + "fund_v.npy", allow_pickle=True)
|
||||||
|
self.powers = np.load(datapath + "sign_v.npy", allow_pickle=True)
|
||||||
self.idx = np.load(datapath + "idx_v.npy", allow_pickle=True)
|
self.idx = np.load(datapath + "idx_v.npy", allow_pickle=True)
|
||||||
self.ident = np.load(datapath + "ident_v.npy", allow_pickle=True)
|
self.ident = np.load(datapath + "ident_v.npy", allow_pickle=True)
|
||||||
self.ids = np.unique(self.ident[~np.isnan(self.ident)])
|
self.ids = np.unique(self.ident[~np.isnan(self.ident)])
|
||||||
|
368
code/modules/plotstyle.py
Normal file
368
code/modules/plotstyle.py
Normal file
@ -0,0 +1,368 @@
|
|||||||
|
import cmocean as cmo
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
from cycler import cycler
|
||||||
|
from matplotlib.colors import ListedColormap
|
||||||
|
|
||||||
|
|
||||||
|
def PlotStyle() -> None:
|
||||||
|
class style:
|
||||||
|
|
||||||
|
# lightcmap = cmocean.tools.lighten(cmocean.cm.haline, 0.8)
|
||||||
|
|
||||||
|
# units
|
||||||
|
cm = 1 / 2.54
|
||||||
|
mm = 1 / 25.4
|
||||||
|
|
||||||
|
# colors
|
||||||
|
black = "#111116"
|
||||||
|
white = "#e0e4f7"
|
||||||
|
gray = "#6c6e7d"
|
||||||
|
blue = "#89b4fa"
|
||||||
|
sapphire = "#74c7ec"
|
||||||
|
sky = "#89dceb"
|
||||||
|
teal = "#94e2d5"
|
||||||
|
green = "#a6e3a1"
|
||||||
|
yellow = "#f9e2af"
|
||||||
|
orange = "#fab387"
|
||||||
|
maroon = "#eba0ac"
|
||||||
|
red = "#f38ba8"
|
||||||
|
purple = "#cba6f7"
|
||||||
|
pink = "#f5c2e7"
|
||||||
|
lavender = "#b4befe"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def lims(cls, track1, track2):
|
||||||
|
"""Helper function to get frequency y axis limits from two fundamental frequency tracks.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
track1 (array): First track
|
||||||
|
track2 (array): Second track
|
||||||
|
start (int): Index for first value to be plotted
|
||||||
|
stop (int): Index for second value to be plotted
|
||||||
|
padding (int): Padding for the upper and lower limit
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
lower (float): lower limit
|
||||||
|
upper (float): upper limit
|
||||||
|
|
||||||
|
"""
|
||||||
|
allfunds_tmp = (
|
||||||
|
np.concatenate(
|
||||||
|
[
|
||||||
|
track1,
|
||||||
|
track2,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
.ravel()
|
||||||
|
.tolist()
|
||||||
|
)
|
||||||
|
lower = np.min(allfunds_tmp)
|
||||||
|
upper = np.max(allfunds_tmp)
|
||||||
|
return lower, upper
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def circled_annotation(cls, text, axis, xpos, ypos, padding=0.25):
|
||||||
|
axis.text(
|
||||||
|
xpos,
|
||||||
|
ypos,
|
||||||
|
text,
|
||||||
|
ha="center",
|
||||||
|
va="center",
|
||||||
|
zorder=1000,
|
||||||
|
bbox=dict(
|
||||||
|
boxstyle=f"circle, pad={padding}", fc="white", ec="black", lw=1
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def fade_cmap(cls, cmap):
|
||||||
|
|
||||||
|
my_cmap = cmap(np.arange(cmap.N))
|
||||||
|
my_cmap[:, -1] = np.linspace(0, 1, cmap.N)
|
||||||
|
my_cmap = ListedColormap(my_cmap)
|
||||||
|
|
||||||
|
return my_cmap
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def hide_ax(cls, ax):
|
||||||
|
ax.xaxis.set_visible(False)
|
||||||
|
plt.setp(ax.spines.values(), visible=False)
|
||||||
|
ax.tick_params(left=False, labelleft=False)
|
||||||
|
ax.patch.set_visible(False)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def set_boxplot_color(cls, bp, color):
|
||||||
|
plt.setp(bp["boxes"], color=color)
|
||||||
|
plt.setp(bp["whiskers"], color=color)
|
||||||
|
plt.setp(bp["caps"], color=color)
|
||||||
|
plt.setp(bp["medians"], color=color)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def label_subplots(cls, labels, axes, fig):
|
||||||
|
for axis, label in zip(axes, labels):
|
||||||
|
X = axis.get_position().x0
|
||||||
|
Y = axis.get_position().y1
|
||||||
|
fig.text(X, Y, label, weight="bold")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def letter_subplots(
|
||||||
|
cls, axes=None, letters=None, xoffset=-0.1, yoffset=1.0, **kwargs
|
||||||
|
):
|
||||||
|
"""Add letters to the corners of subplots (panels). By default each axis is
|
||||||
|
given an uppercase bold letter label placed in the upper-left corner.
|
||||||
|
Args
|
||||||
|
axes : list of pyplot ax objects. default plt.gcf().axes.
|
||||||
|
letters : list of strings to use as labels, default ["A", "B", "C", ...]
|
||||||
|
xoffset, yoffset : positions of each label relative to plot frame
|
||||||
|
(default -0.1,1.0 = upper left margin). Can also be a list of
|
||||||
|
offsets, in which case it should be the same length as the number of
|
||||||
|
axes.
|
||||||
|
Other keyword arguments will be passed to annotate() when panel letters
|
||||||
|
are added.
|
||||||
|
Returns:
|
||||||
|
list of strings for each label added to the axes
|
||||||
|
Examples:
|
||||||
|
Defaults:
|
||||||
|
>>> fig, axes = plt.subplots(1,3)
|
||||||
|
>>> letter_subplots() # boldfaced A, B, C
|
||||||
|
|
||||||
|
Common labeling schemes inferred from the first letter:
|
||||||
|
>>> fig, axes = plt.subplots(1,4)
|
||||||
|
# panels labeled (a), (b), (c), (d)
|
||||||
|
>>> letter_subplots(letters='(a)')
|
||||||
|
Fully custom lettering:
|
||||||
|
>>> fig, axes = plt.subplots(2,1)
|
||||||
|
>>> letter_subplots(axes, letters=['(a.1)', '(b.2)'], fontweight='normal')
|
||||||
|
Per-axis offsets:
|
||||||
|
>>> fig, axes = plt.subplots(1,2)
|
||||||
|
>>> letter_subplots(axes, xoffset=[-0.1, -0.15])
|
||||||
|
|
||||||
|
Matrix of axes:
|
||||||
|
>>> fig, axes = plt.subplots(2,2, sharex=True, sharey=True)
|
||||||
|
# fig.axes is a list when axes is a 2x2 matrix
|
||||||
|
>>> letter_subplots(fig.axes)
|
||||||
|
"""
|
||||||
|
|
||||||
|
# get axes:
|
||||||
|
if axes is None:
|
||||||
|
axes = plt.gcf().axes
|
||||||
|
# handle single axes:
|
||||||
|
try:
|
||||||
|
iter(axes)
|
||||||
|
except TypeError:
|
||||||
|
axes = [axes]
|
||||||
|
|
||||||
|
# set up letter defaults (and corresponding fontweight):
|
||||||
|
fontweight = "bold"
|
||||||
|
ulets = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"[: len(axes)])
|
||||||
|
llets = list("abcdefghijklmnopqrstuvwxyz"[: len(axes)])
|
||||||
|
if letters is None or letters == "A":
|
||||||
|
letters = ulets
|
||||||
|
elif letters == "(a)":
|
||||||
|
letters = ["({})".format(lett) for lett in llets]
|
||||||
|
fontweight = "normal"
|
||||||
|
elif letters == "(A)":
|
||||||
|
letters = ["({})".format(lett) for lett in ulets]
|
||||||
|
fontweight = "normal"
|
||||||
|
elif letters in ("lower", "lowercase", "a"):
|
||||||
|
letters = llets
|
||||||
|
|
||||||
|
# make sure there are x and y offsets for each ax in axes:
|
||||||
|
if isinstance(xoffset, (int, float)):
|
||||||
|
xoffset = [xoffset] * len(axes)
|
||||||
|
else:
|
||||||
|
assert len(xoffset) == len(axes)
|
||||||
|
if isinstance(yoffset, (int, float)):
|
||||||
|
yoffset = [yoffset] * len(axes)
|
||||||
|
else:
|
||||||
|
assert len(yoffset) == len(axes)
|
||||||
|
|
||||||
|
# defaults for annotate (kwargs is second so it can overwrite these defaults):
|
||||||
|
my_defaults = dict(
|
||||||
|
fontweight=fontweight,
|
||||||
|
fontsize="large",
|
||||||
|
ha="center",
|
||||||
|
va="center",
|
||||||
|
xycoords="axes fraction",
|
||||||
|
annotation_clip=False,
|
||||||
|
)
|
||||||
|
kwargs = dict(list(my_defaults.items()) + list(kwargs.items()))
|
||||||
|
|
||||||
|
list_txts = []
|
||||||
|
for ax, lbl, xoff, yoff in zip(axes, letters, xoffset, yoffset):
|
||||||
|
t = ax.annotate(lbl, xy=(xoff, yoff), **kwargs)
|
||||||
|
list_txts.append(t)
|
||||||
|
return list_txts
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
# rcparams text setup
|
||||||
|
SMALL_SIZE = 12
|
||||||
|
MEDIUM_SIZE = 14
|
||||||
|
BIGGER_SIZE = 16
|
||||||
|
black = "#111116"
|
||||||
|
white = "#e0e4f7"
|
||||||
|
gray = "#6c6e7d"
|
||||||
|
dark_gray = "#2a2a32"
|
||||||
|
|
||||||
|
# rcparams
|
||||||
|
plt.rc("font", size=MEDIUM_SIZE) # controls default text sizes
|
||||||
|
plt.rc("axes", titlesize=MEDIUM_SIZE) # fontsize of the axes title
|
||||||
|
plt.rc("axes", labelsize=MEDIUM_SIZE) # fontsize of the x and y labels
|
||||||
|
plt.rc("xtick", labelsize=SMALL_SIZE) # fontsize of the tick labels
|
||||||
|
plt.rc("ytick", labelsize=SMALL_SIZE) # fontsize of the tick labels
|
||||||
|
plt.rc("legend", fontsize=SMALL_SIZE) # legend fontsize
|
||||||
|
plt.rc("figure", titlesize=BIGGER_SIZE) # fontsize of the figure title
|
||||||
|
|
||||||
|
plt.rcParams["image.cmap"] = 'cmo.haline'
|
||||||
|
# plt.rcParams["axes.xmargin"] = 0.1
|
||||||
|
# plt.rcParams["axes.ymargin"] = 0.15
|
||||||
|
plt.rcParams["axes.titlelocation"] = "left"
|
||||||
|
plt.rcParams["axes.titlesize"] = BIGGER_SIZE
|
||||||
|
# plt.rcParams["axes.titlepad"] = -10
|
||||||
|
plt.rcParams["legend.frameon"] = False
|
||||||
|
plt.rcParams["legend.loc"] = "best"
|
||||||
|
plt.rcParams["legend.borderpad"] = 0.4
|
||||||
|
plt.rcParams["legend.facecolor"] = black
|
||||||
|
plt.rcParams["legend.edgecolor"] = black
|
||||||
|
plt.rcParams["legend.framealpha"] = 0.7
|
||||||
|
plt.rcParams["legend.borderaxespad"] = 0.5
|
||||||
|
plt.rcParams["legend.fancybox"] = False
|
||||||
|
|
||||||
|
# specify the custom font to use
|
||||||
|
plt.rcParams["font.family"] = "sans-serif"
|
||||||
|
plt.rcParams["font.sans-serif"] = "Helvetica Now Text"
|
||||||
|
|
||||||
|
# dark mode modifications
|
||||||
|
plt.rcParams["boxplot.flierprops.color"] = white
|
||||||
|
plt.rcParams["boxplot.flierprops.markeredgecolor"] = gray
|
||||||
|
plt.rcParams["boxplot.boxprops.color"] = gray
|
||||||
|
plt.rcParams["boxplot.whiskerprops.color"] = gray
|
||||||
|
plt.rcParams["boxplot.capprops.color"] = gray
|
||||||
|
plt.rcParams["boxplot.medianprops.color"] = gray
|
||||||
|
plt.rcParams["text.color"] = white
|
||||||
|
plt.rcParams["axes.facecolor"] = black # axes background color
|
||||||
|
plt.rcParams["axes.edgecolor"] = gray # axes edge color
|
||||||
|
# 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.labelcolor"] = white
|
||||||
|
plt.rcParams["axes.axisbelow"] = True # draw axis gridlines and ticks:
|
||||||
|
plt.rcParams["axes.spines.left"] = True # display axis spines
|
||||||
|
plt.rcParams["axes.spines.bottom"] = True
|
||||||
|
plt.rcParams["axes.spines.top"] = False
|
||||||
|
plt.rcParams["axes.spines.right"] = False
|
||||||
|
plt.rcParams["axes.prop_cycle"] = cycler(
|
||||||
|
'color', [
|
||||||
|
'#b4befe',
|
||||||
|
'#89b4fa',
|
||||||
|
'#74c7ec',
|
||||||
|
'#89dceb',
|
||||||
|
'#94e2d5',
|
||||||
|
'#a6e3a1',
|
||||||
|
'#f9e2af',
|
||||||
|
'#fab387',
|
||||||
|
'#eba0ac',
|
||||||
|
'#f38ba8',
|
||||||
|
'#cba6f7',
|
||||||
|
'#f5c2e7',
|
||||||
|
])
|
||||||
|
plt.rcParams["xtick.color"] = gray # color of the ticks
|
||||||
|
plt.rcParams["ytick.color"] = gray # color of the ticks
|
||||||
|
plt.rcParams["grid.color"] = dark_gray # grid color
|
||||||
|
plt.rcParams["figure.facecolor"] = black # figure face color
|
||||||
|
plt.rcParams["figure.edgecolor"] = "#555169" # figure edge color
|
||||||
|
plt.rcParams["savefig.facecolor"] = black # figure face color when saving
|
||||||
|
|
||||||
|
return style
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
s = PlotStyle()
|
||||||
|
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import matplotlib.cm as cm
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import matplotlib.cbook as cbook
|
||||||
|
from matplotlib.path import Path
|
||||||
|
from matplotlib.patches import PathPatch
|
||||||
|
|
||||||
|
# Fixing random state for reproducibility
|
||||||
|
np.random.seed(19680801)
|
||||||
|
|
||||||
|
delta = 0.025
|
||||||
|
x = y = np.arange(-3.0, 3.0, delta)
|
||||||
|
X, Y = np.meshgrid(x, y)
|
||||||
|
Z1 = np.exp(-X**2 - Y**2)
|
||||||
|
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
|
||||||
|
Z = (Z1 - Z2) * 2
|
||||||
|
|
||||||
|
fig1, ax = plt.subplots()
|
||||||
|
im = ax.imshow(Z, interpolation='bilinear', cmap=cm.RdYlGn,
|
||||||
|
origin='lower', extent=[-3, 3, -3, 3],
|
||||||
|
vmax=abs(Z).max(), vmin=-abs(Z).max())
|
||||||
|
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
fig, axs = plt.subplots(nrows=1, ncols=2, figsize=(9, 4))
|
||||||
|
|
||||||
|
# Fixing random state for reproducibility
|
||||||
|
np.random.seed(19680801)
|
||||||
|
|
||||||
|
# generate some random test data
|
||||||
|
all_data = [np.random.normal(0, std, 100) for std in range(6, 10)]
|
||||||
|
|
||||||
|
# plot violin plot
|
||||||
|
axs[0].violinplot(all_data,
|
||||||
|
showmeans=False,
|
||||||
|
showmedians=True)
|
||||||
|
axs[0].set_title('Violin plot')
|
||||||
|
|
||||||
|
# plot box plot
|
||||||
|
axs[1].boxplot(all_data)
|
||||||
|
axs[1].set_title('Box plot')
|
||||||
|
|
||||||
|
# adding horizontal grid lines
|
||||||
|
for ax in axs:
|
||||||
|
ax.yaxis.grid(True)
|
||||||
|
ax.set_xticks([y + 1 for y in range(len(all_data))],
|
||||||
|
labels=['x1', 'x2', 'x3', 'x4'])
|
||||||
|
ax.set_xlabel('Four separate samples')
|
||||||
|
ax.set_ylabel('Observed values')
|
||||||
|
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
# Fixing random state for reproducibility
|
||||||
|
np.random.seed(19680801)
|
||||||
|
|
||||||
|
# Compute pie slices
|
||||||
|
N = 20
|
||||||
|
theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False)
|
||||||
|
radii = 10 * np.random.rand(N)
|
||||||
|
width = np.pi / 4 * np.random.rand(N)
|
||||||
|
colors = cmo.cm.haline(radii / 10.)
|
||||||
|
|
||||||
|
ax = plt.subplot(projection='polar')
|
||||||
|
ax.bar(theta, radii, width=width, bottom=0.0, color=colors, alpha=0.5)
|
||||||
|
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
methods = [None, 'none', 'nearest', 'bilinear', 'bicubic', 'spline16',
|
||||||
|
'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
|
||||||
|
'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos']
|
||||||
|
|
||||||
|
# Fixing random state for reproducibility
|
||||||
|
np.random.seed(19680801)
|
||||||
|
|
||||||
|
grid = np.random.rand(4, 4)
|
||||||
|
|
||||||
|
fig, axs = plt.subplots(nrows=3, ncols=6, figsize=(9, 6),
|
||||||
|
subplot_kw={'xticks': [], 'yticks': []})
|
||||||
|
|
||||||
|
for ax, interp_method in zip(axs.flat, methods):
|
||||||
|
ax.imshow(grid, interpolation=interp_method)
|
||||||
|
ax.set_title(str(interp_method))
|
||||||
|
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.show()
|
BIN
poster/main.pdf
Normal file
BIN
poster/main.pdf
Normal file
Binary file not shown.
83
poster/main.tex
Normal file
83
poster/main.tex
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
\documentclass[25pt, a0paper, landscape, margin=0mm, innermargin=20mm,
|
||||||
|
blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default values for poster format options.
|
||||||
|
|
||||||
|
\input{packages}
|
||||||
|
\input{style}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\renewcommand{\baselinestretch}{1}
|
||||||
|
\title{\parbox{1900pt}{A dark template to make colorful figures pop}}
|
||||||
|
\author{Sina Prause, Alexander Wendt, Patrick Weygoldt}
|
||||||
|
\institute{Supervised by Till Raab \& Jan Benda}
|
||||||
|
\usetitlestyle[]{sampletitle}
|
||||||
|
\maketitle
|
||||||
|
\renewcommand{\baselinestretch}{1.4}
|
||||||
|
|
||||||
|
\begin{columns}
|
||||||
|
\column{0.3}
|
||||||
|
\myblock[TranspBlock]{Introduction}{
|
||||||
|
\lipsum[1][1-5]
|
||||||
|
\begin{tikzfigure}[]
|
||||||
|
\label{griddrawing}
|
||||||
|
\includegraphics[width=\linewidth]{example-image-a}
|
||||||
|
\end{tikzfigure}
|
||||||
|
}
|
||||||
|
|
||||||
|
\myblock[TranspBlock]{Methods}{
|
||||||
|
\begin{tikzfigure}[]
|
||||||
|
\label{detector}
|
||||||
|
\includegraphics[width=\linewidth]{example-image-b}
|
||||||
|
\end{tikzfigure}
|
||||||
|
}
|
||||||
|
|
||||||
|
\column{0.4}
|
||||||
|
\myblock[TranspBlock]{Results}{
|
||||||
|
\lipsum[3][1-5]
|
||||||
|
\begin{tikzfigure}[]
|
||||||
|
\label{modulations}
|
||||||
|
\includegraphics[width=\linewidth]{example-image-c}
|
||||||
|
\end{tikzfigure}
|
||||||
|
}
|
||||||
|
|
||||||
|
\myblock[TranspBlock]{More Stuff}{
|
||||||
|
\lipsum[3][1-9]
|
||||||
|
}
|
||||||
|
|
||||||
|
\column{0.3}
|
||||||
|
\myblock[TranspBlock]{More Results}{
|
||||||
|
\begin{tikzfigure}[]
|
||||||
|
\label{results}
|
||||||
|
\includegraphics[width=\linewidth]{example-image-a}
|
||||||
|
\end{tikzfigure}
|
||||||
|
|
||||||
|
\begin{multicols}{2}
|
||||||
|
\lipsum[5][1-8]
|
||||||
|
\end{multicols}
|
||||||
|
\vspace{-1cm}
|
||||||
|
}
|
||||||
|
|
||||||
|
\myblock[TranspBlock]{Conclusion}{
|
||||||
|
\begin{itemize}
|
||||||
|
\setlength\itemsep{0.5em}
|
||||||
|
\item \lipsum[1][1]
|
||||||
|
\item \lipsum[1][1]
|
||||||
|
\item \lipsum[1][1]
|
||||||
|
\end{itemize}
|
||||||
|
\vspace{0.2cm}
|
||||||
|
}
|
||||||
|
\end{columns}
|
||||||
|
|
||||||
|
\node[
|
||||||
|
above right,
|
||||||
|
text=white,
|
||||||
|
outer sep=45pt,
|
||||||
|
minimum width=\paperwidth,
|
||||||
|
align=center,
|
||||||
|
draw,
|
||||||
|
fill=boxes,
|
||||||
|
color=boxes,
|
||||||
|
] at (-0.51\paperwidth,-43.5) {
|
||||||
|
\textcolor{text}{\normalsize Contact: name.surname@student.uni-tuebingen.de}};
|
||||||
|
|
||||||
|
\end{document}
|
11
poster/packages.tex
Normal file
11
poster/packages.tex
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
\usepackage[scaled]{helvet}
|
||||||
|
\renewcommand\familydefault{\sfdefault}
|
||||||
|
\usepackage[T1]{fontenc}
|
||||||
|
\usepackage{wrapfig}
|
||||||
|
\usepackage{setspace}
|
||||||
|
\usepackage{multicol}
|
||||||
|
\setlength{\columnsep}{1.5cm}
|
||||||
|
\usepackage{xspace}
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usepackage{lipsum}
|
119
poster/style.tex
Normal file
119
poster/style.tex
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
\tikzposterlatexaffectionproofoff
|
||||||
|
\usetheme{Default}
|
||||||
|
|
||||||
|
\definecolor{text}{HTML}{e0e4f7}
|
||||||
|
\definecolor{background}{HTML}{111116}
|
||||||
|
\definecolor{boxes}{HTML}{2a2a32}
|
||||||
|
\definecolor{unired}{HTML}{a51e37}
|
||||||
|
|
||||||
|
\colorlet{blocktitlefgcolor}{text}
|
||||||
|
\colorlet{backgroundcolor}{background}
|
||||||
|
\colorlet{blocktitlebgcolor}{background}
|
||||||
|
\colorlet{blockbodyfgcolor}{text}
|
||||||
|
\colorlet{innerblocktitlebgcolor}{background}
|
||||||
|
\colorlet{innerblocktitlefgcolor}{text}
|
||||||
|
\colorlet{notefrcolor}{text}
|
||||||
|
\colorlet{notefgcolor}{background}
|
||||||
|
\colorlet{notebgcolor}{background}
|
||||||
|
|
||||||
|
% Title setup
|
||||||
|
\settitle{
|
||||||
|
% Rearrange the order of the minipages to e.g. center the title between the logos
|
||||||
|
\begin{minipage}[c]{0.6\paperwidth}
|
||||||
|
% \centering
|
||||||
|
\vspace{2.5cm}\hspace{1.5cm}
|
||||||
|
\color{text}{\Huge{\textbf{\@title}} \par}
|
||||||
|
\vspace*{2em}\hspace{1.5cm}
|
||||||
|
\color{text}{\LARGE \@author \par}
|
||||||
|
\vspace*{2em}\hspace{1.5cm}
|
||||||
|
\color{text}{\Large \@institute}
|
||||||
|
\vspace{2.5cm}
|
||||||
|
\end{minipage}
|
||||||
|
\begin{minipage}[c]{0.2\paperwidth}
|
||||||
|
% \centering
|
||||||
|
\vspace{1cm}\hspace{1cm}
|
||||||
|
\includegraphics[scale=1]{example-image-a}
|
||||||
|
\end{minipage}
|
||||||
|
\begin{minipage}[c]{0.2\paperwidth}
|
||||||
|
% \vspace{1cm}\hspace{1cm}
|
||||||
|
\centering
|
||||||
|
\includegraphics[scale=1]{example-image-a}
|
||||||
|
\end{minipage}}
|
||||||
|
|
||||||
|
% definie title style with background box
|
||||||
|
\definetitlestyle{sampletitle}{
|
||||||
|
width=1189mm,
|
||||||
|
roundedcorners=0,
|
||||||
|
linewidth=0pt,
|
||||||
|
innersep=15pt,
|
||||||
|
titletotopverticalspace=0mm,
|
||||||
|
titletoblockverticalspace=5pt
|
||||||
|
}{
|
||||||
|
\begin{scope}[line width=\titlelinewidth, rounded corners=\titleroundedcorners]
|
||||||
|
\draw[fill=text, color=boxes]
|
||||||
|
(\titleposleft,\titleposbottom)
|
||||||
|
rectangle
|
||||||
|
(\titleposright,\titlepostop);
|
||||||
|
\end{scope}
|
||||||
|
}
|
||||||
|
|
||||||
|
% define coustom block style for visible blocks
|
||||||
|
\defineblockstyle{GrayBlock}{
|
||||||
|
titlewidthscale=1,
|
||||||
|
bodywidthscale=1,
|
||||||
|
% titlecenter,
|
||||||
|
titleleft,
|
||||||
|
titleoffsetx=0pt,
|
||||||
|
titleoffsety=-30pt,
|
||||||
|
bodyoffsetx=0pt,
|
||||||
|
bodyoffsety=-40pt,
|
||||||
|
bodyverticalshift=0mm,
|
||||||
|
roundedcorners=25,
|
||||||
|
linewidth=1pt,
|
||||||
|
titleinnersep=20pt,
|
||||||
|
bodyinnersep=38pt
|
||||||
|
}{
|
||||||
|
\draw[rounded corners=\blockroundedcorners, inner sep=\blockbodyinnersep,
|
||||||
|
line width=\blocklinewidth, color=background,
|
||||||
|
top color=boxes, bottom color=boxes,
|
||||||
|
]
|
||||||
|
(blockbody.south west) rectangle (blockbody.north east); %
|
||||||
|
\ifBlockHasTitle%
|
||||||
|
\draw[rounded corners=\blockroundedcorners, inner sep=\blocktitleinnersep,
|
||||||
|
top color=background, bottom color=background,
|
||||||
|
line width=2, color=background, %fill=blocktitlebgcolor
|
||||||
|
]
|
||||||
|
(blocktitle.south west) rectangle (blocktitle.north east); %
|
||||||
|
\fi%
|
||||||
|
}
|
||||||
|
\newcommand\myblock[3][GrayBlock]{\useblockstyle{#1}\block{#2}{#3}\useblockstyle{Default}}
|
||||||
|
|
||||||
|
% Define blockstyle for tranparent block
|
||||||
|
\defineblockstyle{TranspBlock}{
|
||||||
|
titlewidthscale=0.99,
|
||||||
|
bodywidthscale=0.99,
|
||||||
|
titleleft,
|
||||||
|
titleoffsetx=15pt,
|
||||||
|
titleoffsety=-40pt,
|
||||||
|
bodyoffsetx=0pt,
|
||||||
|
bodyoffsety=-40pt,
|
||||||
|
bodyverticalshift=0mm,
|
||||||
|
roundedcorners=25,
|
||||||
|
linewidth=1pt,
|
||||||
|
titleinnersep=20pt,
|
||||||
|
bodyinnersep=38pt
|
||||||
|
}{
|
||||||
|
\draw[rounded corners=\blockroundedcorners, inner sep=\blockbodyinnersep,
|
||||||
|
line width=\blocklinewidth, color=background,
|
||||||
|
top color=background, bottom color=background,
|
||||||
|
]
|
||||||
|
(blockbody.south west) rectangle (blockbody.north east); %
|
||||||
|
\ifBlockHasTitle%
|
||||||
|
\draw[rounded corners=\blockroundedcorners, inner sep=\blocktitleinnersep,
|
||||||
|
top color=background, bottom color=background,
|
||||||
|
line width=2, color=background, %fill=blocktitlebgcolor
|
||||||
|
]
|
||||||
|
(blocktitle.south west) rectangle (blocktitle.north east); %
|
||||||
|
\fi%
|
||||||
|
}
|
||||||
|
\renewcommand\myblock[3][TranspBlock]{\useblockstyle{#1}\block{#2}{#3}\useblockstyle{Default}}
|
@ -99,3 +99,42 @@ stack-data==0.6.2
|
|||||||
thunderfish==1.9.10
|
thunderfish==1.9.10
|
||||||
traitlets==5.8.0
|
traitlets==5.8.0
|
||||||
wcwidth==0.2.5
|
wcwidth==0.2.5
|
||||||
|
asttokens==2.2.1
|
||||||
|
audioio==0.10.0
|
||||||
|
backcall==0.2.0
|
||||||
|
cmocean==2.0
|
||||||
|
contourpy==1.0.6
|
||||||
|
cycler==0.11.0
|
||||||
|
decorator==5.1.1
|
||||||
|
executing==1.2.0
|
||||||
|
fonttools==4.38.0
|
||||||
|
ipython==8.8.0
|
||||||
|
jedi==0.18.2
|
||||||
|
joblib==1.2.0
|
||||||
|
kiwisolver==1.4.4
|
||||||
|
matplotlib==3.6.2
|
||||||
|
matplotlib-inline==0.1.6
|
||||||
|
numpy==1.24.1
|
||||||
|
packaging==23.0
|
||||||
|
pandas==1.5.2
|
||||||
|
parso==0.8.3
|
||||||
|
pexpect==4.8.0
|
||||||
|
pickleshare==0.7.5
|
||||||
|
Pillow==9.4.0
|
||||||
|
prompt-toolkit==3.0.36
|
||||||
|
ptyprocess==0.7.0
|
||||||
|
pure-eval==0.2.2
|
||||||
|
Pygments==2.14.0
|
||||||
|
pyparsing==3.0.9
|
||||||
|
python-dateutil==2.8.2
|
||||||
|
pytz==2022.7
|
||||||
|
PyYAML==6.0
|
||||||
|
scikit-learn==1.2.0
|
||||||
|
scipy==1.10.0
|
||||||
|
six==1.16.0
|
||||||
|
sklearn==0.0.post1
|
||||||
|
stack-data==0.6.2
|
||||||
|
threadpoolctl==3.1.0
|
||||||
|
thunderfish==1.9.10
|
||||||
|
traitlets==5.8.0
|
||||||
|
wcwidth==0.2.5
|
||||||
|
Loading…
Reference in New Issue
Block a user