Skip to content

Make .slice() in GenericSpectrogram usage clearer #166

@MohamedAli1937

Description

@MohamedAli1937

Describe the feature

Description:

I'm always frustrated when I try to manually slice spectrogram data because I have to figure out the correct array indices for both time and frequency axes, which is error-prone.

I would like it if the GenericSpectrogram.slice() method made slicing more clear and understandable for users.

This feature can gradually pave the way to coordinate-aware Spectra.

Exemple:

# Before slice method (manual slicing)
sliced_data = data[1:5, 1:4]
sliced_times = times[1:5]
sliced_freqs = freqs[1:4]

# After slice method
sliced_spec = spec.slice(time=(times[1], times[4]), freq=(freqs[1], freqs[3]))
print(sliced_spec.times)       # [t1, t2, t3, t4]
print(sliced_spec.frequencies) # [f1, f2, f3]

Proposed solution

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions