import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.gridspec as gridspec from IPython import embed import helper_functions as hf from params import * import os import datetime if __name__ == '__main__': ################################################################################################################### # parameter and variables # plot params inch = 2.45 save_path = '../../thesis/Figures/Results/' kernel_size = 100 fig = plt.figure(constrained_layout=True, figsize=[13 / inch, 15 / inch]) gs = gridspec.GridSpec(ncols=1, nrows=2, figure=fig, hspace=0.05, wspace=0.0, left=0.1, bottom=0.15, right=0.95, top=0.98) ax1 = fig.add_subplot(gs[0, 0]) ax2 = fig.add_subplot(gs[1, 0]) ################################################################################################################### # load all the data of one day for filename_idx in [0]: filename = sorted(os.listdir('../data/'))[filename_idx] all_max_ch_means = np.load('../data/' + filename + '/all_max_ch.npy', allow_pickle=True) all_xticks = np.load('../data/' + filename + '/all_xtickses.npy', allow_pickle=True) all_ipp = np.load('../data/' + filename + '/all_ipp.npy', allow_pickle=True) power_means = np.load('../data/' + filename + '/power_means.npy', allow_pickle=True) freq = np.load('../data/' + filename + '/fish_freq_q10.npy', allow_pickle=True) ############################################################################################################### # get fish for fish_number, ax, ax_idx in zip([5,47], [ax1,ax2], [0, 1]): if power_means[fish_number] >= -90.0: ipp = all_ipp[fish_number] x_tickses = all_xticks[fish_number] max_ch_mean = all_max_ch_means[fish_number] # smoothing of max channel mean kernel = np.ones(kernel_size) / kernel_size smooth_mcm = np.convolve(max_ch_mean, kernel, 'valid') try: smooth_x = x_tickses[int(np.ceil(kernel_size/2)):-int(np.floor(kernel_size/2))] except: embed() quit() ##################################################################################################### # plot traces ax.imshow(ipp[::20].T[::-1], vmin=-100, vmax=-50, aspect='auto', interpolation='gaussian', extent=[x_tickses[0], x_tickses[-1], -0.5, 15.5]) try: ax.plot(smooth_x[::20], smooth_mcm[::20], '.', color=color2[4]) except: continue ax.beautimechannelaxis() ax.timeaxis() ax.text(-0.12, 0.95, chr(ord('A') + ax_idx), transform=ax.transAxes, fontsize='large') fig.savefig(save_path + 'trajectory_5_47.pdf') # fig.savefig('../../../goettingen2021_poster/pictures/trajectory_5_47.pdf') plt.show()