-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Gamma-ray packet source refactor #2546
Gamma-ray packet source refactor #2546
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2546 +/- ##
==========================================
- Coverage 68.05% 66.77% -1.29%
==========================================
Files 171 172 +1
Lines 14300 14453 +153
==========================================
- Hits 9732 9651 -81
- Misses 4568 4802 +234 ☔ View full report in Codecov by Sentry. |
329e557
to
7ad25a0
Compare
Radioactive packet source GXPacket collection Some initial methods
Creates a Packet collection with all necessary packet properties
ddb64ca
to
cc27c05
Compare
self.nu_cmf = nu_cmf | ||
self.status = status | ||
self.shell = shell | ||
self.time_current = time_current |
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.
What is time_current
?
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 current local time value of the packet, if there was a clock attached to it
self.shell = shell | ||
self.time_current = time_current | ||
self.number_of_packets = len(self.energy_rf) | ||
self.tau = -np.log(np.random.random(self.number_of_packets)) |
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.
Is this tau
same as the mean life of isotopes? Shall we give a separate name for this variable if this the optical depth?
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.
Given that we are in a radiative transfer code, I think we should rename the mean lifetime instead
@@ -289,9 +288,6 @@ def gamma_packet_loop( | |||
energy_out[bin_index, time_index] += rest_energy / ( |
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.
Instead of the energy_out
, shall we dump the information into an array which which record the "escaping" packets information. That will help in getting the gamma-ray spectra in a post-processing step?
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.
energy_out
is such an array, but we can record more packet information if you want. I consider this out of scope for this PR though.
@@ -322,7 +318,6 @@ def gamma_packet_loop( | |||
energy_plot_df_rows, | |||
energy_out, | |||
deposition_estimator, | |||
packets_out, | |||
bin_width, |
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.
Do we need the bin_width
as an output? WE can do that later in a post-processing step.
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.
Probably not, but the blame said you added it. I can remove it, but it may be out of scope for this PR.
nus_rf = np.zeros(number_of_packets) | ||
nus_cmf = np.zeros(number_of_packets) | ||
times = np.zeros(number_of_packets) | ||
statuses = np.ones(number_of_packets, dtype=np.int64) * 3 |
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.
Why it is multiplied by 3?
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 is the default status of the packet. I will add a comment to clarify.
) | ||
|
||
# get the time step index of the packets | ||
initial_time_indexes = sampled_packets_df["time"] |
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.
time
is an index of the data frame
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.
They are actual times
and not indices.
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.
Okay. I think they would be more useful as indices instead of actual times. Times are useful for plotting but not much else in my opinion. I know I am probably referencing the index incorrectly regardless and will fix the code here.
* First steps Radioactive packet source GXPacket collection Some initial methods * Add more methods to the packet source * Documentation, cleanup, positronium handling * Black formatting, cleanup * Fix kappa_calculation import loop * Working packet source Creates a Packet collection with all necessary packet properties * Positron deposition and packet tracker arrays * Fix parents dict * Result now mostly consistent with master * Fix kappa calculation test * Adds missing docstring for calculate_energy_factors * Fix util tests and black * Testing skeleton for packet source * black tests * Address comments * Beginnings of an alternate packet source for the dataframe * Possible deposition fix, import fixes * Added old functions * Cleanup, comments, and more dataframe sampling setup * Corrected packet time computation * Modified sampling to use positron information * Remove packet sampling call and replace with dataframe method * Update method call to match current usage * Comment responses * More comments, improve packet dataframe index handling --------- Co-authored-by: Knights-Templars <[email protected]>
📝 Description
Type: 🎢
infrastructure
Refactors the gamma-ray packet creation to use a standard packet source-style setup.
🚦 Testing
How did you test these changes?
☑️ Checklist
build_docs
label