Ejemplo n.º 1
0
def test_plot_impedance_fit(impedance_data):
    fig_actual, ax_actual = plot_impedance(impedance_data, fit=True)

    def impedance_func(f):
        return 10000 + 1 / (1j* 2*np.pi * f * 1e-9)
    theory_freqs = np.logspace(2, 4, 100)

    theory_impedance = impedance_func(theory_freqs)
    theory_phase = np.angle(theory_impedance) * 180/np.pi
    theory_mag = np.abs(theory_impedance)

    fig_desired = Figure()
    ax_desired = fig_desired.subplots()
    ax_desired.scatter(impedance_data['Frequency (Hz)'], impedance_data['Z (ohm)'], color=cmap(0))
    ax_desired.set_xscale('log')
    ax_desired.set_yscale('log')
    ax_desired.set_xlabel('Frequency (Hz)')
    ax_desired.plot(theory_freqs, theory_mag, color=cmap(0),
            linestyle='dashed')

    ax2 = ax_desired.twinx()
    ax2.scatter(impedance_data['Frequency (Hz)'], impedance_data['Theta (rad)']*180/np.pi, color=cmap(1))
    ax_desired.set_ylabel('Z (ohm)')
    ax2.set_ylabel('Phase (deg)')
    ax2.set_xlabel('Frequency (Hz)')
    ax2.plot(theory_freqs, theory_phase, color=cmap(1),
            linestyle='dashed')

    prettifyPlot(fig=fig_desired)
    ax_desired.spines['right'].set_visible(True)

#show_figure(fig_actual)

    assert_figures_equal(fig_actual, fig_desired, rtol=1e-8)
Ejemplo n.º 2
0
def test_plot_pandas_default(data):

    default_kw = {'xlabel': data['xlabel'], 'ylabel': data['ylabel']}
    desired_fig = Figure()
    desired_ax = desired_fig.subplots(subplot_kw=default_kw)
    desired_ax.plot(data['xdata'], data['ydata'])

    actual_fig, actual_ax = default_plotter(data['data'])
    assert_figures_equal(actual_fig, desired_fig)
Ejemplo n.º 3
0
def test_plot_pandas_log(data):
    desired_fig = Figure()
    log_kw= {
        'xlabel': data['xlabel'], 'ylabel': data['ylabel'],
        'xscale': 'log', 'yscale': 'log'}

    desired_ax = desired_fig.subplots(subplot_kw=log_kw)
    desired_ax.plot(data['xdata'], data['ydata'])
    actual_fig, actual_ax = default_plotter(data['data'],
            subplot_kw=log_kw)
    assert_figures_equal(actual_fig, desired_fig)
Ejemplo n.º 4
0
def test_power_spectrum_plot_psd():
    power_spectrum = pd.DataFrame({
            'Frequency (Hz)': [1, 2, 3],
            'Power (V ** 2 / Hz)': [0.1, 0.1, 0.3]})
    fig_actual, ax_actual = power_spectrum_plot(power_spectrum)
    desired_fig = Figure()
    desired_ax = desired_fig.subplots()
    desired_ax.plot([1, 2, 3], 10*np.log10(np.array([0.1, 0.1, 0.3])))
    desired_ax.set_xlabel('Frequency (Hz)')
    desired_ax.set_ylabel('Power (dBV/Hz)')
    assert_figures_equal(fig_actual, desired_fig)
Ejemplo n.º 5
0
def test_plot_lia_nofit(lia_data):
    fig_actual, ax_actual = plot_lia(lia_data, n_points=5, fit=False)

    phases_desired = np.pi*np.array([-1, -1/2, 0, 1/2, 1])
    fits_desired = 1 / np.sqrt(2) * np.array([0, -1, 0, 1, 0])

    fig_desired = Figure()
    ax_desired = fig_desired.subplots()
    ax_desired.scatter(phases_desired, fits_desired)
    ax_desired.set_xlabel('Phase (rad)')
    ax_desired.set_ylabel('val')

    assert_figures_equal(fig_actual, fig_desired, atol=1e-10)
Ejemplo n.º 6
0
def test_plot_linear_fit(impedance_data_complex):
    x_data  = np.array([0, 1, 2, 3, 4, 5])
    y_data = np.array([0, 1, 2, 3, 4, 5])
    def linear_fit(x, offset, slope):
        return offset + x * slope

    fig_actual, ax_actual = default_plotter(
            x_data, y_data,
            fit_func=linear_fit)

    fig_desired = Figure()
    ax_desired = fig_desired.subplots()
    ax_desired.plot(x_data, y_data)
    ax_desired.plot(x_data, y_data, linestyle='dashed')
    assert_figures_equal(fig_actual, fig_desired,
            rtol=1e-8, atol=1e-8)
Ejemplo n.º 7
0
def test_plot_pandas_theory(data):
    def gaussian(x, a=1, mu=0, sigma=1):
        return a*np.exp(-np.square((x - mu)/(np.sqrt(2)*sigma)))

    subplot_kw= {'xlabel': data['xlabel'], 'ylabel': data['ylabel']}
    line_kw = {'linestyle': 'dashed'}
    theory_kw = {'a': 2, 'mu': 1, 'sigma': 3}
    theory_data = gaussian(data['xdata'], a=2, mu=1, sigma=3)

    desired_fig = Figure()
    desired_ax = desired_fig.subplots(subplot_kw=subplot_kw)
    desired_ax.plot(data['xdata'], data['ydata'])
    desired_ax.plot(data['xdata'], theory_data, **line_kw)
    actual_fig, actual_ax = default_plotter(data['data'],
        theory_func=gaussian, theory_kw=theory_kw)
    assert_figures_equal(actual_fig, desired_fig)
Ejemplo n.º 8
0
def test_plot_fit_linear(linear_data):
    def linear_func(x, a, b):
        return a + b * x

    fig_actual, ax_actual = plot_fit(linear_data['data'], linear_func)

    phases_desired = np.pi*np.array([-1, -1/2, 0, 1/2, 1])
    fits_desired = 1 / np.sqrt(2) * np.array([0, -1, 0, 1, 0])

    fig_desired = Figure()
    ax_desired = fig_desired.subplots()
    ax_desired.scatter(linear_data['xdata'], linear_data['ydata'])
    ax_desired.set_xlabel(linear_data['xlabel'])
    ax_desired.set_ylabel(linear_data['ylabel'])
    ax_desired.plot(linear_data['xdata'], linear_data['ydata'], linestyle='dashed')

    assert_figures_equal(fig_actual, fig_desired, atol=1e-10)
Ejemplo n.º 9
0
def test_plot_pandas_theory_data(data):
    default_kw = {'xlabel': data['xlabel'], 'ylabel': data['ylabel']}
    desired_fig = Figure()
    desired_ax = desired_fig.subplots(subplot_kw=default_kw)
    theory_line_kw = {'linestyle': 'dashed'}
    theory_data=pd.DataFrame({
            data['xlabel']: [0, 1, 2, 3],
            data['ylabel']: [2, 3, 4, 5],
            })

    desired_ax.plot(data['xdata'], data['ydata'])
    desired_ax.plot(theory_data[data['xlabel']],
            theory_data[data['ylabel']], **theory_line_kw)
    desired_ax.set_xlim(0.9, 3.3)

    actual_fig, actual_ax = default_plotter(data['data'],
            theory_data=theory_data)
    assert_figures_equal(actual_fig, desired_fig)
Ejemplo n.º 10
0
def test_plot_weibull():
    beta_desired = beta = 2
    x0_desired = x0 = 2
    weibull_cdf = np.array([0.2, 0.4, 0.6, 0.8])
    weibull_xval = np.array([0.9447614541548776, 1.4294413227075684, 1.9144615241619822, 2.5372724823590396])

    fig_actual, ax_actual = plot_weibull(weibull_xval, subplot_kw={'xlabel': 'mC/cm^2'})

    fig_desired = Figure()
    ax_desired = fig_desired.subplots()
    ax_desired.scatter(weibull_xval, -np.log(1 - weibull_cdf))
    ax_desired.plot(weibull_xval, -np.log(1 - weibull_cdf), linestyle='dashed')
    ax_desired.set_xscale('log')
    ax_desired.set_yscale('log')
    ax_desired.set_xlabel('mC/cm^2')
    ax_desired.set_ylabel('-ln(1-F)')

    assert_figures_equal(fig_actual, fig_desired, atol=1e-8)
Ejemplo n.º 11
0
def test_reflectance_plotter():
    R_ref = pd.DataFrame({
            'Wavelength (nm)': np.arange(100, 150, 1),
            'Reflectance ()': np.linspace(0,1, 50)})
    I_ref = pd.DataFrame({
            'Wavelength (nm)': np.arange(100, 150, 5),
            'Photocurrent (nA)': np.linspace(1, 1, 10)})
    I_meas = pd.DataFrame({
            'Wavelength (nm)': np.linspace(110, 140,30),
            'Photocurrent (nA)': np.linspace(2, 2, 30)})
    R_1 = normalize_pandas(I_meas, I_ref, np.divide, new_name='R')
    R_2 = normalize_pandas(R_1, R_ref, np.multiply, new_name='R')
    fig_actual, ax_actual = reflectance_plotter(I_meas, I_ref, R_ref)
    fig_desired = Figure()
    ax_desired = fig_desired.subplots(
            subplot_kw={'ylabel': 'R', 'xlabel': 'Wavelength (nm)'})
    ax_desired.plot(R_2['Wavelength (nm)'], R_2['R'])
    assert_figures_equal(fig_actual, fig_desired)
Ejemplo n.º 12
0
def test_plot_impedance_nofit(impedance_data):
    fig_actual, ax_actual = plot_impedance(impedance_data, fit=False)

    fig_desired = Figure()
    ax_desired = fig_desired.subplots()
    ax_desired.scatter(impedance_data['Frequency (Hz)'], impedance_data['Z (ohm)'], color=cmap(0))
    ax_desired.set_xscale('log')
    ax_desired.set_yscale('log')
    ax2 = ax_desired.twinx()
    ax2.scatter(impedance_data['Frequency (Hz)'], impedance_data['Theta (rad)']*180/np.pi, color=cmap(1))
    prettifyPlot(fig=fig_desired)
    ax_desired.spines['right'].set_visible(True)

    ax_desired.set_ylabel('Z (ohm)')
    ax2.set_ylabel('Phase (deg)')
    ax2.set_xlabel('Frequency (Hz)')
    ax_desired.set_xlabel('Frequency (Hz)')

    assert_figures_equal(fig_actual, fig_desired)
Ejemplo n.º 13
0
def test_generate_plot_1var(exp, convert_name):
    names = [convert_name(name) for name in \
        [
        'TEST1~wavelength=1',
        'TEST1~wavelength=2',
        ]]
    data_dict = {
        names[0]: 1.0,
        names[1]: 2.0,
    }
    actual_figs, actual_axes = exp.plot(data_dict)
    actual_fig = actual_figs[0]
    actual_ax = actual_axes[0]
    desired_fig = Figure()
    desired_ax = desired_fig.subplots(subplot_kw={
        'xlabel': 'wavelength',
        'ylabel': 'Value'
    })
    desired_ax.plot([1, 2], [1.0, 2.0])
    prettifyPlot(fig=desired_fig, ax=desired_ax)
    assert_figures_equal(actual_fig, desired_fig)
Ejemplo n.º 14
0
def test_plot_pandas_twinx(data):
    """
    Tests that we can generate a plot with multiple axes when we pass in different y-valued data.
    """
    second_data = data['data'].copy()
    second_data['Frequency (Hz)'] *= 2
    second_data.rename(columns={'Frequency (Hz)': 'Frequency (kHz)'},
            inplace=True)

    default_kw = {'xlabel': data['xlabel'], 'ylabel': data['ylabel']}
    desired_fig = Figure()
    desired_ax = desired_fig.subplots(subplot_kw=default_kw)
    desired_ax.plot(data['xdata'], data['ydata'])
    new_ax = desired_ax.twinx()
    new_ax.plot(second_data['Time (ms)'], second_data['Frequency (kHz)'])
    new_ax.set_xlabel('Time (ms)')
    new_ax.set_ylabel('Frequency (kHz)')

    actual_fig, ax = default_plotter(data['data'])
    actual_fig, _ = default_plotter(second_data, fig=actual_fig)
    assert_figures_equal(actual_fig, desired_fig)
Ejemplo n.º 15
0
def test_generate_plot_1var_units(exp_units, convert_name):
    names = [convert_name(name) for name in \
        [
        'TEST1~wavelength=1nm',
        'TEST1~wavelength=2nm',
        ]]
    data_dict = {
        names[0]: 1.0 * ureg.nA,
        names[1]: 2.0 * ureg.nA,
    }
    actual_figs, actual_axes = exp_units.plot(data_dict)
    actual_fig = actual_figs[0]
    actual_ax = actual_axes[0]
    desired_fig = Figure()
    desired_ax = desired_fig.subplots(subplot_kw={
        'xlabel': 'wavelength (nm)',
        'ylabel': 'current (nA)'
    })
    desired_ax.plot([1, 2], [1.0, 2.0])
    prettifyPlot(fig=desired_fig, ax=desired_ax)
    assert_figures_equal(actual_fig, desired_fig)
Ejemplo n.º 16
0
def test_plot_impedance_nofit_complex(impedance_data_complex):
    fig_actual, ax_actual = plot_impedance(impedance_data_complex,
            fit=False)

    fig_desired = Figure()
    ax_desired = fig_desired.subplots()
    ax_desired.scatter(impedance_data_complex['Frequency (Hz)'],
            np.abs(impedance_data_complex['Z (ohm)']), color=cmap(0))
    ax_desired.set_xscale('log')
    ax_desired.set_yscale('log')
    ax2 = ax_desired.twinx()
    ax2.scatter(impedance_data_complex['Frequency (Hz)'],
            np.angle(impedance_data_complex['Z (ohm)'])*180/np.pi,
            color=cmap(1))
    prettifyPlot(fig=fig_desired)
    ax_desired.spines['right'].set_visible(True)

    ax_desired.set_ylabel('|Z| (ohm)')
    ax2.set_ylabel('Phase (deg)')
    ax2.set_xlabel('Frequency (Hz)')
    ax_desired.set_xlabel('Frequency (Hz)')
    assert_figures_equal(fig_actual, fig_desired, rtol=1e-8)
Ejemplo n.º 17
0
def test_generate_plot_2var(exp, convert_name):
    names = [convert_name(name) for name in \
        [
        'TEST1~wavelength=1~temperature=25.0',
        'TEST1~wavelength=2~temperature=25.0',
        'TEST1~wavelength=1~temperature=35.0',
        'TEST1~wavelength=2~temperature=35.0',
        ]]
    data_dict = {
        names[0]: 1.0,
        names[1]: 2.0,
        names[2]: 3.0,
        names[3]: 4.0,
    }
    actual_figs, actual_axes = exp.plot(data_dict)
    assert_equal(len(actual_figs), 2)
    assert_equal(len(actual_axes), 2)

    desired_fig0 = Figure()
    desired_ax0 = desired_fig0.subplots(subplot_kw={
        'xlabel': 'wavelength',
        'ylabel': 'Value'
    })
    desired_ax0.plot([1, 2], [1.0, 2.0])
    desired_ax0.plot([1, 2], [3.0, 4.0])
    prettifyPlot(fig=desired_fig0, ax=desired_ax0)

    desired_fig1 = Figure()
    desired_ax1 = desired_fig1.subplots(subplot_kw={
        'xlabel': 'temperature',
        'ylabel': 'Value'
    })
    desired_ax1.plot([25.0, 35.0], [1.0, 3.0])
    desired_ax1.plot([25.0, 35.0], [2.0, 4.0])
    prettifyPlot(fig=desired_fig1, ax=desired_ax1)

    assert_figures_equal(actual_figs[0], desired_fig0)
    assert_figures_equal(actual_figs[1], desired_fig1)
Ejemplo n.º 18
0
def test_plot_photocurrent_realistic(convert_name, sim_exp):
    """
    Verifies that, given a sinusoidal input with a known offset and amplitude, the correct data is generated.
    """
    wavelength = np.array([850, 1150]) * ureg.nm
    modulation_amplitude = ureg.V * np.array([10, 20])
    gain = 10 * ureg.Mohm
    current_offset = 100 * ureg.nA
    current_amplitude = 10 * ureg.pA
    dR_R0_ratio = current_amplitude / current_offset

    reference_condition = dict(material='Au')
    Au_data = pd.DataFrame({
        'Time (ms)':
        np.array([0, 1, 2, 3, 4]),
        'Voltage (mV)': (gain * current_offset).to(ureg.mV).m * np.ones(5),
        'Sync':
        np.array([1, 0, 0, 0, 1]),
    })
    sin_data_5V_850nm = pd.DataFrame({
            'Time (ms)': np.array([0, 1, 2, 3, 4]),
            'Voltage (mV)': \
                    0.0261059412418133/0.96400635435947* \
                    (gain*current_offset).to(ureg.mV).m + \
                (gain*current_amplitude).to(ureg.mV).m * \
                np.array([0, -1, 0, 1, 0]),
            'Sync': np.array([1, 0, 0, 0, 1]),
            })
    sin_data_5V_1150nm = pd.DataFrame({
            'Time (ms)': np.array([0, 1, 2, 3, 4]),
            'Voltage (mV)': \
                    0.283227973929987/0.975276963043909* \
                    (gain*current_offset).to(ureg.mV).m + \
                    (gain*current_amplitude).to(ureg.mV).m * \
                np.array([0, -1, 0, 1, 0]),
            'Sync': np.array([1, 0, 0, 0, 1]),
            })
    sin_data_10V_850nm = pd.DataFrame({
            'Time (ms)': np.array([0, 1, 2, 3, 4]),
            'Voltage (mV)':
                    0.0261059412418133/0.96400635435947*  \
                    (gain*current_offset).to(ureg.mV).m + \
                2 * (gain*current_amplitude).to(ureg.mV).m * \
                np.array([0, -1, 0, 1, 0]),
            'Sync': np.array([1, 0, 0, 0, 1]),
            })
    sin_data_10V_1150nm = pd.DataFrame({
            'Time (ms)': np.array([0, 1, 2, 3, 4]),
            'Voltage (mV)':
                    0.283227973929987/0.975276963043909* \
                    (gain*current_offset).to(ureg.mV).m + \
                2 * (gain*current_amplitude).to(ureg.mV).m * \
                np.array([0, -1, 0, 1, 0]),
            'Sync': np.array([1, 0, 0, 0, 1]),
            })
    test_data = {
        convert_name('TEST1~wavelength=850nm~material=Au~modulation_amplitude=0V'):
        Au_data,
        convert_name('TEST1~wavelength=1150nm~material=Au~modulation_amplitude=0V'):
        Au_data,
        convert_name('TEST1~wavelength=850nm~material=AlN~modulation_amplitude=5V'):
        sin_data_5V_850nm,
        convert_name('TEST1~wavelength=1150nm~material=AlN~modulation_amplitude=5V'):
        sin_data_5V_1150nm,
        convert_name('TEST1~wavelength=850nm~material=AlN~modulation_amplitude=10V'):
        sin_data_10V_850nm,
        convert_name('TEST1~wavelength=1150nm~material=AlN~modulation_amplitude=10V'):
        sin_data_10V_1150nm,
    }
    exp = Experiment(name='TEST1',
                     kind='test',
                     wavelength=wavelength,
                     modulation_amplitude=modulation_amplitude,
                     material=['AlN'],
                     gain=gain)
    exp.append_condition(comb_type='cartesian',
                         wavelength=wavelength,
                         material='Au',
                         modulation_amplitude=0 * ureg.V,
                         gain=gain)
    exp.data = test_data

    R0_desired = {
        convert_name('TEST1~wavelength=850nm~modulation_amplitude=0V'):
        0.0261059412418133,
        convert_name('TEST1~wavelength=1150nm~modulation_amplitude=0V'):
        0.283227973929987,
        convert_name('TEST1~wavelength=850nm~modulation_amplitude=0V'):
        0.0261059412418133,
        convert_name('TEST1~wavelength=1150nm~modulation_amplitude=0V'):
        0.283227973929987,
    }

    dR_desired = {
        convert_name('TEST1~wavelength=850nm~modulation_amplitude=5V'): \
            0.93329 * dR_R0_ratio,
        convert_name('TEST1~wavelength=1150nm~modulation_amplitude=5V'): \
            0.948615  * dR_R0_ratio,
        convert_name('TEST1~wavelength=850nm~modulation_amplitude=10V'): \
            0.93329 * dR_R0_ratio,
        convert_name('TEST1~wavelength=1150nm~modulation_amplitude=10V'): \
            0.948615 * dR_R0_ratio,
    }
    (R0_figs_actual, _, dR_figs_actual, _, inoise_figs_actual, _) =  \
         exp.plot_photocurrent(
                 reference_condition=reference_condition, sim_exp=sim_exp,
                 c_axis_include='modulation_amplitude')

    AlN_R0_data = sim_exp.data['REFL2~material=AlN~spectra=R0']
    R0_fig_desired = Figure()
    R0_ax = R0_fig_desired.subplots()
    R0_ax.plot([850, 1150], [0.026106, 0.283228])
    R0_ax.plot(AlN_R0_data['Wavelength (nm)'].values,
               AlN_R0_data['R'].values,
               linestyle='dashed')
    R0_ax.plot([850, 1150], [0.026106, 0.283228])
    R0_ax.plot(AlN_R0_data['Wavelength (nm)'].values,
               AlN_R0_data['R'].values,
               linestyle='dashed')
    R0_ax.set_xlabel('wavelength (nm)')
    R0_ax.set_ylabel(r'$R_0$')
    R0_ax.set_xlim(880, 1100)

    # NOTE - This data is for a 5V *amplitude* sinewave.
    AlN_dR_data = sim_exp.data[
        'REFL2~material=AlN~modulation_amplitude=5V~spectra=dR']
    AlN_dR_data_10 = sim_exp.data[
        'REFL2~material=AlN~modulation_amplitude=10V~spectra=dR']

    dR_fig_desired = Figure()
    dR_ax = dR_fig_desired.subplots()
    dR_ax.plot(
        [850, 1150],
        [0.96400635435947 * dR_R0_ratio, 0.975276963043909 * dR_R0_ratio])
    dR_ax.plot(AlN_dR_data['Wavelength (nm)'].values,
               AlN_dR_data['R'].values,
               linestyle='dashed')
    dR_ax.plot([850, 1150], [
        2 * 0.96400635435947 * dR_R0_ratio, 2 * 0.975276963043909 * dR_R0_ratio
    ])
    dR_ax.plot(AlN_dR_data['Wavelength (nm)'].values,
               AlN_dR_data_10['R'].values,
               linestyle='dashed')
    dR_ax.set_xlabel('wavelength (nm)')
    dR_ax.set_ylabel(r'$\Delta R_{amp}$')
    dR_ax.set_xlim(880, 1100)

    inoise_fig_desired = Figure()
    inoise_ax_desired = inoise_fig_desired.subplots()
    inoise_ax_desired.plot([850, 1150], [-250, -250])
    inoise_ax_desired.plot([850, 1150],
                           [-257.8073547127414, -257.8073547127414],
                           linestyle='dashed')
    inoise_ax_desired.plot([850, 1150], [-243.9794, -243.9794])
    inoise_ax_desired.plot([850, 1150],
                           [-257.8073547127414, -257.8073547127414],
                           linestyle='dashed')

    inoise_ax_desired.set_xlabel('wavelength (nm)')
    inoise_ax_desired.set_ylabel('Power (dBA/Hz)')

    assert_figures_equal(inoise_figs_actual[1],
                         inoise_fig_desired,
                         atol=1e-6,
                         skip='ticks')
    assert_figures_equal(R0_figs_actual[1],
                         R0_fig_desired,
                         atol=1e-6,
                         skip='ticks')
    assert_figures_equal(dR_figs_actual[1],
                         dR_fig_desired,
                         atol=1e-6,
                         skip='ticks')
Ejemplo n.º 19
0
def test_plot_photocurrent_simple(convert_name, sim_exp):
    """
    Verifies that, given a sinusoidal input with a known offset and amplitude, the correct data is generated.
    """
    wavelength = np.array([700, 750]) * ureg.nm
    material = ['Au', 'Al']
    gain = 1 * ureg.Mohm
    current_offset = 100 * ureg.nA  # nA
    current_amplitude = -10 * ureg.pA  #
    dR_R0_ratio = current_amplitude / current_offset

    reference_condition = dict(material='Au')
    sin_data = pd.DataFrame({
            'Time (ms)': np.array([0, 1, 2, 3, 4, 5, 6, 7]),
            'Voltage (mV)': current_offset + \
                current_amplitude * np.array([0, -1, 0, 1, 0, -1, 0, 1]),
            'Sync': np.array([1, 0, 0, 0, 1, 0, 0, 0]),
            })
    test_data = {
        convert_name('TEST1~wavelength=700nm~material=Au'): sin_data,
        convert_name('TEST1~wavelength=750nm~material=Au'): sin_data,
        convert_name('TEST1~wavelength=700nm~material=Al'): sin_data,
        convert_name('TEST1~wavelength=750nm~material=Al'): sin_data,
    }
    exp = Experiment(name='TEST1',
                     kind='test',
                     wavelength=wavelength,
                     material=material,
                     gain=gain)
    exp.data = test_data

    R0_desired = {
        convert_name('TEST1~wavelength=700nm~material=Au'): 0.93329,
        convert_name('TEST1~wavelength=750nm~material=Au'): 0.948615,
        convert_name('TEST1~wavelength=700nm~material=Al'): 0.93329,
        convert_name('TEST1~wavelength=750nm~material=Al'): 0.948615,
    }
    dR_desired = {
        convert_name('TEST1~wavelength=700nm~material=Au'): \
            0.93329 * dR_R0_ratio,
        convert_name('TEST1~wavelength=750nm~material=Au'): \
            0.948615 * dR_R0_ratio,
        convert_name('TEST1~wavelength=700nm~material=Al'): \
            0.93329 * dR_R0_ratio,
        convert_name('TEST1~wavelength=750nm~material=Al'): \
            0.948615 * dR_R0_ratio,
    }
    (R0_figs_actual, _, dR_figs_actual, _, inoise_figs_actual, _) =  \
         exp.plot_photocurrent(
                 reference_condition=reference_condition, sim_exp=sim_exp)

    Au_R0_data = sim_exp.data['REFL2~material=Au~spectra=R0']
    Al_R0_data = sim_exp.data['REFL2~material=Al~spectra=R0']
    R0_fig_desired = Figure()
    R0_ax = R0_fig_desired.subplots()
    R0_ax.plot([700, 750], [0.93329, 0.948615])
    R0_ax.plot(Au_R0_data['Wavelength (nm)'].values,
               Au_R0_data['R'].values,
               linestyle='dashed')
    R0_ax.plot([700, 750], [0.93329, 0.948615])
    R0_ax.plot(Al_R0_data['Wavelength (nm)'].values,
               Al_R0_data['R'].values,
               linestyle='dashed')
    R0_ax.set_xlabel('wavelength (nm)')
    R0_ax.set_ylabel(r'$R_0$')
    R0_ax.set_xlim(870, 1100)

    # NOTE - This is the pk-pk data for 5V amplitude. To convert to rms,
    # We need only to divide by 2 * sqrt(2)

    dR_fig_desired = Figure()
    dR_ax = dR_fig_desired.subplots()
    dR_ax.plot([700, 750], [0.93329 * dR_R0_ratio, 0.948615 * dR_R0_ratio])
    dR_ax.plot([700, 750], [0.93329 * dR_R0_ratio, 0.948615 * dR_R0_ratio])
    dR_ax.set_xlabel('wavelength (nm)')
    dR_ax.set_ylabel(r'$\Delta R_{amp}$')
    dR_ax.set_xlim(870, 1100)

    inoise_fig_desired = Figure()
    inoise_ax_desired = inoise_fig_desired.subplots()
    inoise_ax_desired.plot([700, 750], [-248.750613, -248.750613])
    inoise_ax_desired.plot([700, 750],
                           [-257.8073547127414, -257.8073547127414],
                           linestyle='dashed')
    inoise_ax_desired.plot([700, 750], [-248.750613, -248.750613])
    inoise_ax_desired.plot([700, 750],
                           [-257.8073547127414, -257.8073547127414],
                           linestyle='dashed')

    inoise_ax_desired.set_xlabel('wavelength (nm)')
    inoise_ax_desired.set_ylabel('Power (dBA/Hz)')

    assert_figures_equal(inoise_figs_actual[0], inoise_fig_desired, atol=1e-6)
    assert_figures_equal(R0_figs_actual[0],
                         R0_fig_desired,
                         atol=1e-6,
                         skip='ticks')
    assert_figures_equal(dR_figs_actual[0],
                         dR_fig_desired,
                         atol=1e-6,
                         skip='ticks')