-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
Creating collisional excitation/deexcitation coefficient matrix for NLTE excitation treatment #2385
Creating collisional excitation/deexcitation coefficient matrix for NLTE excitation treatment #2385
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2385 +/- ##
==========================================
+ Coverage 68.43% 68.49% +0.05%
==========================================
Files 145 145
Lines 13221 13245 +24
==========================================
+ Hits 9048 9072 +24
Misses 4173 4173
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
The PR looks good. However, I think all of the for loops can be replaced with standard numpy/pandas indexing operations relatively easily.
Co-authored-by: Christian Vogl <cvogl@mpa-garching.mpg.de>
…an/tardis into create_coll_exc_deexc_matrix
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 very good. I only have some minor final comments.
coll_exc_coefficient.index.get_level_values( | ||
"level_number_lower" | ||
).unique() |
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.
I would do coll_exc_coefficient.groupby("level_number_lower").sum()
before this and assign the result to a variable. You can then use the index of this variable here and the .values
of it later.
-1 | ||
* coll_exc_coefficient.groupby("level_number_lower") | ||
.sum() | ||
.values.flatten() |
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.
In principle, coll_exc_coefficient
should be a Series since it is one column of a DataFrame (corresponding to a specific shell). The .flatten()
should then not be necessary.
coll_exc_coefficient.index.get_level_values( | ||
"level_number_upper" | ||
).unique() |
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.
See comment above.
-1 | ||
* coll_deexc_coefficient.groupby("level_number_upper") | ||
.sum() | ||
.values.flatten() |
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.
See previous comment.
"level_number_upper" | ||
), | ||
) | ||
] = coll_deexc_coefficient.values.flatten() |
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.
See previous comment.
exc_coeff = pd.DataFrame(coll_exc_coeff_values, index=index) | ||
deexc_coeff = pd.DataFrame(coll_deexc_coeff_values, index=index) |
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.
Same as above. These should probably be Series?
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.
Looks great! Happy to see this merged soon.
*beep* *bop* Hi, human. The Click here to see your results. |
📝 Description
Type: 🪲
bugfix
| 🚀feature
| ☣️breaking change
| 🚦testing
| 📝documentation
| 🎢infrastructure
This PR adds a new function which constructs the coefficient matrix portion for NLTE treatment that includes collisional excitation and deexcitation coefficients.
Here is an example of how the matrix should look for 3 levels(0, 1 and 2)

Also, link issues affected by this pull request by using the keywords:
close
,closes
,closed
,fix
,fixes
,fixed
,resolve
,resolves
orresolved
.📌 Resources
Examples, notebooks, and links to useful references.
🚦 Testing
How did you test these changes?
☑️ Checklist
build_docs
label