width_delay_beam_experiment/analysis_script.py
def plot_noise(path_to_data, filename, save_path='.//'):
    '''
    Plots the noise data with pretty formatting.

    assumes:
    - The data is a csv file where the time and voltage data are in columns
      3 and 4, respectively.

    - save_path, if given, is a valid directory.

    arguments:
    - path_to_data(string): The absolute or relative path to the
                            folder containing the noise data file.

    - filename(string): the filename of noise data file

    - save_path(string): the path where the plot gets saved (default to current
                         working directory)

    returns:
    - nothing: simply plots and saves the plot in the directory given by
               save_path.
    '''
    # Read data, the data is in columns 3 and 4 in a comma separated file
    dat = np.genfromtxt(path_to_data+filename, delimiter=',', usecols=(3,4))

    # Assign x and y values from data
    x, y = dat[:,0], dat[:,1]

    # Initialize figure and axis objects
    fig = plt.figure(figsize = (10,8))
    ax = plt.gca()

    # Plot the the data
    ax.plot(x, y, c=color_dict['data'], label=filename.replace('_', '\_'), alpha = 0.7)

    # Begin formatting plot

    # Change xtick and ytick frequency
    for label in ax.get_xticklabels()[1::2]:
        label.set_visible(False)
    for label in ax.get_yticklabels()[1::2]:
        label.set_visible(False)

    # Adding horizontal grid lines
        ax.yaxis.grid(True)

    # Remove axis spines
    ax.spines["top"].set_visible(True)
    ax.spines["right"].set_visible(False)
    ax.spines["bottom"].set_visible(True)
    ax.spines["left"].set_visible(False)

    # Labels
    plt.xlabel('Time $[s]$', fontsize=15)
    plt.ylabel('Voltage $[V]$', fontsize=15)
    plt.legend(loc='best', fancybox=True, fontsize=15)

    # Tight layout
    plt.tight_layout()

    # Save the plot
    plt.savefig(save_path+filename.split('.')[0] + '.pdf')
    return

    Plots the noise data with pretty formatting.

    assumes:
    - The data is a csv file where the time and voltage data are in columns
      3 and 4, respectively.

    - save_path, if given, is a valid directory.

    arguments:
    - path_to_data(string): The absolute or relative path to the
                            folder containing the noise data file.

    - filename(string): the filename of noise data file

    - save_path(string): the path where the plot gets saved (default to current
                         working directory)

    returns:
    - nothing: simply plots and saves the plot in the directory given by
               save_path.
    
Plots the noise data with pretty formatting.
assumes:
The data is a csv file where the time and voltage data are in columns
3 and 4, respectively.

save_path, if given, is a valid directory.

The absolute or relative path to the
folder containing the noise data file.

the filename of noise data file

the path where the plot gets saved (default to current
working directory)

simply plots and saves the plot in the directory given by
save_path.
Plots the noise data with pretty formatting . assumes : The data is a csv file where the time and voltage data are in columns 3 and 4 respectively . save_path if given is a valid directory . The absolute or relative path to the folder containing the noise data file . the filename of noise data file the path where the plot gets saved ( default to current working directory ) simply plots and saves the plot in the directory given by save_path .
def plot_noise(path_to_data, filename, save_path='.//'):
    dat = np.genfromtxt(path_to_data+filename, delimiter=',', usecols=(3,4))
    x, y = dat[:,0], dat[:,1]
    fig = plt.figure(figsize = (10,8))
    ax = plt.gca()
    ax.plot(x, y, c=color_dict['data'], label=filename.replace('_', '\_'), alpha = 0.7)
    for label in ax.get_xticklabels()[1::2]:
        label.set_visible(False)
    for label in ax.get_yticklabels()[1::2]:
        label.set_visible(False)
        ax.yaxis.grid(True)
    ax.spines["top"].set_visible(True)
    ax.spines["right"].set_visible(False)
    ax.spines["bottom"].set_visible(True)
    ax.spines["left"].set_visible(False)
    plt.xlabel('Time $[s]$', fontsize=15)
    plt.ylabel('Voltage $[V]$', fontsize=15)
    plt.legend(loc='best', fancybox=True, fontsize=15)
    plt.tight_layout()
    plt.savefig(save_path+filename.split('.')[0] + '.pdf')
    return
def plot_noise ( path_to_data , filename , save_path = './/' ) : dat = np . genfromtxt ( path_to_data + filename , delimiter = ',' , usecols = ( 3 , 4 ) ) x , y = dat [ : , 0 ] , dat [ : , 1 ] fig = plt . figure ( figsize = ( 10 , 8 ) ) ax = plt . gca ( ) ax . plot ( x , y , c = color_dict [ 'data' ] , label = filename . replace ( '_' , '\_' ) , alpha = 0.7 ) for label in ax . get_xticklabels ( ) [ 1 : : 2 ] : label . set_visible ( False ) for label in ax . get_yticklabels ( ) [ 1 : : 2 ] : label . set_visible ( False ) ax . yaxis . grid ( True ) ax . spines [ "top" ] . set_visible ( True ) ax . spines [ "right" ] . set_visible ( False ) ax . spines [ "bottom" ] . set_visible ( True ) ax . spines [ "left" ] . set_visible ( False ) plt . xlabel ( 'Time $[s]$' , fontsize = 15 ) plt . ylabel ( 'Voltage $[V]$' , fontsize = 15 ) plt . legend ( loc = 'best' , fancybox = True , fontsize = 15 ) plt . tight_layout ( ) plt . savefig ( save_path + filename . split ( '.' ) [ 0 ] + '.pdf' ) return
Plots the noise data with pretty formatting.
Plots the noise data with pretty formatting .
'''
    Plots the noise data with pretty formatting.

    assumes:
    - The data is a csv file where the time and voltage data are in columns
      3 and 4, respectively.

    - save_path, if given, is a valid directory.

    arguments:
    - path_to_data(string): The absolute or relative path to the
                            folder containing the noise data file.

    - filename(string): the filename of noise data file

    - save_path(string): the path where the plot gets saved (default to current
                         working directory)

    returns:
    - nothing: simply plots and saves the plot in the directory given by
               save_path.
    ''' # Read data, the data is in columns 3 and 4 in a comma separated file # Assign x and y values from data # Initialize figure and axis objects # Plot the the data # Begin formatting plot # Change xtick and ytick frequency # Adding horizontal grid lines # Remove axis spines # Labels # Tight layout # Save the plot
path_to_data
filename
save_path