Conversation
…rity into dump_sources
dodu94
left a comment
There was a problem hiding this comment.
Thanks @digiacomo4 for this, a few comments below
src/f4epurity/dose.py
Outdated
| # Avoid division by zero | ||
| if distance == 0: | ||
| dose_array[i, j, k] = dose[0] | ||
| print("Dose at source point is:", dose[0]) |
There was a problem hiding this comment.
print statement should be deleted
| # distance = np.sqrt( | ||
| # (x_mid[i] - x1) ** 2 + (y_mid[j] - y1) ** 2 + (z_mid[k] - z1) ** 2 | ||
| # ) | ||
| # Avoid division by zero |
There was a problem hiding this comment.
I think computing the values in the center of the voxel is more correct than computing it in one of the vertex and then shift it in the center
There was a problem hiding this comment.
If changing to middle point than the point value a 0 distance should be still divided by a distance value and not just be equal to "dose[0]" has it is now. I would suggest leave it like this; if an .stl file is not provided, I do not think 25 cm shift impact significantly, especially at several meters distances.
There was a problem hiding this comment.
Implemented. Please note that the in case of distance==0 the dose value will be divided by 4*pi.
| # print( | ||
| # f"Max dose value: {dose_array[indices]} at coordinates: ({x_max}, {y_max}, {z_max})" | ||
| # ) | ||
| # Create the output directory if it doesn't exist |
There was a problem hiding this comment.
This can probably be deleted and not just commented out
There was a problem hiding this comment.
This file should not be tracked, please delete and consider adding it to .gitignore
alexvalentine94
left a comment
There was a problem hiding this comment.
Thanks Matteo for the nice addition. The only thing missing is documentation but this is on me to first set up so we can handle later.
| "pandas", | ||
| "jsonargparse", | ||
| "scipy", | ||
| "actigamma", |
There was a problem hiding this comment.
This is a good addition (for what is needed). I just note that as an action for the future that in the shielding module of the code the retrieval of gamma lines was done using the API for the IAEA NDS. Just for consistency, now we have this dependency, actigamma could also be used.
src/f4epurity/main.py
Outdated
| dose_factors_df, | ||
| ) | ||
| dose_arrays.append(dose_array) | ||
| if args.dump_source: |
There was a problem hiding this comment.
I think we could better name this... 'write_sdef' for example.
src/f4epurity/main.py
Outdated
|
|
||
| if args.dump_source: | ||
| global_source = GlobalPointSource(sources) | ||
| global_source.to_sdef(f"{run_dir}/source.sdef") # TODO |
src/f4epurity/parsing.py
Outdated
|
|
||
| # Add the optional "mcnp" argument | ||
| parser.add_argument( | ||
| "--dump_source", |
There was a problem hiding this comment.
above comment r.e. naming
src/f4epurity/psource.py
Outdated
| gamma_per_second_line = ( | ||
| f"FM4 {t_gamma:.2E} $ To be multiplied by 3.6E-09 to obtain Sv/hr\n" | ||
| ) | ||
| conv_coeff_line = "DE4\n 0.01 0.015 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.10 0.15 0.20 0.3 0.4 0.5 0.6 0.8 1.0 2.0 4.0 6.0 8.0 10.0\nDF4\n 0.0485 0.1254 0.2050 0.2999 0.3381 0.3572 0.3780 0.4066 0.4399 0.5172 0.7523 1.0041 1.5083 1.9958\n 2.4657 2.9082 3.7269 4.4834 7.4896 12.0153 15.9873 19.9191 23.7600" |
There was a problem hiding this comment.
These vary depending on convention. If we are to keep them, we should add a reference e.g. ICRP-74 H*(10) on a comment card in the MCNP input.
| Compute the inventory of unstable nuclides for the line source. | ||
| """ | ||
|
|
||
| pass |
There was a problem hiding this comment.
Could we open issue for this?
dodu94
left a comment
There was a problem hiding this comment.
Thanks Matteo, it was a long journey but I think you have done it
alexvalentine94
left a comment
There was a problem hiding this comment.
Thanks Matteo for making the changes and the new feature!
Added arguments to "dump_source" to automatically generate the sdef card for an mcnp simulation. The main changes can be found on the added file "psource.py" and for the time being it is only available for point/multiple points sources.
Major changes:
Through actigamma it computes the gamma lines for each point and it automatically sets the discrete energy bin (SI3 L..) and relative frequency for each bin (SP3 ..), relative strengths of sources (SP1 ..), enegy distributions (DS2 ...) and coordinates of the point/points (listed in the "SI1 L" line). Moreover the dose factor conversion coefficient are also provided along with the multiplier (FM4) (total gammas emitted).
Different functions have been added to format the final "source.sdef" in order to respect the character limit per line in MCNP, and several test have been added to check each new implemented function.
Minor changes:
Another irradiation time of 1 year has been added for numerical computation comparison with simpler case scenario.
Different libraries changed the order in which they were listed due to Ruff.