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

Allow ale formatter to proceed with no velocities specified for instrument/sun position #614

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

AustinSanders
Copy link
Contributor

Overview

ISIS allows states to be created with no velocities. This can be seen in InstrumentPosition and SunPosition tables, and there exists a "hasVelocity" function to test if velocities are present.

The ALE formatter does not currently allow states without velocities. This precludes the creation of drivers for ApolloPan, because ApolloPanInit creates tables that do not contain velocities.

Potential Issue

Ideally, the velocities that are written to the ISD would be empty lists, but this causes issues when deserializing from JSON / ISD. The current workaround is to create np.zeros arrays that match the shape of the positions in the table. I'm not sure if specifying velocity of 0 will have side effects. I suspect that, since this was not previously supported, it won't break anything that exists, but I'm not sure of the validity of any results using the new output.

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.

chkim-usgs
chkim-usgs previously approved these changes Sep 10, 2024
@acpaquette
Copy link
Collaborator

@AustinSanders What issues are you seeing w.r.t. "deserializing from JSON / ISD". I think we could change this to only write the velocities out if they exist. Basically moving instrument_position['velocities'] = velocities into the if block and remove the else section.

@Kelvinrr
Copy link
Collaborator

Since USGSCSM uses ALE for reading, and ALE already has code to adjust for missing velocities (https://github.com/DOI-USGS/ale/blob/main/src/Util.cpp#L582), I think this isn't API breaking.

@AustinSanders
Copy link
Contributor Author

AustinSanders commented Sep 11, 2024

@AustinSanders What issues are you seeing w.r.t. "deserializing from JSON / ISD". I think we could change this to only write the velocities out if they exist. Basically moving instrument_position['velocities'] = velocities into the if block and remove the else section.

Specifying an empty array for velocities results in a json error along the lines of "requires data type of 'array,' but got 'null.'" The driver succeeds and prints an ISD (with verbose on), but the camera instantiation fails later in the process.

I think excluding velocities from the ISD will work (by removing the 'else' as you suggested), I just wasn't sure what would be a better solution to represent "no velocities."

-- edit --

Tested with no velocities key written, and it works fine with the Apollo Pan driver, which was the test case that was failing previously.

@acpaquette
Copy link
Collaborator

That makes sense! Most of the cases for "no velocities" in ISIS and USGSCSM/ALE expects there to be no "velocities" keyword in the ISD

Kelvinrr
Kelvinrr previously approved these changes Sep 16, 2024
@acpaquette
Copy link
Collaborator

@AustinSanders Could this also get a changelog entry?

@Kelvinrr Kelvinrr merged commit 8c522c6 into DOI-USGS:main Sep 17, 2024
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.

4 participants