<jupyter_start><jupyter_text>Generate HeightCalibration object and get PSD data from files<jupyter_code>hc = pyotc.HeightCalibration()

basename = 'B01_'
directory = '../exampleData/height_calibration_single_psds/'

hc.get_psd_files(basename, directory=directory);

# bounds = {'x': (10, 20e3), 'y': (10, 20e3), 'z': (10, 4e3)}
bounds = (1, 45e3)
# bounds = None

#f_ex = {'x': [12, 88], 'y': [8, 48, 52], 'z': [48]}
f_ex = None

hc.gen_psd_fits(bounds=bounds, f_exclude=f_ex)<jupyter_output><empty_output><jupyter_text>Fit the PSDs<jupyter_code>''' If dynamic is set to True, the set height is used to determine if a
    fit is run with a Lorentzian PSD or a hydrodynamically correct PSD. '''

hc.setup_psd_fits(model='lorentzian', lp_filter=True, lp_fixed=True, f3dB=8800, alpha=0.3)

bounds = {'x': (1, 20e3), 'y': (1, 20e3), 'z': (1, 10e3)}
#bounds = (100, 45e3)
#bounds = None

#f_ex = {'x': [12, 88], 'y': [8, 48, 52], 'z': [48]}
f_ex = 8.0  # exclude crosstalk from excitation

# kwargs = {'f_c': 4e3}  # initial guesses
kwargs = {}

hc.fit_psds(bounds=bounds, f_exclude=f_ex,
            fitreport=0, plot_fits=True,
            use_heights=False, plot_kws={'showLegend': False}, **kwargs);<jupyter_output><empty_output><jupyter_text>determine focal shift<jupyter_code>hc.determine_focal_shift(idx_slice=slice(22, -4))<jupyter_output><empty_output><jupyter_text>set the focal shift<jupyter_code>hc.focal_shift = 0.63
hc.plot_pc_results()<jupyter_output><empty_output><jupyter_text>exclude some data<jupyter_code>hc.exclude_heights_outside(0.2, 10, reset=True)
hc.fit_rel_drag(method='radius', plot_fit=True, h0=-0.6)<jupyter_output><empty_output><jupyter_text>find out which surface height was determined<jupyter_code>hc.rel_drag_fit.params['h0']<jupyter_output><empty_output><jupyter_text>fit all data<jupyter_code>hc.fit_height_data(method='radius', fit_dissens_osci=True, plot_fit=True, fit_drag_first=False)
hc.save_hc_data()<jupyter_output><empty_output><jupyter_text>adjust heights<jupyter_code>hc.add_height_offset(0.5809)
hc.reset_recalc()
hc.plot_pc_results()<jupyter_output><empty_output><jupyter_text>re-fit psds (if necessary)<jupyter_code>hc.setup_psd_fits(model='lorentzian', lp_filter=True, lp_fixed=True, f3dB=8800, alpha=0.3)

# heights = [1.00, ]
heights = None  # fit all available psds

# names = ['x', 'y']  # fit only particular axes
names = None  # fir all available axes

bounds = {'x': (1, 20e3), 'y': (1, 20e3), 'z': (1, 10e3)}
#bounds = (100, 45e3)
#bounds = None

#f_ex = {'x': [12, 88], 'y': [8, 48, 52], 'z': [48]}
f_ex = 8.0

# kwargs = {'f_c': 4e3}  # initial guesses
kwargs = {}

hc.fit_psds(heights=heights, names=names, bounds=bounds, f_exclude=f_ex,
            fitreport=0, plot_fits=True, use_heights=True,
            plot_kws={'showLegend': False}, **kwargs);
hc.plot_pc_results()
hc.exclude_heights_outside(0.8, 10, reset=True)
hc.fit_rel_drag(plot_fit=True)
hc.rel_drag_fit.params['h0']
hc.fit_height_data(fit_drag_first=False, fit_dissens_osci=True, plot_fit=True)
# save height-dependent data
hc.save_hc_data(basename, directory)
# save height-fit results
hc.write_results_to_file()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15960809102402024, 'fraction_numerical': 0.04424778761061947, 'mean_word_length': 6.719512195121951, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '512024', 'license': 'Apache-2.0', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1291, 'n_words': 243, 'path': 'examples/notebooks/height_calibration_single_psds.ipynb', 'repo_name': 'cellular-nanoscience/pyotic', 'size': '3164'}