Skip to content

Use bin edges internally for frequency-dependent specific energy - #268

Merged
astrofrog merged 3 commits into
hyperion-rt:mainfrom
astrofrog:spectrum-bin-edges
Aug 3, 2026
Merged

Use bin edges internally for frequency-dependent specific energy#268
astrofrog merged 3 commits into
hyperion-rt:mainfrom
astrofrog:spectrum-bin-edges

Conversation

@astrofrog

Copy link
Copy Markdown
Contributor

This implements the suggestion in #267 to use bin edges instead of centers as the canonical way to represent the bins to use for the frequency-dependent specific energy.

@astrofrog
astrofrog marked this pull request as ready for review July 31, 2026 16:19
@astrofrog

astrofrog commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@dnarayanan - just FYI. Is the slight API change an issue for you? (you'd need to use centers= in set_specific_energy_spectrum_bins). Or would you actually prefer to pass bin edges?

@dnarayanan

Copy link
Copy Markdown
Contributor

@dnarayanan - just FYI. Is the slight API change an issue for you? (you'd need to use centers= in set_specific_energy_spectrum_bins). Or would you actually prefer to pass bin edges?

it would be fine for me!

@astrofrog

Copy link
Copy Markdown
Contributor Author

Just to double check, do you rely on the behavior of the end bins being catch-all in the sense they extend to +/- infinity? Or would it also work for you to specify only edges and have those always be finite? (Just to know if we can simplify some code)

@dnarayanan

Copy link
Copy Markdown
Contributor

finite would actually work just fine!

…ing temporary model files to tmpdir and making parametrized test collection deterministic
…ectrum deposit guards never read an undefined value when the spectrum is not being computed
@astrofrog
astrofrog force-pushed the spectrum-bin-edges branch from d65d40e to ae50b0a Compare August 1, 2026 22:54
@astrofrog

Copy link
Copy Markdown
Contributor Author

@dnarayanan - ok thanks! So just to confirm, after the cleanup here which does simplify a bunch of things, the API is e.g.:

m.conf.output.output_specific_energy_spectrum = 'last'  # (or 'all')
m.set_specific_energy_spectrum_bins(np.logspace(11., 16., 101))

where the second method is given the bin edges (so n+1 values for n bins). Can you confirm this is ok for you? (before I merge this and make a new release of Hyperion soon)

@dnarayanan

Copy link
Copy Markdown
Contributor

yep confirmed - this will be fine for me thank you!

@astrofrog
astrofrog merged commit d40983a into hyperion-rt:main Aug 3, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants