Repository navigation
Port the AtomicLine2 and ElectronImpact1 rates; fix atdb.fits reading - #7
Merged
Merged
Conversation
- rate(::AtomicLine2, cell; levels, mass, vturb) follows XSTAR ucalc type 50: orders the two levels by energy, returns the decay rate (A), emitted power and line-centre opacity; add level_table(db) for the level lookup - Load the database with scale=false: FITSFiles.jl <= 0.3.2 rounds unscaled Int32 columns through Float32, which corrupted the real-array pointers beyond 2^24 (fixed in FITSFiles.jl#50) - Tests: unit tests against the ucalc formulas; opt-in database checks (levels read correctly, all 730,369 AtomicLine2 records resolve and are finite) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- rate(::ElectronImpact1, cell; levels) follows XSTAR ucalc type 56: orders the levels by energy, interpolates the effective collision strength linearly in log T (extrapolating the end segments as ucalc's hunt does) and returns the excitation and de-excitation rates, related by detailed balance - Cell gains ntot (the hydrogen density, XSTAR xpx); level data stay in tables and the radiation field will be a separate object (documented) - Tests: formula check against ucalc; opt-in database check over all 87,231 records at 1e3, 1e4 and 1e5 K (finite, non-negative, detailed balance; the 188 degenerate-energy pairs are skipped as in ucalc) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Summary
AtomicLine2(XSTARucalctype 50, 730k records):rate(coef, cell; levels, mass, vturb)orders the two levels by energy, returns the decay rate (A), emitted power and line-centre opacity.irateis always 0, as inucalc(no reverse term).level_table(db)builds the level lookup.ElectronImpact1(type 56, 87k records): excitation and de-excitation rates from Υ interpolated in log T, related by detailed balance. Levels with equal energies are skipped as inucalc.Cellgainsntot(XSTARxpx).Cellholds only the local gas state; level data stay in tables and the radiation field will be a separate object.Radix.loadnow callsfits(io; scale=false). FITSFiles.jl <= 0.3.2 rounds unscaled Int32 columns through Float32, which corrupted the pointers to the reals beyond 2^24 for about 1M of the 1.2M records (values read from the wrong place). Fixed upstream in Don't scale binary table columns without TSCAL/TZERO FITSFiles.jl#50; the keyword can be removed once a release containing it is required.Tests
ucalcformulas.RADIX_ATDB=/path/to/atdb.fits): levels read correctly, all 730,369AtomicLine2records resolve to two known levels with finite results and downward decays, all 87,231ElectronImpact1records give finite, non-negative rates that obey detailed balance at 1e3, 1e4 and 1e5 K.Notes
AtomicLine2records with no wavelength (λ = 0), whereucalcwould divide by zero, the emitted power uses the level energy difference.atomicline2) are included becauseelectronimpact1is stacked on it.🤖 Generated with Claude Code