Repository navigation
Sum utu.spectrum.synthesize() in the precision of the emission measure - #18
Merged
Merged
Conversation
The kernel is computed in double precision, and rounded to the precision of the emission measure, at least single, before the matrix product. A product of two precisions copied a single-precision emission measure whole into double precision. For the 3.3 GB velocity-resolved DEM of a MURaM active region, synthesizing one line in two bins of velocity peaked at 10.1 GB of traced memory, and now peaks at 3.4 GB. The result is in the precision of the emission measure too, which halves it for a single-precision map, and agrees with the double-precision sum to a few parts in ten million. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xqpht97bF4FWsACAA4wQa
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 1514 1537 +23
=========================================
+ Hits 1514 1537 +23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
utu.spectrum.synthesize()now sums the spectrum in the precision of the emission measure instead of always in double precision.Why
The kernel was computed in double precision, and
na.vecdot()multiplies it into the emission measure withnp.matmul. A matrix product of a float64 kernel and a float32 emission measure first copies the whole emission measure to float64. For the 3.3 GB velocity-resolved DEM of a MURaM active region (VDEM_Quadrupolar_x_1380000_M6.6_B1.6), synthesizing one line in two velocity bins peaked at 10.1 GB of traced memory, close to the 16 GB of a GitHub runner.What changed
What remains is mostly the 3.32 GB cube itself. On that scene, the float32 result agrees with the float64 one to a worst relative error of 4.3e-7, on elements above 1e-6 of the maximum.
Tests
test_synthesize_precisionchecks scalar and uncertain inputs, whole and in blocks. The result must be float32 and agree with float64 tortol=1e-6.test_synthesize_precision_emptychecks the precision of the result when no lines are in the passband.-n 4). ruff and black are clean.🤖 Generated with Claude Code
https://claude.ai/code/session_017xqpht97bF4FWsACAA4wQa