cibrrig.postprocess.extract_chronux =================================== .. py:module:: cibrrig.postprocess.extract_chronux .. autoapi-nested-parse:: Wrapper to Chronux coherency computations in Matlab Attributes ---------- .. autoapisummary:: cibrrig.postprocess.extract_chronux._log cibrrig.postprocess.extract_chronux.ERR cibrrig.postprocess.extract_chronux.TAPERS cibrrig.postprocess.extract_chronux.WIN Functions --------- .. autoapisummary:: cibrrig.postprocess.extract_chronux.adjust_chronux_phi cibrrig.postprocess.extract_chronux.run_chronux cibrrig.postprocess.extract_chronux.reshape_chronux_output cibrrig.postprocess.extract_chronux.run_phy_probe cibrrig.postprocess.extract_chronux.run_probe cibrrig.postprocess.extract_chronux.run_session cibrrig.postprocess.extract_chronux.main Module Contents --------------- .. py:data:: _log .. py:data:: ERR :value: [[2.0, 0.001]] .. py:data:: TAPERS :value: [[3.0, 5.0]] .. py:data:: WIN :value: 25.0 .. py:function:: adjust_chronux_phi(phi) Modify phi so that [-pi,0) is expiration and [0,pi) is inspiration. .. py:function:: run_chronux(spike_times, spike_clusters, cluster_ids, x, xt, t0, tf, verbose=True) 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. :param spike_times: times in seconds of spikes :type spike_times: 1D numpy array :param spike_clusters: clusters each spike is associated with :type spike_clusters: 1D numpy array :param cluster_ids: list of unique clusters to analyse :type cluster_ids: 1D numpy array :param x: continuous valued variable to compute coherence against :type x: 1D numpy array :param xt: time of each sample in x :type xt: 1D numpy array :param t0: first time of window to analyse (seconds) :type t0: float :param tf: last time of window to analyse (seconds) :type tf: float .. py:function:: reshape_chronux_output(chronux_rez, cluster_ids, n_total_clusters, mode='unit_level', min_rr=0.2) 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. :param chronux_rez: result from the chronux output :type chronux_rez: dict :param cluster_ids: cluster IDS :type cluster_ids: 1D numpy array :param n_total_clusters: number of total clusters in the recording. Required if you did not compute coherence on the non-QC units :type n_total_clusters: int :param mode: what format to output to. Defaults to 'unit level'. ('mat' or 'unit_level') :type mode: str, optional .. py:function:: run_phy_probe(phy_path, t0, tf, x, xt, use_good=True, verbose=True) .. py:function:: run_probe(probe_path, t0, tf, x, xt, use_good=True, verbose=True) Compute coherence using chronux ALF organized spike data in a probe path :param probe_path: path to the ALF spiking data :type probe_path: Pathlib path :param t0: start of the epoch to comute on :type t0: float :param tf: end of the epoch to compute on :type tf: float :param x: continuous variable to compute coherence against :type x: 1D numpy array :param xt: timestamps of the x variable :type xt: 1D numpy array :param use_good: Flag to only compute on neurons that have been designated good. Defaults to True. :type use_good: bool, optional .. py:function:: run_session(session_path, t0, tf, var='dia', use_good=True, verbose=True) Run chronux coherence extraction on all probes in a session Should have the "physiology" object extracted, and all probes should be in ALF format. :param session_path: Path to the session. :type session_path: Pathlib Path :param t0: start of the epoch to comute on :type t0: float :param tf: end of the epoch to compute on :type tf: float :param x: continuous variable to compute coherence against :type x: 1D numpy array :param xt: timestamps of the x variable :type xt: 1D numpy array :param use_good: Flag to only compute on neurons that have been designated good. Defaults to True. :type use_good: bool, optional .. py:function:: main(session_path, t0, tf, var, include_all, verbose)