cgid.tools module¶
-
cgid.tools.channel2index(channel, availableChannels)[source]¶ Parameters: - channel –
- availableChannels –
-
cgid.tools.get_all_isi_epoch(session, area, unit, epoch)[source]¶ Returns the durations of all ISI intervals from the given session, area, unit, and epoch
-
cgid.tools.neighbors(session, area, onlygood)[source]¶ Constructs an adjacency graph for a given array. Each channel number is mapped to a list of the up to 4 channels immediately adjacent to it. If argument “onlygood” is true, then bad channels are excluded from this map.
-
cgid.tools.onarraydata(function, session, area, trial, epoch, fa, fb)[source]¶ Applies functions that accept AxBxN data where AxB are array indecies. and N is timepoints over the specified section of data.
Note: array interp routines take array map from get_array_map. Bad channels can be removed by removing them in this function.
-
cgid.tools.onpopdata(statistic, session, area, trial, epoch, fa, fb)[source]¶ Extracts data and applies provided function ‘statistic’ to it. Returns time base and statistic over time. Times may vary as some statistics clip or truncate the data.
Statistic must accept one argument “data” which is a K channel by N time complex matrix of analytic signals.
Statistic must return a length M<=N vector. If M<N, this function assumes that the data were truncated symmetrically to generate a cropped time base.
If not provided, session, area, and trial will be taken from globals ( if they are not present in globals it will crash )
If not provided, epoch is 6,-1000,6000 ( the whole trial )
TODO: support functions that returnmultiple values
Example: >>> x = onpopdata(sliding_population_signal_coherence)
-
cgid.tools.onsession(statistic, session, area, epoch, fa, fb)[source]¶ applies statistic over all trials in the session. doesn’t return exact times since events have different timings on each trial. instead returns an event-relative time base. times,res=onsession(array_average_ampltiude)
-
cgid.tools.overdata(statistic, session, area, trial, epoch, fa, fb)[source]¶ This applies the routine “statistic” over data. Statistic can either take a K x N array of population analytic signal data, or an A x B x N of array-positioned data. This function inspects the provided “statistic” function. if it starts with “array_” it applies the function to the array packed data. if it starts with “population_” it applies the function to population vector data. otherwise, an error is thrown.
note: static typing and pattern matching to array dimension signatures could render this necessray. sadly a language feature python lacks, afaik.
-
cgid.tools.overlay_events(c1=u'w', c2=u'k', FS=1000.0, nevents=3, fontsize=14, npad=None, labels=None, clip_on=False)¶ Parameters: - c1 ('w') –
- c2 ('k') –
- FS –
- nevents (int; 3) –
- fontsize (int; 14) –
- npad (int or None) –
- labels (default none. Can be) – “markers” for symbols or “names” for [‘Object presented’,’Grip cued’,’Go cue’] “short” for [‘Object’,’Grip’,’Go cue’]
- clip_on (bool; default False) –
-
cgid.tools.overlay_markers(c1=u'w', c2=u'k', FS=1000.0, nevents=3, fontsize=14, npad=None, labels=None, clip_on=False)[source]¶ Parameters: - c1 ('w') –
- c2 ('k') –
- FS –
- nevents (int; 3) –
- fontsize (int; 14) –
- npad (int or None) –
- labels (default none. Can be) – “markers” for symbols or “names” for [‘Object presented’,’Grip cued’,’Go cue’] “short” for [‘Object’,’Grip’,’Go cue’]
- clip_on (bool; default False) –
-
cgid.tools.pack_array_data_interpolate(session, area, data)[source]¶ Accepts a collection of signals from array channels, as well as an array map containing indecies (1-indexed for backwards compatibility with matlab) into that list of channel data.
This will interpolate missing channels as an average of nearest neighbors.
Parameters: - data – should be a NChannel x Ntimes array
- session – the session corresponding to data, needed for array map
- area – the area corresponding to the data, needed to get array map
Returns: returns LxKxNtimes 3D array of the interpolated channel data