+13
−0
Loading
Perform a full review and cleanup of the configuration parsing system to ensure correctness, determinism, and maintainability. This includes resolving all items listed in the Group 5 review plan.
- Bug Fixes:
* Fourier Detrending: Fixed a bug in `detrending.py` where the sine coefficient's per-visit parameter set was silently dropped during hybrid accumulation.
* Stellar Parameters: Fixed `star.py` to store the literal string 'v_sin_i' instead of the distribution tuple, and ensured scope keywords are not ignored in list-form specifications.
* Logging: Corrected `log_func` calls in `star.py` to include the required `plModel` argument to prevent runtime TypeErrors.
* Scoping: Removed unreachable code in `scoping.py` following a ValueError raise.
* EIV Latent Variables: Fixed `detrending.py` to ensure `mu_xi` and `log_tau` correctly inherit scope from the `slope` parameter while allowing explicit user overrides.
- Architecture & Refactoring:
* Circular Imports: Introduced `PyAETNA/sampling/config/parser/_constants.py` to centralize `_SCOPE_KEYWORDS` and `_PRIOR_REF_RE`, resolving circular dependencies between `scoping.py` and `prior_refs.py`.
* Determinism: Implemented a canonical `param_order` in `parse_config` (Jitter -> Norm -> Detrend -> Star -> Planet) to ensure deterministic parameter ordering in chain files across Python versions.
- Documentation & Quality:
* Added module-level docstrings to all parser modules and `priors.py`.
* Improved `priors._parse_prior_string` error messages to explicitly list all ten supported distribution types.
* Cleaned up stale comments and added rationale documentation in `scoping.py` and `prior_refs.py`.
- Testing:
* Created `tests/test_config_parser_group5.py` with 53+ tests covering:
- Scoped parameter parsing and expansion (global, per_instrument, per_visit).
- Prior string parsing for all supported distributions.
- Specific parser logic for Fourier, Polynomials, and Stellar configurations.
* Created `tests/test_eiv_inheritance.py` to verify the latent variable scope inheritance and override logic.