test_sphericalHarmonicsGravityModel
Validate spherical-harmonic table bounds and initialization (issue 1682).
Malformed coefficient tables must produce recoverable errors through direct
calls and GravBodyData. Evaluation checks also cover public configuration
changes after initialization. Degree-zero results are compared with point-mass
gravity, degree-two results with a stored baseline, and reinitialized models
with freshly initialized models using the same coefficients.
- test_sphericalHarmonicsGravityModel.test_coefficient_values_can_change_without_reinitialization()[source]
Read updated coefficients when their table dimensions remain valid.
- test_sphericalHarmonicsGravityModel.test_evaluation_preserves_configured_degree_limit()[source]
Retain the existing limit even when larger recurrence tables are available.
- test_sphericalHarmonicsGravityModel.test_evaluation_rechecks_table_dimensions(table_name, defect, explicit_degree)[source]
Reject public table mutations that would cause out-of-bounds reads.
- Parameters:
table_name – Coefficient table to damage after initialization.
defect – Missing storage configuration.
explicit_degree – Whether to use the explicit-degree overload.
- test_sphericalHarmonicsGravityModel.test_evaluation_rejects_unprepared_degree(degree, explicit_degree)[source]
Reject higher degrees even after public configuration allows them.
- Parameters:
degree – Degree exceeding the initialized recurrence storage.
explicit_degree – Whether to use the explicit-degree overload.
- test_sphericalHarmonicsGravityModel.test_evaluation_requires_initialization(explicit_degree)[source]
Reject evaluation before a successful initialization.
- Parameters:
explicit_degree – Whether to use the explicit-degree overload.
- test_sphericalHarmonicsGravityModel.test_invalid_body_parameter_invalidates_initialization(invalid_mu)[source]
Invalidate caches even when the body overload rejects its GM first.
- Parameters:
invalid_mu – Invalid gravitational parameter in m^3/s^2.
- test_sphericalHarmonicsGravityModel.test_reinitialization_rebuilds_recurrence_tables(through_body)[source]
Match fresh models after growing, shrinking, and repeating the degree.
- Parameters:
through_body – Whether all reinitializations use
GravBodyData.
- test_sphericalHarmonicsGravityModel.test_rejects_degree_beyond_tables(degree, through_body)[source]
Reject excessive degrees before any degree-dependent allocation or addition.
- Parameters:
degree – Invalid degree for a three-row table.
through_body – Whether initialization uses
GravBodyData.
- test_sphericalHarmonicsGravityModel.test_rejects_invalid_tables(table_name, defect, through_body)[source]
Reject missing rows and entries in either coefficient table.
- Parameters:
table_name – Coefficient table to damage.
defect – Missing storage configuration.
through_body – Whether initialization uses
GravBodyData.
- test_sphericalHarmonicsGravityModel.test_retry_after_failed_initialization(through_body, previous_degree, failure)[source]
Invalidate failed attempts and recover using only the rebuilt caches.
- Parameters:
through_body – Whether initialization uses
GravBodyData.previous_degree – Optional degree of an earlier successful initialization.
failure – Invalid table or degree configuration.
- test_sphericalHarmonicsGravityModel.test_truncated_evaluation_ignores_unused_rows()[source]
Check only the coefficient prefix required by an explicit lower degree.
- test_sphericalHarmonicsGravityModel.test_valid_fields_are_unchanged(degree, layout, include_zero_degree)[source]
Preserve point-mass and degree-two results with supported table layouts.
- Parameters:
degree – Highest degree retained from the degree-two input tables.
layout – Triangular, padded, or extra unused rows.
include_zero_degree – Whether to include the point-mass contribution.