Closed rjolitz closed 4 months ago
@rjolitz This is the default behavior in SpiceyPy for functions that use return flags to indicate the success of the condition (raise a NotFoundError) and is specifically a different exception for a missing kernel file. The docs describe this here: https://spiceypy.readthedocs.io/en/stable/exceptions.html#not-found-errors.
you can adjust the behavior by temporarily disabling the behavior using the spice.no_found_check()
context manager like:
with spiceypy.no_found_check():
# will not raise an error and found will be False/0
intercept, found = spiceypy.sincpt('Ellipsoid', 'Mars', et_i, 'IAU_MARS', 'NONE', 'MAVEN', 'MAVEN_SEP2', [-1, 0, 0])
or you can disable it for all subsequent calls without needing the context manager using spiceypy.spiceypy.found_check_off()
Oh dear. You're right, that works. I had been adapting some code from IDL into Python and checking it in both to verify accuracy. That flag must have been set somewhere within the initialization or common blocks before the routine was called, which explains why it was returning 0s in the IDL terminal just fine. Thank you, and apologies for the errant report.
@rjolitz great, will mark this issue as resolved.
This is an error in sincpt. Instead of returning 0s when there is no intercept, it errors out entirely. This is a problem, since the error is indistinguishable from a missing kernel. It should just return 0s, as CSPICE does.
I was attempting to determine when Mars intercepts the boresight vector of the MAVEN SEP 1 sensor. When the intercept should be 0, the following error is returned:
When the intercept is 1, no error is returned and the fields are correct.
Here is the code to reproduce the error. Replace the spice dir with wherever you store spice files on your computer: