cibrrig.postprocess.extract_chronux

Wrapper to Chronux coherency computations in Matlab

Attributes

_log

ERR

TAPERS

WIN

Functions

adjust_chronux_phi(phi)

Modify phi so that [-pi,0) is expiration and [0,pi) is inspiration.

run_chronux(spike_times, spike_clusters, cluster_ids, ...)

Run chronux on a subset of data.

reshape_chronux_output(chronux_rez, cluster_ids, ...)

Given the chronux result loaded from the mat file, reshape either into a

run_phy_probe(phy_path, t0, tf, x, xt[, use_good, verbose])

run_probe(probe_path, t0, tf, x, xt[, use_good, verbose])

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

run_session(session_path, t0, tf[, var, use_good, verbose])

Run chronux coherence extraction on all probes in a session

main(session_path, t0, tf, var, include_all, verbose)

Module Contents

cibrrig.postprocess.extract_chronux._log[source]
cibrrig.postprocess.extract_chronux.ERR = [[2.0, 0.001]][source]
cibrrig.postprocess.extract_chronux.TAPERS = [[3.0, 5.0]][source]
cibrrig.postprocess.extract_chronux.WIN = 25.0[source]
cibrrig.postprocess.extract_chronux.adjust_chronux_phi(phi)[source]

Modify phi so that [-pi,0) is expiration and [0,pi) is inspiration.

cibrrig.postprocess.extract_chronux.run_chronux(spike_times, spike_clusters, cluster_ids, x, xt, t0, tf, verbose=True)[source]

Run chronux on a subset of data. Runs agnostic of underlying file structure. Submits a subprocess command to matlab, so matlab must be installed and chronux must be in the matlab path.

Parameters:
  • spike_times (1D numpy array) – times in seconds of spikes

  • spike_clusters (1D numpy array) – clusters each spike is associated with

  • cluster_ids (1D numpy array) – list of unique clusters to analyse

  • x (1D numpy array) – continuous valued variable to compute coherence against

  • xt (1D numpy array) – time of each sample in x

  • t0 (float) – first time of window to analyse (seconds)

  • tf (float) – last time of window to analyse (seconds)

cibrrig.postprocess.extract_chronux.reshape_chronux_output(chronux_rez, cluster_ids, n_total_clusters, mode='unit_level', min_rr=0.2)[source]

Given the chronux result loaded from the mat file, reshape either into a more user friendly mat file or a unit level data frame

Mode: unit_level returns a dataframe of the coherence, bounds, and phase lags for each cluster.

Parameters:
  • chronux_rez (dict) – result from the chronux output

  • cluster_ids (1D numpy array) – cluster IDS

  • n_total_clusters (int) – number of total clusters in the recording. Required if you did not compute coherence on the non-QC units

  • mode (str, optional) – what format to output to. Defaults to ‘unit level’. (‘mat’ or ‘unit_level’)

cibrrig.postprocess.extract_chronux.run_phy_probe(phy_path, t0, tf, x, xt, use_good=True, verbose=True)[source]
cibrrig.postprocess.extract_chronux.run_probe(probe_path, t0, tf, x, xt, use_good=True, verbose=True)[source]

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

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

  • t0 (float) – start of the epoch to comute on

  • tf (float) – end of the epoch to compute on

  • x (1D numpy array) – continuous variable to compute coherence against

  • xt (1D numpy array) – timestamps of the x variable

  • use_good (bool, optional) – Flag to only compute on neurons that have been designated good. Defaults to True.

cibrrig.postprocess.extract_chronux.run_session(session_path, t0, tf, var='dia', use_good=True, verbose=True)[source]

Run chronux coherence extraction on all probes in a session Should have the “physiology” object extracted, and all probes should be in ALF format.

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

  • t0 (float) – start of the epoch to comute on

  • tf (float) – end of the epoch to compute on

  • x (1D numpy array) – continuous variable to compute coherence against

  • xt (1D numpy array) – timestamps of the x variable

  • use_good (bool, optional) – Flag to only compute on neurons that have been designated good. Defaults to True.

cibrrig.postprocess.extract_chronux.main(session_path, t0, tf, var, include_all, verbose)[source]