In [ ]:
import run_run as rr
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns

In [ ]:
def plot_data(data):
    fig, axes = plt.subplots(nrows = 4, ncols = 2, figsize=(12,8.5))
    axes = axes.flatten()
    plt.subplots_adjust(left=.15, bottom=.06, right=.95, top=.97, 
                        wspace=.17, hspace=.30)
    curr = axes[0]
    curr.set_ylabel('length')
    curr.set_title('L (V)')
    curr.plot(data['length'])
    curr = axes[1]
    curr.set_ylabel('F (V)')
    curr.set_title('Force')
    curr.plot(data['force'])
    curr = axes[2]
    curr.set_ylabel('Stim (V)')
    curr.set_title('Stimulation')
    curr.plot(data['stimulation'])
    curr = axes[3]
    curr.set_ylabel('Beam (BPM diode)')
    curr.set_title('Beam')
    curr.plot(data['beam'])
    curr = axes[4]
    curr.set_ylabel('Exposure trigger (V)')
    curr.set_title('Pilatus')
    curr.plot(data['exposure'])
    curr = axes[5]
    curr.set_title('PSD1')
    curr.plot(data['psd1'])
    curr = axes[6]
    curr.set_title('PSD2')
    curr.plot(data['psd2'])
    curr = axes[7]
    curr.set_title('PSD diff over sum')
    diff_over_sum = lambda p1, p2: np.subtract(p1, p2)/np.add(p1,p2)
    curr.plot(diff_over_sum(data['psd1'], data['psd2']))
    plt.tight_layout()
    plt.show()

def grab_and_plot():
    data = rr.grab()
    plot_data(data)
    return data

In [ ]:
%pdb

In [ ]:
run_deets = {
    "fiber_number":0,
    "mount_length":2.14,
    "exposure_delay":10,
    "fiber_offset":0.0,
    "exposure_length": 100,
    "species": 'moth',
    "trial_number":0,
    "notes": ""
}

data = rr.grab(run_deets)

In [ ]:
plot_data(data)

In [ ]:
data = grab_and_plot()

Let's try this with a refactored run_run.py


In [ ]:
import run_run

In [ ]:
run_deets = {
    "fiber_number":0,
    "mount_length":2.14,
    "exposure_delay":10,
    "fiber_offset":0.0,
    "exposure_length": 100,
    "species": 'moth',
    "trial_number":0,
    "notes": ""
}

trial_number = 0

def increase_trial_and_run(notes=''):
    run_deets["trial_number"] = run_deets["trial_number"] + 1
    run_deets["notes"] = notes
    data = run_run.grab(input_dict)

In [ ]:
pwd

In [ ]:
ls 'C:\\Users\Dave\code'