Skip to content

Fix lc.shift() not updating tstart attribute#967

Closed
anuragchvn-blip wants to merge 1 commit intoStingraySoftware:mainfrom
anuragchvn-blip:bugfix-for-issue911
Closed

Fix lc.shift() not updating tstart attribute#967
anuragchvn-blip wants to merge 1 commit intoStingraySoftware:mainfrom
anuragchvn-blip:bugfix-for-issue911

Conversation

@anuragchvn-blip
Copy link
Copy Markdown

Relevant Issue(s)/PR(s)

Fixes #911

Provide an overview of the implemented solution

The Lightcurve.shift() method now properly updates the tstart attribute after shifting. Previously, tstart remained unchanged after calling shift(), causing inconsistency between tstart and the actual time[0] - 0.5 * dt.

The fix overrides the parent shift() method to recalculate tstart after the time array is shifted.

Is there a new dependency introduced by your contribution?

No

Any other comments?

  • Handles both scalar and iterable dt values
  • Works correctly with both inplace=True and inplace=False

Fixes StingraySoftware#911. The shift method in Lightcurve now properly updates the tstart attribute to remain consistent with the shifted time array.

The fix overrides the parent shift method to recalculate tstart after shifting, ensuring tstart = time[0] - 0.5 * dt as expected.
@matteobachetti
Copy link
Copy Markdown
Member

Thanks for your contribution @anuragchvn-blip , but @swapsha96 's solution in #971 is more elegant, and he tested the new feature properly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lc.shift() does not update tstart Lightcurve attribute

2 participants