Skip to content

Hermite Position Reduction - #731

Merged
acpaquette merged 22 commits into
DOI-USGS:mainfrom
acpaquette:hermite
Jul 22, 2026
Merged

Hermite Position Reduction#731
acpaquette merged 22 commits into
DOI-USGS:mainfrom
acpaquette:hermite

Conversation

@acpaquette

Copy link
Copy Markdown
Collaborator

This PR adds the ability to reduce the number of ephemeris positions in ALE using the exsiting hermite spline creation code in the States class in the C++ side of ALE

Licensing

This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words:

This work is free and unencumbered software released into the public domain. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain.

  • I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

@Kelvinrr
Kelvinrr self-requested a review July 17, 2026 16:06

@Kelvinrr Kelvinrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Biggest concern is the unit question, just some clarity needed there.

Comment thread ale/driver_verification.py Outdated
Comment thread setup.py Outdated
Comment on lines -113 to -122
def sensor_position(self):
"""
CaSSIS sets LT_SURFACE_CORRECT with LIGHTTIME_CORRECTION=LT+S, so ISIS
applies the surface light-time correction. The shared
NaifSpice.sensor_position samples the target body at the raw ephemeris
time in that branch, but ISIS samples it at the surface-light-time
adjusted time (ephem - obs_tar_lt + radius_lt); the body moves along its
orbit during that interval, which otherwise leaves a constant
tens-of-meters camera-center bias versus ISIS. This override applies that
for CaSSIS only, so the shared path is unchanged for every other sensor.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why remove from TGO?

@acpaquette acpaquette Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is related to adding the TGO_CASSIS specific check in the sensor_position property. Currently, we are maintaining two implementations of the light time correction sensor_position code, one in the base Driver class the other in the TGO_CASSIS concrete driver. Currently, there is only one driver but it would need the duplicate implementation if any new drivers are added for TGO_CASSIS that use the NaifSpice mixin.

Comment thread ale/base/data_naif.py
Comment on lines +663 to +664
altitude = (middle_magnitude - radius) * 1000
tol = self.pixel_size * altitude / self.focal_length / 100.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

probably need comments on conversions here. Altitude is being converted from KM to meters, I assume, but I do not know what deviding the tol by 100 is doing. Altitude is in M but tol is in some other unit?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Dividing by 100 is just setting the tolerance to 1/100th of the computed pixel resolution

Comment thread ale/base/data_naif.py
"spk_table_start_time": 302228504.36824864,
"spk_table_end_time": 302228558.33807606,
"spk_table_original_size": 25,
"spk_table_original_size": 2,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe I forgot what this value was, but if it's the number of ephems, it seems the actual number in the ISD did not change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a weird case where we are using a cropped LRO cube that has been reduced to one line but retains the InstrumentPosition table as if it was the full cube. So the change to the formatter is changing the spk_table_original_size in the resulting ISD.

If we wanted to get the actual value in there from the ISIS table:

  Name                 = InstrumentPosition
  StartByte            = 117778
  Bytes                = 1400
  Records              = 25
  ByteOrder            = Lsb
  CacheType            = HermiteSpline
  SpkTableStartTime    = 302228504.36825
  SpkTableEndTime      = 302228558.33808
  SpkTableOriginalSize = 816.0
  Description          = "Created by spiceinit"
  Kernels              = $lro/kernels/spk/fdf29r_2009182_2009213_v01.bsp

It should be 816.0 but I can't think of an easy way to transfer it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I figured it was something like that.

Comment thread ale/base/data_naif.py
Comment on lines +585 to +588
if self.instrument_id == "TGO_CASSIS":
adjusted_time = ephem - obs_tar_lts + radius_lt
ssb_tars_kwargs["startEt"] = adjusted_time[0]
ssb_tars_kwargs["stopEt"] = adjusted_time[-1]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this to avoid overwriting the entire function? Is there a clean way to use ALE's paradigm instead of an if statement?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this would be a property that a user would pass in. The way I see handling it without an explicit check is to add a new property on the base NaifSpice mixin that is a boolean for adjusted_time and default it to false. Then the concrete drivers could override it as necessary. It would only be used by concrete Cassis drivers that use the NaifSpice mixin

Comment thread ale/base/data_naif.py Outdated
@acpaquette
acpaquette requested a review from Kelvinrr July 22, 2026 20:13
@acpaquette
acpaquette merged commit 769504d into DOI-USGS:main Jul 22, 2026
13 checks passed
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.

2 participants