PyOTC Example Notebook 3


In [ ]:
#for debugging
#import sys
#sys.path.append('../..')

In [ ]:
import pyotc

import matplotlib.pyplot as plt
plt.ion()
#%matplotlib inline

set working directory


In [ ]:
from os.path import join
from os.path import expanduser

directory = '../exampleData/height_calibration_single_psds/'
#homefolder = expanduser('~')
#directory = join(homefolder,'')

set basename & load height-dependent data


In [ ]:
basename = 'B01_'

hc = pyotc.HeightCalibration()
hc.load_hc_data(basename, directory=directory)

Plot dc results


In [ ]:
fig1 = hc.plot_pc_results()

need to exclude some data?


In [ ]:
#hc.exclude_by_max_rel_drag(max_rel_drag=1.7)
hc.exclude_heights_outside(0.0, 3, reset=True)
#hc.exclude_height(0.0)

Fit height-dependent data

Set focal shift


In [ ]:
hc.focal_shift = 0.67

Fit height data


In [ ]:
hc.fit_height_data(method='radius',
                   fit_drag_first=False,
                   fit_dissens_osci=True,
                   plot_fit=True, h0=-1.0)

View results corrected by relative drag


In [ ]:
fig = hc.plot_results(plot_corrected=True)
pyotc.plt.show()

compare the directly measured and the corrected discplacement sensitivity


In [ ]:
names = hc.names
ex_axis = names[int(hc._arrays['ex_axis'][0])]
fig = hc.plot_dissens(name=ex_axis, showLegend=True)
ax = fig.axes[0]
hc.plot_dissens(name=ex_axis, plot_ac_data=False, axis=ax, plot_corrected=True, c='blue',
                showLegend=True, title='Comp. active and corrected passive displacement sensitivity')

save results


In [ ]:
hc.write_results_to_file()

In [ ]: