def Time_Scatter(times, deps, xname, yname, title, fname, flags, flagnames, s=10, c='b', marker='o', figsize=[12,4]): """Make a scatter plot of some time-dependent data in lists, with arbitrary segment bars underneath. Arguments: times -- List of times to plot. deps -- List of time-dependent data values to plot xname -- String describing x-axis information yname -- String describing y-axis information flags -- A list of DQflags to plot in segment bars under the plot flagnames -- List of strings with which to label the segment bars. Use an empty string to 'skip' an entry. s -- Integer denoting plot marker size. c -- String for plot marker colour. marker -- String for plot marker shape. figsize -- Standard figsize keyword argument. Returns: None""" toplot = EventTable(data=[times, deps], masked=None, names=[xname, yname]) plot = toplot.scatter(xname, yname, s=1, c='r', marker='s', figsize=[16,6], ylabel=yname, title=title) for i in range(len(flags)): plot.add_segments_bar(flags[i], label=flagnames[i]) plot.savefig(fname, dpi=300, format='png', transparent=True) plot.close()
names=('time', 'frequency')) x = np.array(data) #Creates array of the data from the Event table t = list(column[0] for column in x) f = list(column[1] for column in x) f = np.array(f) t_f = np.vstack((t, f)).T #creates array of time and frequencies f_max_ind = scipy.signal.find_peaks(f)[ 0] #Gives an array of indicies of maximum frequences for each arch ind = list(f_max_ind) t_fmax = t_f[ind] #returns array of time and f max for each arch t = list(column[0] for column in t_fmax) f_max = list(column[1] for column in t_fmax) plot = data.scatter('time', 'frequency', figsize=(8, 4)) ax = plot.gca() ax.set_ylabel('Frequency [Hz]') plt.plot(t, f_max, 's', color='red') ax.grid(True) ax.grid(which="both", axis='y') ax.set_yscale('log') ax.set_ylim(10, 100) ax.set_xlim([args.gpsstart, gpsend]) plot.show(block=False) dt = np.ediff1d( t ) #Creates and array that contains the differences in time between consecutive arches dt = list(dt) #List the difference in time between arches n = len(dt)