pressureclamp package

Submodules

pressureclamp.load_file module

pressureclamp.load_file.load_file(path, header=[])

This function will parse a standard HEKA .asc file into a pandas dataframe.

Parameters
  • path (string) – String input of path to a standard HEKA output .asc file.

  • headers (list) – A list or iterable of string column headers. The list of headers must match the number of columns in the dataframe.

Returns

The file reformatted into a dataframe with the given headers.

Return type

dataframe

pressureclamp.plot_functions module

pressureclamp.plot_functions.add_scalebars(df, fig, locs)

This function will add scalebars to a plot.

Parameters
  • df (dataframe) –

  • fig (plotly.figure) – A plotly figure of pressure clamp sweeps as made by plot_sweeps

  • locs (dictionary) – A dictionary with the axis names as keys and scalebar limits as values for scalebars.

Returns

fig – A modified plotly figure of sweeps with scalebars.

Return type

plotly.figure

pressureclamp.plot_functions.double_gauss_fit(x, a1, a2, m1, m2, s1, s2)

This function defines a double gaussian curve.

Parameters
  • x (series) – The abscissa data.

  • a1 (float) – The amplitude of the first gaussian.

  • a2 (float) – The amplitude of the second gaussian.

  • m1 (float) – The midpoint of the first gaussian.

  • m2 (float) – The midpoint of the second gaussian.

  • s1 (float) – The standard deviation of the first gaussian.

  • s2 (float) – The standard deviation of the second gaussian.

Returns

The ordinate for a pair of gaussian curve described by the input parameters.

Return type

series

pressureclamp.plot_functions.fit_layer(df, x, fig, fit)

This function will overlay a fit on an existing current-pressure response curve as produced by plot_summary.

Parameters
  • df (dataframe) – A dataframe of summarized pressure clamp sweeps.

  • x (string) – A string identifying the abscissus of the plot.

  • fig (plotly.figure) – A plotly figure of pressure clamp sweeps as made plot_summary

  • fit (list) – A list or other iterable with fit parameters for a boltzmann sigmoid as defined in sigmoid_fit.

Returns

fig – A plotly figure object plotting x as a function of y.

Return type

plotly.figure

pressureclamp.plot_functions.frequency_histogram(df, col, nbins, ngauss=2)

This function will fit a histogram to an current trace for analyzing single-channel events.

Parameters
  • df (dataframe) – A dataframe of an isolated single-channel event.

  • col (string) – A string identifying the column to be binned into histograms.

  • nbins (int) – The number of histogram bins.

  • ngauss (int) – The number of gaussians to be fit to the data. Defaults to 2.

Returns

  • fig (plotly.figure) – A plotly figure showing the histogram of values for col in your dataframe overlaid with gaussian fits.

  • popt (list) – An iterable containing the fit parameters for the gaussians.

  • pcov (list) – An iterable of covariance matrices for the fits.

pressureclamp.plot_functions.ngauss_guesses(x, y, nGauss)

This function will generate initial guesses for a gaussian fit to single-channel data.

Parameters
  • x (list) – A list of histogram bins.

  • y (list) – A list of histogram weights.

  • nGauss (int) – The number of gaussians estimated to represent the data.

Returns

test – A list of parameter estimates for the gaussian fits.

Return type

list

pressureclamp.plot_functions.plot_summary(df, x, y)

This function will plot x as a function of y from a summary statistics dataframe as produced by sweep_summary.

Parameters
  • df (dataframe) – A dataframe of summarized pressure clamp sweeps.

  • x (string) – A string indicating the abscissa.

  • y (string) – A string indicating the ordinate.

Returns

fig – A plotly figure object plotting x as a function of y.

Return type

plotly.figure

pressureclamp.plot_functions.plot_sweeps(df, x, stim, col)

This function will plot a dataframe of sweeps using plotly with hidden axis.

Parameters
  • df (dataframe) –

  • x (string) – A string identifying the column defining the abscissa of the plot.

  • stim (string) – A string identifying the column defining the stimulus amplitude.

  • col (string) – A string identifying the response column.

Returns

fig – A plotly figure object containg a pair of stacked plots of the pressure clamp stimulus and response.

Return type

plotly.figure

pressureclamp.plot_functions.plot_sweeps_stacked(df, x, stim, col)

This function will plot a dataframe of sweeps using plotly with hidden axis. Each sweep will be stacked with a defined offset.

Parameters
  • df (dataframe) –

  • x (string) – A string identifying the column defining the abscissa of the plot.

  • stim (string) – A string identifying the column defining the stimulus amplitude.

  • col (string) – A string identifying the response column.

Returns

fig – A plotly figure object containg a pair of stacked plots of the pressure clamp stimulus and response.

Return type

plotly.figure

pressureclamp.plot_functions.sigmoid_fit(p, p50, k)

This function defines a sigmoid curve.

Parameters
  • p (series) – The abscissa data.

  • p50 (float) – The inflection point of the sigmoid.

  • k (float) – The slope at the inflection point of a sigmoid.

Returns

The ordinate for a boltzmann sigmoid with the passed parameters.

Return type

series

pressureclamp.plot_functions.single_gauss_fit(x, a1, m1, s1)

This function defines a single gaussian curve.

Parameters
  • x (series) – The abscissa data.

  • a1 (float) – The amplitude of the gaussian.

  • m1 (float) – The midpoint of the gaussian.

  • s1 (float) – The standard deviation of the gaussian

Returns

The ordinate for a gaussian curve described by the input parameters.

Return type

series

pressureclamp.plot_functions.triple_gauss_fit(x, a1, a2, a3, m1, m2, m3, s1, s2, s3)

This function defines a double gaussian curve.

Parameters
  • x (series) – The abscissa data.

  • a1 (float) – The amplitude of the first gaussian.

  • a2 (float) – The amplitude of the second gaussian.

  • a3 (float) – The amplitude of the third gaussian.

  • m1 (float) – The midpoint of the first gaussian.

  • m2 (float) – The midpoint of the second gaussian.

  • m3 (float) – The midpoint of the third gaussian.

  • s1 (float) – The standard deviation of the first gaussian.

  • s2 (float) – The standard deviation of the second gaussian.

  • s3 (float) – The standard deviation of the third gaussian.

Returns

The ordinate for three gaussian curves described by the input parameters.

Return type

series

pressureclamp.preprocess module

pressureclamp.preprocess.baseline_subtract(df, col, ref, window)

This function will baseline subtract a specified column of the dataframe based on a provided window within a reference column.

Parameters
  • df (dataframe) – A pandas dataframe with columns col and ref.

  • col (string) – A string indicating the name of the column to be baseline subtracted.

  • ref (string) – A reference column over-which to find the window.

  • window (list) – An iterable with the start and end coordinates of the reference window for baseline subtraction.

Returns

A modified pandas dataframe where the the column col has been baseline subtracted.

Return type

dataframe

pressureclamp.preprocess.isolate_opening(df, sweepnum, window)

This function will isolate a window in a time series.

Parameters
  • df (dataframe) – A pandas dataframe with columns p, ti, tp, and i.

  • sweepnum (int) – The

  • window (iterable) – an iterable with the start and end coordinates of the baseline window.

Returns

A modified pandas dataframe.

Return type

dataframe

pressureclamp.summarize module

pressureclamp.summarize.sweep_summary(df, stim, col, ref, window, param='Max')

This function will summarize sweep data of a specified column of the dataframe based on a provided window within a reference column.

Parameters
  • df (dataframe) – A pandas dataframe with columns col and ref.

  • stim (string) – A string indicating the name of the stimulus column.

  • col (string) – A string indicating the name of the column to be summarized.

  • ref (string) – A reference column over-which to find the window.

  • window (list) – An iterable with the start and end coordinates of the region over-which the sweep is to be summarized.

  • param (string) – A string of either "Mean", "Min", or "Max" indicating the desired summary statistic. The default value is “Min”

Returns

A dataframe summarizing the desired col across sweeps over a given window on a reference column, ref.

Return type

dataframe

Module contents