NeuralAnalysis / PyalData

Repository for the Python implementation of the TrialData analysis library.
GNU General Public License v3.0
7 stars 9 forks source link

Add `generate_epoch_fun` #105

Closed bagibence closed 3 years ago

bagibence commented 3 years ago

Add a function for generating functions that can be used for extracting epochs from trials. Useful for extracting the same epoch from multiple dataframes. A simple spin on an idea from @AtMostafa

Example:

exec_epoch = generate_epoch_fun('idx_go_cue', rel_start=0, rel_end=50)
exec_a = restrict_to_interval(df_a, epoch_fun=exec_epoch)
exec_b = restrict_to_interval(df_b, epoch_fun=exec_epoch)

Also touch up how the slices are generated and how _slice_in_trial checks if we can extract an interval from a trial or not. Might fix #102