Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MJD/JDE UTC fix + to_time_scale now available in Python #332

Merged
merged 5 commits into from
Oct 10, 2024

Conversation

ChristopherRabotin
Copy link
Member

@ChristopherRabotin ChristopherRabotin commented Oct 7, 2024

Closes #331
Closes #257
Closes #302

This also makes #229 much easier to get started on. My only hesitation with that ticket is that in Python, we use init_from_unix_seconds a lot and we're launching in a few weeks so I'm hesitant to change my habits this close to launch.

src/epoch/mod.rs Outdated
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes here are for the initializers that were moved to initializers.rs.


#[must_use]
pub fn from_mjd_utc(days: f64) -> Self {
Self::from_mjd_in_time_scale(days, TimeScale::UTC)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function previously called from_mjd_tai and then manually applied the leap seconds. Now it calls the from_mjd_in_time_scale function which correctly sets the time scale without changing the duration.


#[must_use]
pub fn from_jde_utc(days: f64) -> Self {
Self::from_jde_in_time_scale(days, TimeScale::UTC)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The from_jde_utc function has the same bug as in #302 , so I've done the same fix.

@@ -2069,11 +2069,17 @@ fn regression_test_gh_282() {
fn regression_test_gh_288() {
use core::str::FromStr;
let epoch = Epoch::from_str("2021-03-06 11:14:40.9960 GPST").unwrap();
let epoch_from_gpst =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional test for #257 .

@@ -2137,3 +2143,32 @@ fn regression_test_gh_317() {
nanos
);
}

#[test]
fn regression_test_gh_302() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New regression test for #302 .

@@ -25,6 +25,9 @@ def test_strtime():
print(f"caught {e}")
else:
raise AssertionError("failed to catch parsing error")

epoch_tdb = epoch.to_time_scale(TimeScale.TDB)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a Python test for #331.

@ChristopherRabotin ChristopherRabotin merged commit 1033bb0 into master Oct 10, 2024
28 checks passed
@ChristopherRabotin ChristopherRabotin deleted the gh-331-in-time-scale-python branch October 10, 2024 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant