import sandy
In this examples we'll produce random ACE files for the JEFF-3.3 Pu-238 evaluation. This sequence can we further extended for other nuclides, individually or together in a loop.
lib_name = "jeff_33"
nucl = 942390
filename = f"{nucl}.{lib_name}"
endf6 = sandy.get_endf6_file(lib_name, 'xs', nucl)
endf6.to_file(filename)
nsmp = 2 # number of samples
processes = 1 # change if you want to run in parallel (better on Linux)
# command line
cli = f"{filename} --processes {processes} --samples {nsmp} --mf 33 --temperatures 300 --acer --debug"
sandy.sampling.run(cli.split())
INFO: processing file: '942390.jeff_33' INFO: Zero or no temperature was requested, NJOY processing will stop after RECONR. If you want to process 0K cross sections use `temperature=0.1`.
moder 20 -21 / reconr -21 -22 / 'sandy runs njoy'/ 9437 0 0 / 1.0 0. / 0/ moder -22 30 / errorr -21 -22 0 33 0 / 9437 2 2 0 1 / 0 0.0 / 0 33 1/ stop njoy 2016.74 12Jan24 03/03/24 21:46:03 ***************************************************************************** moder... 0.0s reconr... 0.1s ---message from rdf2bw---calculation of angular distribution not installed. moder... 2.4s errorr... 2.8s processing mat 9437 --------------------- 94-Pu-239 IRSN-CEA EVAL-FEV16 IRSN-CEA DAM/DEN COLLAB. covariances calculated for 8 reactions and 248 groups 3.3s 5.5s *****************************************************************************
INFO: writing to file 'PERT_94239_MF33.xlsx'... WARNING: Large condition number of covariance matrix: 1.34e+08 INFO: Zero or no temperature was requested, NJOY processing will stop after RECONR. If you want to process 0K cross sections use `temperature=0.1`.
moder 20 -21 / reconr -21 -22 / 'sandy runs njoy'/ 9437 0 0 / 1.0 0. / 0/ moder -22 30 / stop njoy 2016.74 12Jan24 03/03/24 21:46:14 ***************************************************************************** moder... 0.0s reconr... 0.1s ---message from rdf2bw---calculation of angular distribution not installed. moder... 2.5s 2.9s ***************************************************************************** Processing xs sample 0... moder 20 -21 / moder 99 -22 / broadr -21 -22 -23 / 9437 1 0 0 0. / 1.0 / 300.0 / 0 / moder -23 30 / acer -21 -23 0 50 70 / 1 0 1 .03 0 / 'sandy runs acer'/ 9437 300.0 / 1 1 / / stop njoy 2016.74 12Jan24 03/03/24 21:46:19 ***************************************************************************** moder... 0.0s moder... 0.1s broadr... 0.1s moder... 0.4s acer... 0.7s 2.3s ***************************************************************************** writing to file '94239_0.03c' writing to file '94239_0.03c.xsd' Processing xs sample 1... moder 20 -21 / moder 99 -22 / broadr -21 -22 -23 / 9437 1 0 0 0. / 1.0 / 300.0 / 0 / moder -23 30 / acer -21 -23 0 50 70 / 1 0 1 .03 0 / 'sandy runs acer'/ 9437 300.0 / 1 1 / / stop njoy 2016.74 12Jan24 03/03/24 21:46:23 ***************************************************************************** moder... 0.0s moder... 0.1s broadr... 0.1s moder... 0.4s acer... 0.7s
INFO: Total running time: 24.02 sec
2.3s ***************************************************************************** writing to file '94239_1.03c' writing to file '94239_1.03c.xsd'
This is equivalent to the command line entry
python -m sandy.sampling 942390.jeff_33 --processes 1 --samples 2 --temperatures 300 --acer --debug
Notice that option
--debug
should be removed for production.
If you need more control over your pipeline you can generate samples using the python API.
Some of the reasons identified to do this are:
err
(used for by the NJOY modules RECONR and BROADR) to make the code run fasterThis is equivalent to what was previously run.
# this generates samples for cross sections and nubar
smps = endf6.get_perturbations(
nsmp,
njoy_kws=dict(
err=1, # very fast calculation, for testing
chi=False,
mubar=False,
xs=True,
nubar=False,
verbose=True,
),
)
INFO: Zero or no temperature was requested, NJOY processing will stop after RECONR. If you want to process 0K cross sections use `temperature=0.1`.
moder 20 -21 / reconr -21 -22 / 'sandy runs njoy'/ 9437 0 0 / 1.0 0. / 0/ moder -22 30 / errorr -21 -22 0 33 0 / 9437 2 2 0 1 / 0 0.0 / 0 33 1/ stop njoy 2016.74 12Jan24 03/03/24 21:46:26 ***************************************************************************** moder... 0.0s reconr... 0.1s ---message from rdf2bw---calculation of angular distribution not installed. moder... 2.4s errorr... 2.8s processing mat 9437 --------------------- 94-Pu-239 IRSN-CEA EVAL-FEV16 IRSN-CEA DAM/DEN COLLAB. covariances calculated for 8 reactions and 248 groups 3.2s 5.4s *****************************************************************************
INFO: writing to file 'PERT_94239_MF33.xlsx'... WARNING: Large condition number of covariance matrix: 1.34e+08
# This part applies the perturbations (samples) to the best-estimates and writes perturbed output files samples for cross sections and nubar
outs = endf6.apply_perturbations(
smps,
processes=processes,
njoy_kws=dict(err=1), # very fast calculation, for testing
to_ace=True, # produce ACE files
to_file=True,
ace_kws=dict(err=1, temperature=300, verbose=True, purr=False, heatr=False, thermr=False, gaspr=False),
verbose=True,
)
INFO: Zero or no temperature was requested, NJOY processing will stop after RECONR. If you want to process 0K cross sections use `temperature=0.1`.
njoy 2016.74 12Jan24 03/03/24 21:46:37 ***************************************************************************** moder... 0.0s reconr... 0.1s ---message from rdf2bw---calculation of angular distribution not installed. moder... 2.4s 2.8s ***************************************************************************** Processing xs sample 0... moder 20 -21 / moder 99 -22 / broadr -21 -22 -23 / 9437 1 0 0 0. / 1.0 / 300.0 / 0 / moder -23 30 / acer -21 -23 0 50 70 / 1 0 1 .03 0 / 'sandy runs acer'/ 9437 300.0 / 1 1 / / stop njoy 2016.74 12Jan24 03/03/24 21:46:42 ***************************************************************************** moder... 0.0s moder... 0.1s broadr... 0.1s moder... 0.4s acer... 0.7s 2.3s ***************************************************************************** writing to file '94239_0.03c' writing to file '94239_0.03c.xsd' Processing xs sample 1... moder 20 -21 / moder 99 -22 / broadr -21 -22 -23 / 9437 1 0 0 0. / 1.0 / 300.0 / 0 / moder -23 30 / acer -21 -23 0 50 70 / 1 0 1 .03 0 / 'sandy runs acer'/ 9437 300.0 / 1 1 / / stop njoy 2016.74 12Jan24 03/03/24 21:46:47 ***************************************************************************** moder... 0.0s moder... 0.1s broadr... 0.1s moder... 0.4s acer... 0.7s 2.3s ***************************************************************************** writing to file '94239_1.03c' writing to file '94239_1.03c.xsd'