-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add new GauntFactor class and add Itoh integrated Gaunt factors to f-f radiative loss #293
Conversation
As we implement this, I'd like to think carefully about how these are related to the other Gaunt factor methods. Currently, we have the following methods for calculating Gaunt factors:
In our current organization of the API, even though most of these are private methods, it can be confusing why we have so many methods named very similar things and why/where each is relevant. While implementing these new methods, whether there is some better top level API for calculating these such that we minimize the number of entry points for calculating a Gaunt factor and make it more obvious to a user (or future developer, including ourselves, why method is preferred over and another). |
I'll spend a bit of time thinking about this. Open to suggestions! |
Unless I'm missing something, the actual data that's read in by If that's correct, perhaps it would be better to create a new module or class just dedicated to the Gaunt factor, and pull these functions out of the ion class. Then, call some overarching function along the lines of This is trivial for free-free emission. For example, The free-bound case is slightly more involved, because it depends on charge, ionization potential, and principal quantum number. However, nothing about this needs to be inherently tied to the ion class and each could be passed to a function. Would something along those lines make sense? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #293 +/- ##
==========================================
- Coverage 93.14% 90.46% -2.68%
==========================================
Files 38 40 +2
Lines 3165 3367 +202
==========================================
+ Hits 2948 3046 +98
- Misses 217 321 +104 ☔ View full report in Codecov by Sentry. |
@wtbarnes, before I take this much further, your input would be welcome. I've created a new Edit: also, I was wrong in my previous comment that some of the Gaunt factors don't depend on any ion properties. The (It still needs error handling and debugging, of course. It's a bit clumsy with |
Sorry for neglecting this for so long! tl;dr I'm pro this approach overall. I have some thoughts on how exactly to implement this object. I've left a few high-level comments below and some inline comments on the code. At first I was a bit skeptical of having these on a separate object, but I'm now thinking this is probably a good idea. Exposed as a separate object, they can still use the same data ingestion model as This also helps to shorten the
We could always change this in the way the parsing is done to be agnostic of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some implementation comments at this point. My overall thinking is that GauntFactor
should not care about the Ion
object at all and should just provide the relevant datasets and methods for computing the gaunt factor in various scenarios. It is then the job of the Ion
object to provide the ion-specific inputs to those methods when using the appropriate gaunt factor calculation.
Thanks for the suggestions! I'll try to flesh this out a bit more. |
@wtbarnes, has something changed with the github actions in the recent pulls? Pytest is passing on my machine, but failing on Github (including lots of tests not related to this PR). |
Co-authored-by: Will Barnes <will.t.barnes@gmail.com>
Co-authored-by: Will Barnes <will.t.barnes@gmail.com>
Co-authored-by: Will Barnes <will.t.barnes@gmail.com>
Thank you for the clarification, Peter! I'll add a citation to this technical report in fiasco. |
Looking at the docs, I now realize that the API docs for the new |
Yeah, that probably explains why the docs build failed. lol |
I also take back what I said about only needing this in the context of the Ion object. It's not unreasonable one might want to calculate a Gaunt factor for other reasons as well so making the API more visible is only a good thing. |
I think that should've addressed all of your comments! Let me know if there are any more changes you'd like. |
Everything is looking pretty good to me! i just pushed a few changes mostly cleaning up the docstrings, linking between methods, and enforcing some consistency between a few of the equations. Have a look over the rendered docs for |
Looks fine to me. Thanks for touching that up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Thanks as always. I like the way this has turned out and make the Gaunt factor calculations much more readable and maintainable.
Thanks for the help! This ended up being a lot more involved than just parsing two new data sets. Hopefully the new format is easy to maintain and extend. For example, the CHIANTI technical report mentions a newer data set that's more accurate, that could potentially be readily built in to fiasco. |
Fixes #248