DOI-USGS / usgscsm

This repository stores USGS Community Sensor Model (CSM) camera models
Other
26 stars 33 forks source link

Non deterministic behavior on `imageToGround` #205

Closed Kelvinrr closed 5 years ago

Kelvinrr commented 5 years ago

Whenever I run imageToGround using CTX images (I assume this may be a problem with the LS camera model and therefore affects all LS images) subsequent calls return different values on occasion. Sometimes returns a number and later nans on the same camera instance.

csmerror

This is simply running the footprint generation code from autocnet server but the pain point seems to be imageToGround. Times when shapely errors out are times when imageToGround produces nans.

Kelvinrr commented 5 years ago

This was caused with the number of ephemerides set to 3 and quats set to ~1000 (numbers coming from ISIS spice inited cubes originally, I moved to using spice kernels and manually set the numbers of ephems and quats and this was the result). Changing both to closer match the number of lines and samples (a couple thousand per image) it no longer has the issue. No idea why.

jessemapel commented 5 years ago

@Kelvinrr Is this after #202 This looks like what Adam found

Kelvinrr commented 5 years ago

yeah clean build from dev

jessemapel commented 5 years ago

@kelvinrr Can you post a gist of the notebook you were running and/or provide the ISD/state for the LS that you found this with?

jessemapel commented 5 years ago

This appears to be caused by the langrange interpolation not checking that it actually has enough data to interpolate over and is ready garbage off either end of the array.

thareUSGS commented 5 years ago

In the past we have always had to add (extrapolate) 10 ephemerides to the begin and end of the ISD. Would that help here? for more see: https://github.com/USGS-Astrogeology/ISIS3/blob/e53a8c26e57c79cc3ab373edc2f5eeacf6f15663/isis/src/socet/apps/socetlinescankeywords/main.cpp#L437

jessemapel commented 5 years ago

@thareUSGS I think we just have to have a minimum of ~6 points. Regardless, the lagrange interpolation code should handle this stuff more gracefully. Lagrange interpolation should work with as few as 2 points.