fispact / pypact Goto Github PK
View Code? Open in Web Editor NEWA Python package for parsing FISPACT-II output
Home Page: https://pypact.readthedocs.io/en/latest/
License: Apache License 2.0
A Python package for parsing FISPACT-II output
Home Page: https://pypact.readthedocs.io/en/latest/
License: Apache License 2.0
only testing versions 3.6, 3.7, and 3.8 now but we should also test 3.9
Hi @thomasms,
I've had a problem when writing fluxes files, when small rounding errors are present the flux is written to the wrong group, with no error handling or warnings.
I've come up with a fix, by adding a rounding tolerance:
setValue(energy_group, flux_value, energy_group_tolerance=0.001
Example showing error:
`import pypact as pp
ff = pp.FluxesFile(name='test', norm=1.0)
ff.setGroup(175)
ff_boundaries = ff.boundaries[::-1]
ff.setValue(1.0000e-05, 1.0)
ff.setValue(1.0000e-01, 2.0)
ff.setValue(4.1400e-01, 3.0)
ff.setValue(5.3200e-01, 4.0)
ff.setValue(6.8300e-01, 5.0)
pp.to_file(ff, 'example.fluxes_file')
print(pp.ALL_GROUPS[175][-5:])`
Will result in a fluxes file with the 3rd 4th and 5th fluxes placed in the groups above, these are then overwritten by other values leaving gaps and incorrect values in the spectrum.
I've made a fix to this on a local branch, but can't push this. Could I be made a developer so that I can push the code to a fix branch?
Regards,
Ross
Sorry for writting here. But I don't sure my message to your team were delivered through https://fispact.ukaea.uk/contact/ page a couple days ago. I duplicate my message here in common shapes: I with my colleagues from research group working with a code for calculation activation of nuclear material and we use for validation your report "Fusion decay heat validation ..." dated September 2018. Is it possible to get data presented in the work on Fig. 3 FNS Neutron spectra, neutron uence monitored by 27Al(n,�)24Na in a numerical tabulated form?
Be appreciate for any help.
For large output files (.out) with large inventories, it is quite slow (>1 sec) to parse such files. I am sure this can be improved using more optimised data structures, and/or rewriting the text finding algorithms.
Alternatively, we could start writing some of this implementation in C++ and bind with pybind to improve performance.
Like this pypact
package, very helpful for FISPACT users.
I followed the instruction on "README" to try it with the test91.out
convert example.
A new test91_new.json
was created by the command fispactconverter.py test91.out test91_new.json
, but it has different content with the test91.json
provided in reference
:
drwxr-xr-x 2 gw gw 4.0K 1月 21 10:16 ./
drwxrwxr-x 17 gw gw 4.0K 1月 21 10:08 ../
-rw-r--r-- 1 gw gw 103K 1月 21 10:08 test91.json
-rw-r--r-- 1 gw gw 152K 1月 21 10:16 test91_new.json
-rw-r--r-- 1 gw gw 192K 1月 21 10:08 test91.out
The new generated file test91_new.json
has 152K, 4491 lines. But the reference one has 103K, 3009 lines.
Is my installation failed? Or the reference test91.json
need to update?
An simple fispact-II input was generated via pypact. The material composition are calculated form as set as below:
<< set the target via FUEL >>
FUEL 2
H1 5.974010803153376e+26
H2 6.870902577422786e+22
However, fispact cannot deal with it and here is the error message:
ERROR in INPUT file
Detected at argument 3 on line 29 of keyword FUEL on line 28.
Argument value is 5.974010803153376e+26. Expected argument type is floating-point number.
Abbreviated keyword 5.974010803153376e+26 matches** keywords
when argument 3 from previous keyword FUEL expected
ERROR in INPUT file
Expecting a keyword, but token 5.974010803153376e+26 is too long
Detected on line number = 29
Skipping to next keyword
I think the digit of float should be controled when writing input file to avoid running error. For example:
diff --git a/pypact/input/inputdata.py b/pypact/input/inputdata.py
index 16b4991..c3955e0 100644
--- a/pypact/input/inputdata.py
+++ b/pypact/input/inputdata.py
@@ -41,7 +41,10 @@ class FuelInventory(InventoryType):
def __str__(self):
strrep = "{} {}".format('FUEL', len(self.entries))
for i in self.entries:
- strrep += "\n{} {}".format(i[0], i[1])
+ if len("{}".format(i[1]) > 20:
+ strrep += "\n{} {:.14E}".format(i[0], i[1])
+ else:
+ strrep += "\n{} {}".format(i[0], i[1])
Found bug on gamma spectra reading from fispact 4 output.
The bug is reproduced in test, which was added at dvp2015 fork: https://github.com/pypact, branch gamma_spectra_read_bug
See tests/output/test_gamma_spectra_reading.py
The reason is that pypact reading is based on certain number of spaces in output, but the spaces number was changed in our fispact version.
I'm taking on the fix.
I would suggest also to introduce to pypact dependency on numpy to avoid reinventing the wheel. Anyway numpy is just necessary for further analysis modules using pypact. The implementation can also rely on numpy and, probably, xarray. But this is a subject of further issues, not this one. Let's fix the bug first.
The schema is not correct and in sync with the latest release of the code. This needs updating and checks added to the CI.
Hi,
I think I noted a bug when running the plotnuclideheat.py with ppa.TimeZone.BOTH (irradiation and decay) resulting in an AttributeError: 'LinePlotAdapter' object has not attribute 'custom'. Checking in plotadapter.py in the LinePlotAdapter class there is indeed no attribute 'custom'.
For now, i just comment out the lines and the script works.
Regards, Peter.
Printlib5 reader exists but we need other print lib support.
Printlib 4 is quite important so let's add this
Using slots would reduce memory usage, and possibly improve performance, whilst freezing attributes (as the freeze_it decorator attempts to do).
This may affect the JSON serializable functionality and may need to be changed, since it uses dict.
Hey! I would like to use python to parse the FISPACT output but it seems that meta-stable isotopes are grouped together with non-metastable. (following along the "plotting" example on the main page.
When one plots, for example, Xe-135 then every other data point corresponds to Xe-135m. Which is pretty annoying.
Regards,
Andrew
Since the text matcher uses 'TOTAL MASS' for both initial and total mass, this causes the total mass to be read as though it is initial mass.
This should be changed to include '0 TOTAL MASS'
Want to be able to read spectral data form printlib5
pypact.analysis has had attribute names changed, from getallisotopes() to get_all_isotopes(), and findZ() to find_z().
Wiki examples use old method names.
For output objects, they extend the JSONSerializable class to allow all data to be (de)serialized to/from JSON easily. However, the code is for deserialization is not well implemented, since extending this for lists of types is difficult. Additionally, the code is slow when trying to parse JSON output data, (really slow compared to other json libraries).
This could be improved and refactored, if anyone is willing to attempt this.
The following Irradiation time causes FISPACT to produce the error:
ERROR in INPUT file
Expecting a keyword, but token 1.0318823828959384e+16 is too long
Detected on line number = 120
Skipping to next keyword
This was generated via pypact using the .addIrradiation(1.0, 1.0318823828959384e+16) method. This can be fixed manually (in the FISPACT input file) be reducing the number of decimal places.
Hello,
I am using FISPACT and noticed that the extract_boundaries_and_values
function in gammaspectrum.py
for output treatment has issues treating outputs with missing "E" character for exponential format.
gammaspectrum.txt
I added a "patch" from my Python experience wich is not optimal of course.
I hope this is the correct way of contributing. If this is not welcomed, please notify me.
If this is welcomed but clearly not optimal, I'll be happy to know a better method.
Best regards
Would be nice to have
# nuclide is of Nuclide type
nuclide.zai
nuclide.name
Add as properties
Docstrings should be present in all methods.
Documentation needs to be improved.
Since the Reader was moved to InventoryReader this causes problems with the fispact runner module. This is a simple fix but is important.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.