Switching
ot_arhmm.switching.Switching
- class ot_arhmm.switching.Switching(file: str, raw_time: numpy.ndarray, raw_force: numpy.ndarray, raw_f_s: float, raw_N: int, downsample: int, time: numpy.ndarray, force: numpy.ndarray, f_s: float, N: int, gmm: ot_arhmm.switching.GMM_results | None = None, psd: ot_arhmm.switching.PSD_results | None = None, raw_psd: ot_arhmm.switching.PSD_results | None = None, psd_fit: ot_arhmm.switching.PSD_fit | None = None, wnhmm: ot_arhmm.switching.HMM_results | None = None, arhmm: ot_arhmm.switching.HMM_results | None = None)
- __eq__(other)
Return self==value.
- __init__(file: str, raw_time: ndarray, raw_force: ndarray, raw_f_s: float, raw_N: int, downsample: int, time: ndarray, force: ndarray, f_s: float, N: int, gmm: GMM_results | None = None, psd: PSD_results | None = None, raw_psd: PSD_results | None = None, psd_fit: PSD_fit | None = None, wnhmm: HMM_results | None = None, arhmm: HMM_results | None = None) None
- __repr__()
Return repr(self).
- __str__()
Return str(self).
- calculate_psd(length=1.0)
Calculate PSD of data using Welch’s method.
- Parameters:
length (float, optional) – Length in seconds for each PSD. Defaults to 1..
- fit_arhmm(params: ndarray | None = None)
Fit arHMM.
- Parameters:
params (np.ndarray | None, optional) – Array containing [r_11, r_21, mean1, mean2, var1, var2, alpha1, alpha2]. If None, computes from PSD and GMM fits. Defaults to None.
- fit_gmm(probs_guess: ndarray, means_guess: ndarray, stds_guess: ndarray)
Fit force histogram with 2 component GMM. By convention, the first state is lower force.
- Parameters:
probs_guess (np.ndarray) – Probabilities of occupying each state.
means_guess (np.ndarray) – Mean force of each state.
stds_guess (np.ndarray) – Standard deviation of force for each state.
- fit_psd(A_1_guess: float, f_c_1_guess: float, A_2_guess: float, f_c_2_guess: float, f_min=0.0, f_max=20000.0, raw=False)
Fit PSD with an aliased double Lorentzian.
- Parameters:
A_1_guess (float) – Guess for amplitude of lower frequency peak in pN^2/Hz.
f_c_1_guess (float) – Guess for frequency of lower frequency peak in Hz.
A_2_guess (float) – Guess for amplitude of higher frequency peak in pN^2/Hz.
f_c_2_guess (float) – Guess for frequency of higher frequency peak in Hz.
f_min (float, optional) – Minimum frequency to fit. Defaults to 0.
f_max (float, optional) – Maximum frequency to fit. Defaults to 2e4.
raw (bool, optional) – Whether to fit raw data or downsampled data. Defaults to False.
- fit_wnhmm(params: ndarray | None = None)
Fit wnHMM.
- Parameters:
params (np.ndarray | None, optional) – Array containing [r_11, r_21, mean1, mean2, var1, var2]. If None, computes from PSD and GMM fits. Defaults to None.
- plot_folding_rate(from_lts=True, label_rate=True, min_time=0.0, max_time: float | None = None, ax: Axes | None = None, log: str | None = None, wnhmm=False, **kwargs)
Plot folding survival from folding rate.
- Parameters:
from_lts (bool, optional) – Whether to use rate fit from lifetimes or from HMM. Defaults to True.
label_rate (bool, optional) – Whether to put rate into label. Defaults to True.
min_time (float, optional) – Minimum time to plot in s. Defaults to 0.
max_time (float | None, optional) – Maximum time to plot in s. If None, uses the maximum lifetime. Defaults to None.
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
log (str, optional) – Log scaling of the plot. Defaults to “loglog”.
wnhmm (bool, optional) – Whether to use lifetimes from wnHMM or arHMM. Defaults to False.
- Returns:
_description_
- Return type:
_type_
- plot_folding_surv(ax: Axes | None = None, fill=False, log: str | None = None, wnhmm=False, **kwargs)
Plot folding survival plot
- Parameters:
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
fill (bool, optional) – Whether to fill the area under the curve. Defaults to False.
log (str, optional) – Log scaling of the plot. Defaults to “loglog”.
wnhmm (bool, optional) – Whether to use lifetimes from wnHMM or arHMM. Defaults to False.
- Returns:
Axes object containing plot.
- Return type:
plt.Axes
- plot_force_hist(binwidth=0.05, raw=False, ax: Axes | None = None, **kwargs)
Make a force histogram.
- Parameters:
binwidth (float, optional) – Width of each force bin. Defaults to 0.05.
raw (bool, optional) – Whether to use raw or downsampled data. Defaults to False.
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
- Returns:
Axes object containing plot.
- Return type:
plt.Axes
- plot_force_time(labels: ndarray | None = None, raw=False, ax: Axes | None = None, **kwargs)
Make a force vs time plot.
- Parameters:
labels (np.ndarray | None, optional) – Labels to color data by. Defaults to None.
raw (bool, optional) – Whether to plot raw or downsampled data. Defaults to False.
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
**kwargs – Additional arguments passed to plt.scatter.
- Returns:
Axes object containing plot.
- Return type:
plt.Axes
- plot_gmm_pdf(annotate=True, ax: Axes | None = None, line1_kwargs={}, line2_kwargs={}, line3_kwargs={}, **kwargs)
Plot the PDFs determined by fitting the GMM.
- Parameters:
annotate (bool, optional) – Whether to add values to plot. Defaults to True.
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
line1_kwargs (dict, optional) – Arguments passed to plt.plot for drawing state 1 pdf. Defaults to {}.
line2_kwargs (dict, optional) – Arguments passed to plt.plot for drawing state 2 pdf. Defaults to {}.
line3_kwargs (dict, optional) – Arguments passed to plt.plot for the line for the total pdf. Defaults to {}.
- Returns:
Axes object containing plot.
- Return type:
plt.Axes
- plot_psd(raw=False, log='loglog', ax: Axes | None = None, **kwargs)
Plot PSD of the data.
- Parameters:
raw (bool, optional) – Whether to use raw or downsampled data. Defaults to False.
log (str, optional) – Log scaling of the plot. Defaults to “loglog”.
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
- Returns:
Axes object containing plot.
- Return type:
plt.Axes
- plot_psd_fit(log='loglog', plot_all=True, raw=False, ax: Axes | None = None, subplot1_kws: dict = {}, subplot2_kws: dict = {}, **kwargs)
Plots PSD fit.
- Parameters:
log (str, optional) – Log scaling of the plot. Defaults to “loglog”.
plot_all (bool, optional) – If true, also plots individual Lorentzian fits. Defaults to True.
raw (bool, optional) – Whether to use raw data or downsampled data. Defaults to False.
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
subplot1_kws (dict, optional) – kwargs passed to plt.plot for the lower frequency Lorentzian. Defaults to {}.
subplot2_kws (dict, optional) – kwargs passed to plt.plot for the higher frequency Lorentzian. Defaults to {}.
**kwargs – passed to plt.plot for the double Lorentzian.
- Returns:
Axes object containing plot.
- Return type:
plt.Axes
- plot_unfolding_rate(from_lts=True, label_rate=True, min_time=0.0, max_time: float | None = None, ax: Axes | None = None, log: str | None = None, hmm=False, **kwargs)
Plot unfolding survival from folding rate.
- Parameters:
from_lts (bool, optional) – Whether to use rate fit from lifetimes or from HMM. Defaults to True.
label_rate (bool, optional) – Whether to put rate into label. Defaults to True.
min_time (float, optional) – Minimum time to plot in s. Defaults to 0.
max_time (float | None, optional) – Maximum time to plot in s. If None, uses the maximum lifetime. Defaults to None.
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
log (str, optional) – Log scaling of the plot. Defaults to “loglog”.
wnhmm (bool, optional) – Whether to use lifetimes from wnHMM or arHMM. Defaults to False.
- Returns:
_description_
- Return type:
_type_
- plot_unfolding_surv(ax: Axes | None = None, fill=False, log=None, hmm=False, **kwargs)
Plot unfolding survival plot
- Parameters:
ax (plt.Axes | None, optional) – Axis to plot data on. If none, uses the current axis. Defaults to None.
fill (bool, optional) – Whether to fill the area under the curve. Defaults to False.
log (str, optional) – Log scaling of the plot. Defaults to “loglog”.
wnhmm (bool, optional) – Whether to use lifetimes from wnHMM or arHMM. Defaults to False.
- Returns:
Axes object containing plot.
- Return type:
plt.Axes
- __hash__ = None
- __weakref__
list of weak references to the object