cibrrig.postprocess.extract_resp_modulation

Compute respiratory related modulation for each unit Uses a different computation than coherence Not using coherence for the potential concerns that coherence may not be the most effective way.

Attributes

_log

Functions

get_vector_means(bins, rates)

Calculate the vector sum direction and tuning strength from a histogram of responses in polar space.

_get_phase_max(bins, rates)

Computes the phase value of the peak of the polar curve.

_get_phase_modulation(bins, rates)

Compute the phase modulation index as:

_get_eta_squareds(rates)

Compute the eta squared for each unit in the rates matrix.

compute_resp_mod(spike_times, spike_clusters, ...[, ...])

Compute respiratory modulation according to Mazurek et al. for all clusters in cluster_ids

run_probe(probe_path, breaths[, t0, tf, use_good, ...])

Compute coherence using chronux ALF organized spike data in a probe path

sanity_check_plots(probe_path, bins, rates, sems, ...)

Make a few plots that show the respiratory modulation of individual units and the population.

run_session(session_path[, t0, tf, use_good, plot_tgl])

Run respiratory modulation computation on all probes for a session.

main(session_path, t0, tf, use_good, no_plot)

Module Contents

cibrrig.postprocess.extract_resp_modulation._log[source]
cibrrig.postprocess.extract_resp_modulation.get_vector_means(bins, rates)[source]

Calculate the vector sum direction and tuning strength from a histogram of responses in polar space. Computes over all cells in the input rates.

Parameters:
  • bins (np.ndarray) – Sampled bin locations from a polar histogram. Must be on [-pi, pi] Assumes number of bins is the same as the number of observed rates. Bin centers is a better usage.

  • rates (np.ndarray) – Observed rate at each bin location. Multiple units are passed in columns

Returns:

A tuple containing:
  • theta (np.ndarray): The vector mean direction of the input bin locations and centers.

  • L_dir (np.ndarray): The strength of the tuning as defined by Mazurek FiNC 2014. Equivalent to 1 - Circular Variance.

Return type:

tuple

cibrrig.postprocess.extract_resp_modulation._get_phase_max(bins, rates)[source]

Computes the phase value of the peak of the polar curve.

Parameters:
  • bins (np.ndarray) – Sampled bin locations from a polar histogram. Must be on [-pi, pi].

  • rates (np.ndarray) – Observed rate at each bin location. Multiple units are passed in columns.

Returns:

The phase value of the peak of the polar curve.

Return type:

np.ndarray

cibrrig.postprocess.extract_resp_modulation._get_phase_modulation(bins, rates)[source]

Compute the phase modulation index as: Phi =

rac{max(rates) - min(rates)}{mean(rates)}

Args:
bins (np.ndarray): Sampled bin locations from a polar histogram. Must be on [-pi, pi].

Assumes number of bins is the same as the number of observed rates. Bin centers is a better usage.

rates (np.ndarray): Observed rate at each bin location. Multiple units are passed in columns.

Returns:

np.ndarray: The phase modulation index for each unit.

cibrrig.postprocess.extract_resp_modulation._get_eta_squareds(rates)[source]

Compute the eta squared for each unit in the rates matrix.

Not currently implemented :param rates: Observed rate at each bin location. Multiple units are passed in columns :type rates: np.ndarray

Returns:

The eta squared value for each unit.

Return type:

np.ndarray

cibrrig.postprocess.extract_resp_modulation.compute_resp_mod(spike_times, spike_clusters, cluster_ids, breaths, t0=None, tf=None)[source]

Compute respiratory modulation according to Mazurek et al. for all clusters in cluster_ids Implicitly computes phase from breaths.on_sec and breaths.off_sec Optionally, specify a window to compute respiratory modulation

Times are in seconds

Parameters:
  • spike_times (np.ndarray) – Array of spike times

  • spike_clusters (np.ndarray) – Array of cluster IDs for each spike

  • cluster_ids (np.ndarray) – Array of cluster IDs to compute on

  • breaths (one.alf.io.AlfBunch) – Breaths structure that contains on_sec and off_sec

  • t0 (float) – Start of the window to compute respiratory modulation. Defaults to 0.

  • tf (float) – End of the window to compute respiratory modulation. Defaults to the last spike or breath.

Returns:

bins - Phase bins np.ndarray: rates - Spike rate as a function of phase for each cluster np.ndarray: sems - Spike rate standard error as a function of phase for each cluster np.ndarray: theta - Preferred phase for each cluster np.ndarray: L_dir - Respiratory modulation strength for each cluster

Return type:

np.ndarray

cibrrig.postprocess.extract_resp_modulation.run_probe(probe_path, breaths, t0=None, tf=None, use_good=False, plot_tgl=True, save_tgl=True)[source]

Compute coherence using chronux ALF organized spike data in a probe path Wrapper to pass to “compute_resp_mod”

Parameters:
  • probe_path (Pathlib path) – path to the ALF spiking data

  • breaths (AlfBunch) – Breaths structure that contains on_sec and off_sec

  • t0 (float) – Defines the start of the window to compute respiratory modulation, defaults to 0

  • tf (float) – Defines the end of the window to compute respiratory modulation, defaults to last spike or breath

  • use_good (bool, optional) – If True, only use “good” units. Defaults to False.

  • plot_tgl (bool, optional) – _description_. Defaults to True.

  • save (bool, optional) – _description_. Defaults to True.

cibrrig.postprocess.extract_resp_modulation.sanity_check_plots(probe_path, bins, rates, sems, theta, L_dir)[source]

Make a few plots that show the respiratory modulation of individual units and the population.

Parameters:
  • probe_path (Path) – Path to save the plots.

  • bins (np.ndarray) – Phase bins.

  • rates (np.ndarray) – Spike rate as a function of phase for each cluster.

  • sems (np.ndarray) – Spike rate standard error as a function of phase for each cluster.

  • theta (np.ndarray) – Preferred phase for each cluster.

  • L_dir (np.ndarray) – Respiratory modulation strength for each cluster.

cibrrig.postprocess.extract_resp_modulation.run_session(session_path, t0=None, tf=None, use_good=False, plot_tgl=True)[source]

Run respiratory modulation computation on all probes for a session.

Parameters:
  • session_path (Path) – Path to the session data.

  • t0 (float, optional) – Start of the epoch to compute on. Defaults to None.

  • tf (float, optional) – End of the epoch to compute on. Defaults to None.

  • use_good (bool, optional) – If True, only compute for the “good” units. Defaults to False.

  • plot_tgl (bool, optional) – If True, generate plots. Defaults to True.

cibrrig.postprocess.extract_resp_modulation.main(session_path, t0, tf, use_good, no_plot)[source]