Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#prepare font
matplotlib.rc('font', **font)
#Load in the data from fil
plot_f, plot_data = fil.grab_data(f_start=f_start, f_stop=f_stop)
#Make sure waterfall plot is under 4k*4k
dec_fac_x, dec_fac_y = 1, 1
#rebinning data to plot correctly with fewer points
if plot_data.shape[0] > MAX_IMSHOW_POINTS[0]:
dec_fac_x = plot_data.shape[0] / MAX_IMSHOW_POINTS[0]
if plot_data.shape[1] > MAX_IMSHOW_POINTS[1]:
dec_fac_y = int(np.ceil(plot_data.shape[1] / MAX_IMSHOW_POINTS[1]))
plot_data = rebin(plot_data, dec_fac_x, dec_fac_y)
#fix case where frequencies are reversed by fil.grab_data() # Shane Smith PR #82
if plot_f[-1] < plot_f[0]:
plot_f = plot_f[::-1]
#determine extent of the plotting panel for imshow
extent=(plot_f[0], plot_f[-1], (fil.timestamps[-1]-fil.timestamps[0])*24.*60.*60, 0.0)
#plot and scale intensity (log vs. linear)
kwargs['cmap'] = kwargs.get('cmap', 'viridis')
kwargs['logged'] = True
if kwargs['logged'] == True:
plot_data = 10*np.log10(plot_data)
kwargs.pop('logged')
#get normalization parameters
#set up the sub-plots
n_plots = len(fil_file_list)
fig = plt.subplots(n_plots, sharex=True, sharey=True,figsize=(10, 2*n_plots))
#read in data for the first panel
fil1 = bl.Waterfall(fil_file_list[0], f_start=f_start, f_stop=f_stop)
t0 = fil1.header['tstart']
dummy, plot_data1 = fil1.grab_data()
#rebin data to plot correctly with fewer points
dec_fac_x, dec_fac_y = 1, 1
if plot_data1.shape[0] > MAX_IMSHOW_POINTS[0]:
dec_fac_x = plot_data1.shape[0] / MAX_IMSHOW_POINTS[0]
if plot_data1.shape[1] > MAX_IMSHOW_POINTS[1]:
dec_fac_y = int(np.ceil(plot_data1.shape[1] / MAX_IMSHOW_POINTS[1]))
plot_data1 = rebin(plot_data1, dec_fac_x, dec_fac_y)
#define more plot parameters
### never used: delta_f = 0.000250
mid_f = np.abs(f_start+f_stop)/2.
subplots = []
#Fill in each subplot for the full plot
for i,filename in enumerate(fil_file_list):
#identify panel
subplot = plt.subplot(n_plots,1,i+1)
subplots.append(subplot)
#read in data
fil = bl.Waterfall(filename, f_start=f_start, f_stop=f_stop)
#make plot with plot_waterfall