Skip to content

Making possible to edit first_samp after using crop #13278

Closed

Description

@lilly-sanchezz

Describe the new feature or enhancement

Hi!

I want to suggest the possibility to change the first_samp attribute when using crop on a raw object.
I understand that the reason why this attribute does not start at 0 is to mantain a record of the time frame of the original signal where the segment was extracted, but there are cases where you owuld like to treat the cropped segments as independient signals.
It has been suggested to usea RawArrays as an alternative to reset first_samp values, but in my point of view, implementing the option on the crop function makes it easier and faster.

Describe your proposed implementation

Just that, the ability to reset the value of the attribute to treat cropped signals independient raw objects.

Describe possible alternatives

Another alternative is to include information on the documentation about the way crop treats the first _samp on the segments and alternatives to reset it, because this is not noted, and by looking at different entries both on the forum and github we can tell is not that obvious.

Additional context

No response

Activity

  1. larsoner commented on Jun 10, 2025

    @larsoner
    Member

    I guess we could add a reset_first_samp=False default where if you set it to True would have the desired behavior. I could live with it as long as we document that it could mess things up (e.g., if you extract events then crop with reset_first_samp=True and try to use those original events, things will be broken).

  2. Famous077 commented on Feb 25, 2026

    @Famous077
    Contributor

    HI @lilly-sanchezz @larsoner , I'd be happy to start with the documentation improvement while
    the feature design is being discussed. I can add a note to the
    crop() docstring explaining how first_samp behaves after cropping
    and mention RawArray as the current workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions