feat(core): add ReferenceAbundances for Asplund 2009 photospheric data - #417
Conversation
Add module for elemental abundance ratios from Asplund et al. (2009)
"The Chemical Composition of the Sun".
Features:
- Load photospheric and meteoritic abundances from CSV
- Access elements by symbol ('Fe') or atomic number (26)
- Calculate abundance ratios with uncertainty propagation
- Handle NaN uncertainties (replaced with 0 in calculations)
Files:
- solarwindpy/core/abundances.py: ReferenceAbundances class
- solarwindpy/core/data/asplund2009.csv: Table 1 data
- tests/core/test_abundances.py: 21 tests covering all functionality
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>- Add match="Xx" to KeyError test for unknown element - Add new test_invalid_kind_raises_keyerror for invalid kind parameter - Add E231 to flake8 ignore (false positive on f-string format specs) - Follows swp-test-008 pattern from TEST_PATTERNS.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Claude finished @blalterman's task —— View job Code Review Complete ✅SummaryThe ✅ StrengthsCode Quality
Test Coverage (22 comprehensive tests)
Performance & Security
🔍 Minor Observations (Not Blocking)1. Assertion in Production CodeLocation: assertout.shape[0] ==1Issue: Using ifout.shape[0] !=1:
raiseValueError(f"Expected 1 element, found {out.shape[0]} for key {key}")2. Data Validation on LoadObservation: CSV structure is assumed correct without validation.
3. Type HintsCurrent: No type annotations defget_element(self, key: Union[str, int], kind: str="Photosphere") ->pd.Series:📊 Test Quality AnalysisExcellent test patterns observed:
🔄 Integration ReviewClean integration:
🚀 RecommendationAPPROVE - This is high-quality scientific code that:
The minor observations above are enhancements for future consideration, not blockers for this PR. |
SolarWindPy Documentation Validation - Python 3.11✅ Status: PASSED Essential Metrics:
🎉 All essential documentation examples working! |
Uh oh!
There was an error while loading. Please reload this page.
Summary
ReferenceAbundancesclass for elemental abundance ratios from Asplund et al. (2009) "The Chemical Composition of the Sun"'Fe') or atomic number (26)Files Added
solarwindpy/core/abundances.pyReferenceAbundancesclasssolarwindpy/core/data/asplund2009.csvtests/core/test_abundances.pyTest Plan
pytest tests/core/test_abundances.py -v)Reference
Asplund, M., Grevesse, N., Sauval, A. J., & Scott, P. (2009). The Chemical Composition of the Sun. Annual Review of Astronomy and Astrophysics, 47(1), 481–522. https://doi.org/10.1146/annurev.astro.46.060407.145222
🤖 Generated with Claude Code