Lightcurve slicing raises IndexError when the slice bounds are outside the light curve
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
Start by reading Lightcurve.__getitem__ and compare its handling of slice bounds with NumPy array slicing. Reproduce the reported case with lc[3:100] and lc[-100:4]; done means both return the same clipped bins as slicing lc.counts without raising IndexError.
Written by the indexing model from the issue text.
Description
Description of the Bug
Lightcurve.__getitem__ uses the raw slice start/stop to read self.time[stop - 1], so a slice that goes past either end raises IndexError. NumPy arrays, and StingrayTimeseries, clip such slices.
Steps/Code to Replicate the Bug
import numpy as np
from stingray import Lightcurve
lc = Lightcurve(np.arange(10) + 0.5, np.arange(10.) + 1, dt=1)
lc[3:100]
Expected Results
The last 7 bins, as for lc.counts[3:100] (same for lc[-100:4]).
Actual Results
IndexError: index 99 is out of bounds for axis 0 with size 10
Stingray main at e96829ef, Python 3.12, NumPy 2.x.
- Dominant language
- Python
- Stars
- 230
- Forks
- 200
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 22
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from StingraySoftware/stingray
-
power_color() mutates input power array and raises IndexError when freqs_to_exclude reaches frequency boundsPossibly taken @Rohan-Dedhia claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
StingraySoftware/stingray#1052 ·
Maintainers usually reply within 2 days
-
ts[-1] on a StingrayTimeseries or EventList raises TypeError; negative integer indices are wrongPossibly taken @prathameshfuke claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
StingraySoftware/stingray#1056 ·
Maintainers usually reply within 2 days
-
create_gti_mask drops valid points after empty GTIs and crashes with min_length > 0 and dtPossibly taken @Rohan-Dedhia claimed this 5 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
StingraySoftware/stingray#1044 ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
StingraySoftware/stingray#1042 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
StingraySoftware/stingray#1039 · 1 comment ·
Maintainers usually reply within 2 days
All issues in StingraySoftware/stingray
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
521xueweihan/HelloGitHub#4729 ·
-
auto-reported bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
needs-triage type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
pollen-robotics/reachy_mini_conversation_app#631 ·
Maintainers usually reply within 7 days
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100