This skill performs a review of the code specifically focusing on physics and math correctness.
Instructions
-
Dimensional Analysis:
- Check if unit handling (e.g.,
astropy.units, quantities) is used correctly.
- Ensure operations are physically valid (e.g., not adding Length to Time).
- Unit-Safe Assignment: Avoid direct slice assignment
series[:] = raw_array if series has units. Use series.value[:] = raw_array to update data while preserving unit metadata.
-
Mathematical Inspection:
- Verify equations against known reference papers or standard textbooks.
- Check for numerical stability issues (e.g., division by zero, floating point precision loss).
- Check edge cases (e.g., $f=0$, infinite limits).
-
Sanity Checks:
- Conservation Laws: Create a script to verify energy conservation (Parseval's theorem) for FFT/PSD transformations. Ratio of frequency-domain energy to time-domain energy should be ~1.0.