test_albedo

test_albedo.test_albedo_AfluxAtInstrument_positive_and_consistent()[source]

AfluxAtInstrument and AfluxAtInstrumentMax (W/m^2) must both be positive. AfluxAtInstrumentMax ignores the FOV cone filter, so it must be >= AfluxAtInstrument.

test_albedo.test_albedo_altitudeRateLimit_suppresses_output()[source]

Setting altitudeRateLimit=0 must zero albedo for any satellite above the surface.

The altitude/radius ratio for the standard 6000 km orbit is ~0.94, which exceeds a limit of 0. The module must skip that planet and write 0 for all output fields.

test_albedo.test_albedo_eclipse_uses_planet_relative_sun_vector()[source]

isPatchEclipsed() must use the planet-relative Sun vector r_SP_N = r_SN_N - r_PN_N, not the inertial Sun position.

A rigid translation of the whole scene (planet + Sun + SC) leaves every relative distance and angle unchanged. Eclipse output must therefore be identical regardless of where the scene is placed in inertial space.

r_SN_N was passed directly to the penumbra geometry instead of r_SP_N. With the planet offset by 1e12 m (~6.7 AU), the inertial Sun distance grows from 1 AU to ~7.7 AU.

test_albedo.test_albedo_illuminationFactor_scaling()[source]

User-set illuminationFactorAtdA (eclipseCase=False) must scale albedo linearly.

All other parameters are fixed; only illuminationFactorAtdA changes from 1.0 to 0.5. Both albedoAtInstrument and AfluxAtInstrument must halve.

test_albedo.test_albedo_instConfig_defaults_fallback()[source]

Default instConfig_t (fov<0, nHat_B=zeros) must use module-level defaults.

The test overrides albModule.nHat_B_default and albModule.fov_default to match a useful geometry, adds a default-constructed instConfig_t, and verifies that the result is identical to an explicit config with the same values.

test_albedo.test_albedo_invalid_file(tmp_path)[source]

Verify that Albedo model returns gracefully when file cannot be loaded.

Regression test for BSK-428 where model would segfault when invalid file was specified.

Note

The model is not in a usable state if this initialization fails. Ideally an exception would be thrown, but the SWIG infrastructure doesn’t appear to be setup to handle C++ exceptions, so we settle for printing a message and not segfaulting.

test_albedo.test_albedo_nHat_B_normalization()[source]

Non-unit nHat_B must be normalised; output must be identical to the unit version.

test_albedo.test_ir_flux_conservation()[source]

Test IR flux conservation for PlanetGrid (Lambertian sphere).

test_albedo.test_planet_grid_compute_patches_requires_initialize()[source]

Verify direct PlanetGrid calls raise a Python exception before initialization.

test_albedo.test_unitAlbedo(planetCase, modelType, useEclipse)[source]

Validation Test Description

This section describes the specific unit tests conducted on this module. The test contains 4 tests and is located at test_albedo.py. The success criteria is to match the outputs with the generated truth.

Parameters:
  • planetCase (string) – Defines which planet to use. Options include “earth” and “mars”.

  • modelType (string) – Defines which albedo model to use. Options include “ALBEDO_AVG_EXPLICIT”, “ALBEDO_AVG_IMPLICIT” and “ALBEDO_DATA”.

  • useEclipse (bool) – Defines if the eclipse is considered for this parameterized unit test.

Description of Variables Being Tested

In this file, we are checking the values of the variable:

albedoAtInstrument

which are pulled from the log data to see if they match with the expected truth values.