Skip to content

Conversation

@dhutererprats
Copy link

@dhutererprats dhutererprats commented Dec 11, 2025

  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

The variable shadowFactor is used to determine if a satellite is in the shadow of a planet, and if yes, by how much. A value of 1 meant the satellite was outside the shadow, and a value of 0 meant it was fully in the shadow. However, the name implies the opposite behavior. Thus, we are changing this variable name to reflect better describe what it does.
This PR adopts a clearer name for the eclipse payload field: illuminationFactor. For backward compatibility, shadowFactor continues to work and is formally deprecated until Dec 31, 2026.

C / C++

  • EclipseMsgPayload still stores: double shadowFactor;
  • illuminationFactor is introduced as a preprocessor alias to shadowFactor

Python / SWIG

  • EclipseMsgPayload.illuminationFactor is exposed as a property that delegates to the same getter/setter as shadowFactor (no behavior or performance changes).

  • EclipseMsgPayload.shadowFactor remains available but:

    • Emits a deprecation warning (via Basilisk.utilities.deprecated.deprecationWarn) up to 2026-12-31.
    • Is intended to be removed after that date.
  • EclipseMsgRecorder (from eclipseMsg.recorder()) now also supports:

    recorder.illuminationFactor → alias for recorder.shadowFactor

    so log access uses the new name without breaking existing code.

Modules / Files Touched

  • architecture/msgPayloadDefC/EclipseMsgPayload.h
    • Adds illuminationFactor alias and associated comments.
  • architecture/messaging/msgAutoSource/msgInterfacePy.i.in
    • Adds Python illuminationFactor property on EclipseMsgPayload.
    • Wraps shadowFactor with deprecation behavior.
    • Extends EclipseMsgRecorder to handle illuminationFactor in logs.
  • Eclipse-related environment/sensor modules
    • Call sites updated to use illuminationFactor while remaining compatible with shadowFactor.

Verification

  • Full Basilisk build passes.
  • All eclipse unit tests still pass
  • New regression test:
    • test_shadow_vs_illumination_alias_and_deprecation_behavior validates:
      • illuminationFactor and shadowFactor stay numerically in sync.
      • Before the cutoff date, using shadowFactor emits a deprecation warning (checked with pytest.warns).
      • After the cutoff date, the test expects shadowFactor to raise an error while illuminationFactor continues to work.

Documentation

  • Updated RST documentation for eclipse and related modules (e.g., solarFlux, coarseSunSensor, albedo, etc.) to:
    • Introduce illuminationFactor as the preferred name.
    • Mark shadowFactor as deprecated and scheduled for removal after Dec 31, 2026.
    • Add a short migration note showing the old vs. new name and the deprecation timeline.

Future work

  • On/after 2026-12-31:
    Remove the C macro alias and the Python shadowFactor naming

@dhutererprats dhutererprats self-assigned this Dec 11, 2025
@dhutererprats dhutererprats requested a review from a team as a code owner December 11, 2025 07:14
@dhutererprats dhutererprats moved this to ✅ Done in Basilisk Dec 11, 2025
@dhutererprats dhutererprats added the enhancement New feature or request label Dec 11, 2025
@schaubh schaubh changed the title Feature/illumination factor renaming Rename shadow factor to illumination factor Dec 11, 2025
@schaubh schaubh moved this from ✅ Done to 👀 In review in Basilisk Dec 11, 2025
double shadowFactor;
} EclipseMsgPayload;

//! illuminationFactor alias to be used instead of shadowFactor. shadowFactor will be deprecarted by
Copy link
Contributor

Choose a reason for hiding this comment

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

deprecated is miss-spelled.

Eigen::Vector3d aHat_B; //!< [] (optional) unit direction vector of the sensor/communication boresight axis
double theta; //!< [r] (optional) sensor/communication half-cone angle, must be set if shat_B is specified
double theta_solar; //!< [r] (optional) illumination half-cone angle, treating aHat_B as the surface normal
double min_shadow_factor; //!< [] (optional) minimum amount of illumination due to eclipse necessary to observe
Copy link
Contributor

Choose a reason for hiding this comment

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

You are changing a module variable which is a breaking change. Let's deprecate setting the old module variable name.

\caption{Definition and Explanation of Variables Used.}
\centering \fontsize{10}{10}\selectfont
\begin{tabular}{ | m{5cm}| m{2cm} | m{1.5cm} | m{6cm} |} % Column formatting,
\begin{tabular}{ | m{5cm}| m{2cm} | m{1.5cm} | m{6cm} |} % Column formatting,
Copy link
Contributor

Choose a reason for hiding this comment

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

if you update the TeX you also need to compile the TeX document and commit the updated PDF.

# Forward direction: setting illuminationFactor updates shadowFactor
p.illuminationFactor = 0.8
assert p.illuminationFactor == pytest.approx(0.8)
assert p.shadowFactor == pytest.approx(0.8)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not following what this test is doing? line 420 is still throwing a depreciation warning. When running all BSK unit tests, I should not be seeing a depreciation warning. If I added deprecated.filterwarnings("ignore", "p.shadowFactor") I still saw the deprecation warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

3 participants