Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weedout #281

Merged
merged 17 commits into from
Mar 20, 2024
Merged

Weedout #281

merged 17 commits into from
Mar 20, 2024

Conversation

ajwheeler
Copy link
Owner

@ajwheeler ajwheeler commented Mar 11, 2024

This PR implements a function to identify all lines below a certain depth, were they synthesized in isolation. It is an attempt to address #278.

This implementation takes a first pass, identifying important lines by comparing their wavelength-integrated absorption coefficient to the total absorption, then does single-line synthesis on a more limited set of lines in the linelist. This works well for line depths down to 1% (and possible shallower), but it's not very fast. It's probably sufficient for now.

TODO

  • tests
  • documentation
  • deal with multiplets

Copy link

codecov bot commented Mar 11, 2024

Codecov Report

Attention: Patch coverage is 73.84615% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 89.95%. Comparing base (4d6b68f) to head (0a40455).

Files Patch % Lines
src/prune_linelist.jl 69.09% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #281      +/-   ##
==========================================
- Coverage   90.19%   89.95%   -0.25%     
==========================================
  Files          26       27       +1     
  Lines        2070     2130      +60     
==========================================
+ Hits         1867     1916      +49     
- Misses        203      214      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ajwheeler
Copy link
Owner Author

OK, the finished version of this filters lines by looking at the ratio of the line-center alpha (estimated assuming a tophat profile with width equal to the Doppler width) to the continuum alpha. This seems to work well. Following that, the lines that make it through are ordered by EW. This is so that you can run prune_linelist once and the choose exactly the threshold you want if you are making a plot. If you don't order by EW, it saves time and the lines remain in wavelength order.

There is also a function merge_close_lines that merges line of the same species withing a configurable wavelength distance. Rather than returning another vector of line objects (what would they even be?) it returns (wavelength, species) pairs, with the species as strings, not Korg.Species objects. I don't love this interface, but I can't think of anything better.

Two general changes to the code made as part of this PR:

  • handling of the wavelength arguments passed to synthesize has been split into a separte function, rather than having multiple methods of synthesize. It will no loner fail if you pass a single wavelength range (not wrapped in a vector).
  • synthesize has a new keyword argument, use_chemical_equilibrium_from, which will not recompute the chemical equilibirum if you pass a previously computed sol. It's up to the user to ensure that the atmosphere and abundances are the same, and this is warned about in the docs. I think this will be generally useful.

@ajwheeler ajwheeler marked this pull request as ready for review March 14, 2024 20:48
src/prune_linelist.jl Outdated Show resolved Hide resolved
src/prune_linelist.jl Outdated Show resolved Hide resolved
src/prune_linelist.jl Show resolved Hide resolved
src/prune_linelist.jl Show resolved Hide resolved
src/prune_linelist.jl Outdated Show resolved Hide resolved
src/prune_linelist.jl Outdated Show resolved Hide resolved
@ajwheeler ajwheeler merged commit bde252f into main Mar 20, 2024
9 checks passed
@ajwheeler ajwheeler deleted the weedout branch March 20, 2024 13:53
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.

None yet

1 participant