Skip to content

[Question] Why is restrict_to_interval inclusive on both ends of the specified slice? #129

@raeedcho

Description

@raeedcho

I'm a little bit confused as to why the restrict_to_interval function goes against Python convention to make the slice it pulls out inclusive on both the beginning and the end.

Currently, it's throwing an error for me when I try to slice from my idx_goCueTime to idx_endTime (which for my data structure points to the end of the trial--e.g. td.loc[1,'M1_spikes'].shape[0] returns 11359 and td.loc[1,'idx_endTime'] returns 11359). Right now, restrict_to_interval tells me that the idx_endTime is outside the trial range, unless I add a rel_end=-1 to the function arguments (which I can do, but doesn't really seem to make much sense to me).

Similarly, I always feel like I'm off by 1 on the number of bins I ask for when I use the function.

I'm sure there was a compelling reason to make it inclusive on the end--does anyone know what it was?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions