def plot_variances(filename):
    _, x, y, z, _, vx, vy, vz, _, _, _ = read_file(filename)
    zbins, xbins, x_variances, y_variances, z_variances = twoD_binned_energy_fluctuations(
        x, y, z, vx, vy, vz, min(z), 1, min(x), 1)

    plt.figure()
    plt.contourf(xbins, zbins, x_variances)
    plt.colorbar()
    plt.xlim(xbins[0], xbins[-1])
    plt.ylim(zbins[0], zbins[-1])
    plt.show()
Example #2
0
    xplot = plt.hexbin(x, y, C=vx, gridsize=gridsize)
    yplot = plt.hexbin(x, y, C=vy, gridsize=gridsize)
    plt.colorbar()

    xdata = xplot.get_array()
    ydata = yplot.get_array()
    for i in range(len(xdata)):
        factor = (xdata[i]**2 + ydata[i]**2)**0.5
        xdata[i] /= factor
        ydata[i] /= factor

    x, y = get_centers(xplot)

    plt.figure()
    plt.xlim([-90, 70])
    plt.ylim([70, 210])
    plt.gca().set_aspect('equal')

    plt.quiver(x,
               y,
               xdata,
               ydata,
               headwidth=3,
               headlength=2,
               headaxislength=1.5)
    plt.show()


if __name__ == '__main__':
    __, x, y, __, __, vx, vy, __, __, __, __ = read_file("../Data/q_hig_10")
    plotVelocities(x, y, vx, vy, gridsize=50)
Example #3
0
from file_reading import read_file
from mayavi import mlab
import matplotlib.pyplot as plt
import numpy as np
import hexbin

t,x,y,z,u,vx,vy,vz,uvx,uvy,uvz = read_file("../Data/h_med_5")

mlab.quiver3d(x,y,z, vx, vy, vz)
mlab.vectorbar(title="Velocity (metres per second)", orientation='Vertical', nb_labels=4)
mlab.show()
Example #4
0
    popt = fit(f,t,x, p0, names, u = u)
    
    ##################################################PLOTTING HERE############################################################
    plt.figure()
    plt.title("Angular fit")
    plt.plot(t,x, 'ro', markersize = 0.5)  #Plots the raw data
    tmodel = np.linspace(t[0], t[-1], 10000)
    plt.plot(tmodel, f(tmodel, *popt)) #Plots using the returned fit parameters

def findLinearVelocity(t,v_mag):
    mean = np.mean(v_mag)
    std = np.std(v_mag)
    print("Mean:", mean, " m/s - Standard deviation:", std, "m/s")
    

for i,filename in enumerate(filenames):
    print(filename)
    print("______________________________________")
    t,x,y,z,u,vx,vy,vz,uvx,uvy,uvz = read_file(filename)
    v_mag = magnitude(vx,vy,vz)
    print("______________Linear Speed______________")
    findLinearVelocity(t,v_mag)
    print("_______________Angular Speed_______________")
    findAngularSpeed(t,x,u, angular_p0s[i])
    print("______________________________________")



    

    window = np.ones(window_size) / window_size
    smoothed_y = np.convolve(y, window, mode='same')
    return smoothed_y


filenames = [
    "f_hig_5", "f_low_51", "f_med_5", "h_hig_5", "h_hig_10", "h_low_10",
    "h_low_51", "h_med_5", "h_med_10", "q_hig_5", "q_hig_10", "q_low_10",
    "q_low_51", "q_med_5_2", "q_med_10", "t_hig_5", "t_hig_10", "t_low_5",
    "t_low_10", "t_med_5", "t_med_10"
]

for filename in filenames:
    bead_size = 5  #Using smallest size, since even 10mm can make 5mm changes

    t, x, y, z, u, vx, vy, vz, uvx, uvy, uvz = read_file("../Data/" + filename)

    x = smooth_data(x, 10)  # Smoothing data to make peak finding better

    #Can be used to plot if wanted
    #    t = t[10000:30000]
    #    x = x[10000:30000]
    #    plt.figure()
    #    plt.plot(t,x)

    indices, properties = find_peaks(
        x, prominence=1, distance=30, width=5
    )  # Finds peaks in x, prominence main setting, distance and width settings reduce false peaks
    #    plt.plot(t[indices], x[indices] , 'ro')

    count = 0