Skip to content

PSMRTS/ISIS Integration for Small Irregular Body Support - #6090

Open
KrisBecker wants to merge 33 commits into
DOI-USGS:devfrom
UA-LPL:feature/isis-psmrts-integration
Open

PSMRTS/ISIS Integration for Small Irregular Body Support#6090
KrisBecker wants to merge 33 commits into
DOI-USGS:devfrom
UA-LPL:feature/isis-psmrts-integration

Conversation

@KrisBecker

Copy link
Copy Markdown
Contributor

Description

This PR integrates PSMRTS into the ISIS system. It provides support for small, irregular target bodies that include features/enhancements to the ISIS Shape Model System including regional DTMs, multiple shape models per image, shape and tracer resource reuse, and double precision planetary surface ray tracing intercepts.

Efforts were made to minimize the impact on existing ISIS code base. Some notable modifications have been made to enhance/support the integration:

  • The ISIS main CMakeLists.txt file has been changed to incorporate PSMRTS into the build system.
  • The recent spiceinit change to check for the existence of a shape model was modified specifically for special PSMRTS file formatting.
  • The Isis::BulletShapeModel::plate_index() method was added to support testing/comparisons of plate index of shape model intercepts.
  • The Isis::DskShapeModel::plate_index() method was added to support testing/comparisons of plate index of shape model intercepts.
  • A bug was fixed in Isis::DskShapeModel::intersectSurface() that sets the local normal intercept when a successful trace was made.
  • An additional Target * argument was added to Isis::NaifDskPlateModel to fully support creation of models without a cube source to support testing (mainly).
  • The Isis::PsmrtsShapeModel class and Isis::IsisPsmrtsUtilities.cpp functions code was added to support PSMRTS/ISIS integration implementation.
  • PSMRTS was integrated into Isis::ShapeModelFactory (4 lines of code) to test for and instantiate PSMRTS shape models.
  • New ISIS GTests (10 total) were added:
    • PsmrtsShapeModelTests.cpp tests the default constructor and runs direct comparisons of Isis::BulletShapeModel, Isis::DskShapeModel, PSMRTS::Bullet and PSMRTS:NaifDsk tracers using a global lat/lon evenly spaced 7x13 grid on a Bennu 88cm global shape model.
    • PsmrtsSpiceinitTest.cpp tests existing behavior of various spiceinit commands and how the PSMRTS integration interacts with ISIS; tests PSMRTS priority testing of regional DEMs; runs extensive comparisons of campt operations on a evenly space 10x10 line/sample grid within an OSIRIS-REx image on the 88cm global DTM using PSMRTS::Bullet and ISIS::Bullet.

Related Issue

See issue #6089 for a complete description.

How Has This Been Validated?

Numerous tests have been created that ensure existing ISIS shape model and spiceinit behavior as well as comparisons with existing ISIS small body ray tracing systems. The results of these tests on a Mac Arm system are shown here.

We also have successfully built this branch on Mac Intel and Ubuntu 22 systems.

build % ctest --output-on-error -R Psmrts
Test project /Users/kbecker/APEX/PSMRTS/GitCheckOuts/PsmrtsIsisTracer/ISIS3/build
      Start 2510: PsmrtsShapeModelTests.DefaultConstructor
 1/10 Test #2510: PsmrtsShapeModelTests.DefaultConstructor ......   Passed    0.33 sec
      Start 2511: PsmrtsShapeModelTests.IsisTracerComparisons
 2/10 Test #2511: PsmrtsShapeModelTests.IsisTracerComparisons ...   Passed    1.23 sec
      Start 2512: PsmrtsSpiceint.PsmrtsSpiceinitBullet
 3/10 Test #2512: PsmrtsSpiceint.PsmrtsSpiceinitBullet ..........   Passed    0.96 sec
      Start 2513: PsmrtsSpiceint.PsmrtsSpiceinitNaifDsk
 4/10 Test #2513: PsmrtsSpiceint.PsmrtsSpiceinitNaifDsk .........   Passed    0.80 sec
      Start 2514: PsmrtsSpiceint.PsmrtsSpiceinitEllipsoid
 5/10 Test #2514: PsmrtsSpiceint.PsmrtsSpiceinitEllipsoid .......   Passed    0.80 sec
      Start 2515: PsmrtsSpiceint.PsmrtsSpiceinitSpheroid
 6/10 Test #2515: PsmrtsSpiceint.PsmrtsSpiceinitSpheroid ........   Passed    0.81 sec
      Start 2516: PsmrtsSpiceint.PsmrtsSpiceinitIsisBullet
 7/10 Test #2516: PsmrtsSpiceint.PsmrtsSpiceinitIsisBullet ......   Passed    0.80 sec
      Start 2517: PsmrtsSpiceint.PsmrtsSpiceinitIsisNaifDsk
 8/10 Test #2517: PsmrtsSpiceint.PsmrtsSpiceinitIsisNaifDsk .....   Passed    0.79 sec
      Start 2518: PsmrtsSpiceint.PsmrtsSpiceinitPriorityTest
 9/10 Test #2518: PsmrtsSpiceint.PsmrtsSpiceinitPriorityTest ....   Passed    0.81 sec
      Start 2519: PsmrtsSpiceint.PsmrtsSpiceinitComparison
10/10 Test #2519: PsmrtsSpiceint.PsmrtsSpiceinitComparison ......   Passed    1.26 sec

100% tests passed, 0 tests failed out of 10

Total Test time (real) =   8.66 sec

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation change (update to the documentation; no code change)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Infrastructure change (changes to things like CI or the build system that do not impact users)

Checklist:

  • I have read and agree to abide by the Code of Conduct
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • My changes include code created using generative AI.
  • I have added my user impacting change to the CHANGELOG.md document.

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.

KrisBecker added 24 commits June 2, 2026 15:01
Remove the setSurfacePoint() method.

Move some inline methods to the cpp file.

Remove print statements and implement debug options.

Allow for overrides/specification of PSMRTS shape model parameterization using. PvlFlatMap containing keywords.
Add Target pointer with default to specialized constructor.

Added plate_index() method to return the index of the facet containing the intercept.

Fixed issue with setting the local normal intercept properly in interceptSurface().
Bump the miniimum CMake version to 3.24 due to use of find_package feature in FetchContent_Declare.

Move PSMRTS installation to seperate cmake file, psmrts_system.cmake, to minimize PSMRTS footprint in ISIS.
The PSMRTS Bullet tracer was invoked when providing just a DSK file with no specific ray tracer engine specified. Added requires_psmrts() method to detect this condition and do the right thing.

Removed warning about missing radii in PsmrtsShapeModel that was casing warnings in tests.
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_6090".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_6090".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_6090".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

Removed the OVERRIDE_FIND_PACKAGE in the FetchContent_Declare configuration in psmrts_system.cmake.

Removed find_package() call in CMakeLists.txt to correct ISIS build failures. Use psmrts::psmrts alias in ISIS library build dependences.
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_6090".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

@acpaquette acpaquette 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.

Overall, the code looks good! The functions defined in IsisPsmrtsUtilities seem to replicate existing functionality within the ISIS code base. It would be nice to transition some of those functions with overlapping functionality to use existing ISIS functions/classes but not a deal breaker.

Doing some initial testing comparing the existing ISIS bullet shapemodel implementation against the implementation within PSMRTS. When projecting a NEAR MSI image using the ISIS bullet tracer for one cube, and the PSMRTs bullet tracer for another cube. The PSMRTS engine is taking about 3 times longer to project the image at about 30 seconds compared to the ISIS bullet tracer which takes about 10 seconds to project the image.

The raw image can be found here:
m0132383354f4_2p.fit
m0132383354f4_2p.lbl

The DSK used is a global dsk of EROS:

(isis_build_env) acpaquette@IGSWZA281L2310 RayTracingShapeModel % dskbrief input/ErosHR.bds

DSKBRIEF Program; Ver. 3.0.0, 02-NOV-2021; Toolkit Ver. N0067

Summary for: input/ErosHR.bds

Body:                               2000433 (EROS)
  Surface:                          2000433 (Name not available)
  Reference frame:                  IAU_EROS
  Coordinate system:                Planetocentric Latitudinal
    Min, max longitude  (deg):       -180.000     180.000
    Min, max latitude   (deg):        -90.0000     90.0000
    Min, max radius      (km):          2.97303    17.6330

Here are the spiceinit commands used:

spiceinit from= m0132383354f4_2p_iof_dbl_Psmrts.cub shape=user model= 'bullet::input/ErosHR.bds' -pref= MyPreferences_Psmrts
spiceinit from= m0132383354f4_2p_iof_dbl_Bullet.cub shape=user model= input/ErosHR.bds -pref= input/MyPreferences_Bullet

Here are the Preference files:
MyPreference_Psmrts

########################################################
## PSMRTs Ray Tracing Engine
#########################################################

Group = ShapeModel
  RayTraceEngine = psmrts
  OnError = Continue
EndGroup

End

MyPreference_Bullet

########################################################
## Bullet Ray Tracing Engine
#########################################################

Group = ShapeModel
  RayTraceEngine = Bullet
  OnError = Continue
EndGroup

End

Cam2Map commands:

cam2map from= m0132383354f4_2p_iof_dbl_Psmrts.cub to= m0132383354f4_2p_iof_dbl_Psmrts.proj.cub

cam2map from= m0132383354f4_2p_iof_dbl_Bullet.cub to= m0132383354f4_2p_iof_dbl_Bullet.proj.cub

There was also issues with the naifdsk tracer in PSMRTS not being able to project the image. The image would be all black at the end of running cam2map. That image was created using:

spiceinit from= m0132383354f4_2p_iof_dbl_Psmrts.cub shape=user model= 'naifdsk::input/ErosHR.bds' -pref= MyPreferences_Psmrts

I am not entirely sure where the slowdown is occurring or if I am doing something wrong when initializing the PSMRTS engine to perform the projection. Any advice or insight into this would be helpful.

A bug was found in PSMRST DSK min/max radius which caused lat/lon traces (common to mapping) operations to fail. This was a PSMRTS fix.

Copies of PSMRTS ray trace objects contributed most to the slowness of psmrts::BulletTracer operations when compared to Isis::Bullet implemetation.

Implement efficient speedups of lat/lon traces that exploit common traces to acquire local radius before observer traces that check occclusion. NOTE additional trace is required to acquire facet intercept (index) and normals.

Implement exclusive use of shape model intercept normals for emission and incidence angles.

Fix implementations of lat/lon intercepts that properly check for occlusion.

Update Psmrts/Isis tests.
@github-actions

Copy link
Copy Markdown
Contributor

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_6090".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

@github-actions

Copy link
Copy Markdown
Contributor

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_6090".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

I had added support for shape models that have a “pvl” file extension but this conflicts with a ShapeModelFactory test so I removed support for that file type. There are other suitable options in PSMRTS.
@github-actions

Copy link
Copy Markdown
Contributor

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_6090".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

@github-actions

Copy link
Copy Markdown
Contributor

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_6090".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

@acpaquette

Copy link
Copy Markdown
Collaborator

@KrisBecker After running the testing the above NEAR image and a the CTX image I sent against ISIS built in Release mode I got similar results to Kris. Timing parity between the implementations and overall reduced runtimes. In some cases PSMRTs is a bit slower but not prohibatively. I am going to give this PR another look over and we should probably be good to merge

@KrisBecker

Copy link
Copy Markdown
Contributor Author

@acpaquette Please hold off on the merge for a bit until I have time to evaluate some additional optimizations. Attached are the cam2map profile runs using Isis::EllipsoidShape and PsmrtsShapeModel with the same ellipsoid definition. I think there are some improvements to be made.

Screenshot 2026-07-23 at 3 10 18 PM

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