sens0_path (str) – Path to the Serpent _sens0.m sensitivity file.
results_path (str) – Path to the Serpent _res.m results file.
kind (str, optional) – Kind of observable, by default "keff".
materials (list of str, optional) – Materials for which the sensitivity is extracted. Defaults to
["total"].
zailist (list of int, optional) – ZAIs to extract from the sensitivity file. Defaults to all ZAIs
present in the file.
pertlist (list of str, optional) – Perturbations to extract from the sensitivity file. Defaults to
the standard set of reactions.
m (float, optional) – Measured value for the application. Default is None.
dm (float, optional) – Measurement uncertainty. Default is None.
flux_det (tuple of (str, str), optional) – A (det_name,det_path) pair identifying the Serpent detector
whose tally is used to build a FluxSpectrum. When
None (default) no flux spectrum is attached.
Returns:
An Application with the calculated value, sensitivity, and
(optionally) flux spectrum extracted from the Serpent files.
file_path (str) – file path where the database is located.
titles (list, optional) – Titles which have to be extracted from the database, if None
return all the applications available in the database, by default None.
Returns:
Returns a BenchmarkSuite object containing the imported Benchmark objects.
Module containing the AssimilationSuite class, which is used to
manage a collection of benchmark, application and covariance data
for assimilation purposes.
Class to manage a collection of benchmark, application and covariance
data for assimilation purposes. This class can be used to assemble a complete
dataset for assimilation, and to perform operations on the entire suite.
Concatenate calculated values from all benchmarks and applications.
This property gathers calculated values from available benchmark and
application suites, aligns them by their titles, and fills missing
values with zeros to create a unified calculated value vector.
Returns:
A combined Series containing calculated values, aligned by index.
Return type:
pd.Series
Raises:
ValueError – If both benchmarks and applications are None or empty.
Concatenate calculated value uncertainties from all benchmarks and applications.
This property gathers calculated value uncertainties from available benchmark
and application suites, aligns them by their titles, and fills missing
values with zeros to create a unified calculated value uncertainty vector.
Returns:
A combined Series containing calculated value uncertainties, aligned by index.
Return type:
pd.Series
Raises:
ValueError – If both benchmarks and applications are None or empty.
Concatenate flux vector uncertainties data from all benchmarks and applications.
This property gathers flux vector uncertainty vectors from available benchmark
and application suites, aligns them by their MultiIndex, and fills missing
values with zeros to create a unified sensitivity uncertainty matrix.
Returns:
A combined DataFrame containing flux vector uncertainties, aligned
along the columns (axis=1).
Return type:
pd.DataFrame
Raises:
ValueError – If both benchmarks and applications are None or empty.
Concatenate sensitivity uncertainties data from all benchmarks and applications.
This property gathers sensitivity uncertainty vectors from available benchmark
and application suites, aligns them by their MultiIndex, and fills missing
values with zeros to create a unified sensitivity uncertainty matrix.
Returns:
A combined DataFrame containing sensitivity uncertainties, aligned
along the columns (axis=1).
Return type:
pd.DataFrame
Raises:
ValueError – If both benchmarks and applications are None or empty.
This is the cosine similarity of the sensitivity vectors.
Returns:
A DataFrame with shape (N,N) containing the E-index values
between every pair of benchmarks and applications in the suite.
Entries are NaN when either sensitivity vector is all zeros.
Concatenate flux data from all benchmarks and applications.
This property gathers flux vectors from available benchmark and
application suites, aligns them by their MultiIndex, and fills missing
values with zeros to create a unified sensitivity matrix.
Returns:
A combined DataFrame containing flux vectors, aligned along the
columns (axis=1).
Return type:
pd.DataFrame
Raises:
ValueError – If both benchmarks and applications are None or empty.
This is the cosine similarity of the flux vectors.
Returns:
A DataFrame with shape (N,N) containing the flux similarity values
between every pair of benchmarks and applications in the suite.
Entries are NaN when either flux vector is all zeros.
Perform a GLLS update [1] on the assimilation suite using the sensitivity
profiles and covariance data loaded in the AssimilationSuite. This method updates
the calculated response and the covariance matrices.
Returns:
A new AssimilationSuite instance with updated sensitivity profiles.
Propagate the nuclear data uncertainty through the sensitivity profiles
to calculate the contribution of the nuclear data uncertainty to the
overall uncertainty in the calculated values.
Returns:
A Series containing the propagated nuclear data uncertainty for each case in the suite.
Concatenate sensitivity data from all benchmarks and applications.
This property gathers sensitivity vectors from available benchmark and
application suites, aligns them by their MultiIndex, and fills missing
values with zeros to create a unified sensitivity matrix.
Returns:
A combined DataFrame containing sensitivities, aligned along the
columns (axis=1).
Return type:
pd.DataFrame
Raises:
ValueError – If both benchmarks and applications are None or empty.
Print a summary of the assimilation suite, including the number of benchmarks and applications,
the titles of the cases included, and the chi-squared values with and without nuclear data.
Export the current assimilation suite to an adjusted ACE library format via SANDY.
This method iterates through the unique ZAIs in the cross-section adjustments,
retrieves the base ENDF6 files from the specified library, applies the
calculated perturbations, and generates ACE files. Optionally, it can
append entries to a Serpent-style ‘xsdata’ directory file.
Parameters:
library (str) – Path to the base ENDF6 library or the name of the library
recognized by sandy.
reaction_dict (dict, optional) – A dictionary mapping ENDF6 MT numbers to reaction types.
Default handles standard cross-sections (MF31, 33, 34, 35).
Format: {MF: [MT_list]}.
verbose (bool, default False) – If True, prints detailed progress and SANDY execution logs.
temperature (int, default 300) – The temperature in Kelvin for the ACE file generation.
create_xsdata (bool, default False) – If True, appends isotope definitions to ‘adjusted.xsdata’
formatted for the Serpent Monte Carlo code.
parallel (bool, default False) – If True, process ZAIs concurrently using a thread pool.
max_workers (int | None, default None) – Maximum number of worker threads used when parallel=True.
If None, Python chooses a default.
only_zais_applications (bool, default False) – If True, only process ZAIs that are present in the application suite,
Raises:
ValueError – If self.xs_adjustment is None, indicating no posterior
has been calculated.
Notes
Currently the method supports perturbations to nubar, cross sections
and prompt fission neutron energy spectrum.
See also
sandy.get_endf6_file
The underlying function for library retrieval.
sandy.Samples
Object used to containerize perturbations.
sandy.Endf6.apply_perturbations
The function that applies perturbations and generates ACE files.
Export cross-section, nu-bar, and chi adjustments directly onto existing ACE files.
Unlike to_ace, which reprocesses each isotope from ENDF via SANDY/NJOY
(a matter of minutes per isotope), this method edits an already-processed
ACE file’s XSS array directly via andalus.ace.ACE.perturb/perturb_nu/
perturb_chi, which takes a fraction of a second per isotope. It requires
a source ASCII ACE file per ZAI being adjusted; it does not talk to ENDF
or run NJOY.
MTs are routed by ANDALUS’s own numbering convention: 452/456 go to
perturb_nu, MT >= 35000 (ANDALUS’s MF*1000+MT chi encoding, e.g.
35018 for prompt fission chi) go to perturb_chi, and everything else
goes to perturb.
Source ACE files can be located either by directory convention
(ace_dir) or, for libraries that don’t follow that naming convention
(e.g. JEFF-4.0’s 1-H-1g-300.0), via a Serpent-style xsdata directory
file (xsdata_path). Exactly one of the two must be given.
Parameters:
out_dir (str) – Directory to write perturbed ACE files to (created if it doesn’t
exist). Written files are named {ZAID}.{temperature_code}c
(e.g. 92235.03c for U-235 at 300 K).
ace_dir (str, optional) – Directory containing source ACE files, named
{ZAID}.{temperature_code}c — the same naming convention
to_ace’s xsdata output uses. Mutually exclusive with xsdata_path.
xsdata_path (str, optional) – Path to a Serpent-style xsdata file mapping ZAIDs to source ACE
file paths (relative paths are resolved against the xsdata file’s
directory), allowing source libraries with arbitrary file naming.
Mutually exclusive with ace_dir.
temperature (int, default 300) – Temperature in Kelvin, used to build the ACE filename suffix
(e.g. 300 -> “03c”).
verbose (bool, default False) – If True, print progress for each ZAI.
only_zais_applications (bool, default False) – If True, only process ZAIs present in the application suite.
create_xsdata (bool, default False) – If True, writes a Serpent-style xsdata directory file
(adjusted.xsdata in out_dir) listing the written ACE files.
Returns:
Paths to the written ACE files, one per processed ZAI.
Return type:
list[str]
Raises:
ValueError – If self.xs_adjustment is None, indicating no posterior has
been calculated, or if ace_dir/xsdata_path are not given
exactly one at a time.
FileNotFoundError – If the source ACE file for a ZAI cannot be located.
sens0_path (str) – Path to the Serpent _sens0.m sensitivity file.
results_path (str) – Path to the Serpent _res.m results file.
kind (str, optional) – Kind of observable, by default "keff".
materials (list of str, optional) – Materials for which the sensitivity is extracted. Defaults to
["total"].
zailist (list of int, optional) – ZAIs to extract from the sensitivity file. Defaults to all ZAIs
present in the file.
pertlist (list of str, optional) – Perturbations to extract from the sensitivity file. Defaults to
the standard set of reactions.
flux_det (tuple of (str, str), optional) – A (det_name,det_path) pair identifying the Serpent detector
whose tally is used to build a FluxSpectrum. When
None (default) no flux spectrum is attached.
Returns:
A Benchmark with the calculated value, sensitivity, and
(optionally) flux spectrum extracted from the Serpent files.
file_path (str) – file path where the database is located.
titles (list, optional) – Titles which have to be extracted from the database, if None
return all the benchmarks available in the database, by default None.
Returns:
Returns a BenchmarkSuite object containing the imported Benchmark objects.
Module containing the Covariance class, which is used to represent
and manage covariance data. Covariances inherit from pandas DataFrames.
Covariance objects can be saved to a sparse HDF5 format and reconstructed from it.
A covariance suite can be assembled from multiple Covariance objects, creating a block-diagonal matrix.
Module containing the Sensitivity class, which is used to represent
and manage sensitivity data. Sensitivities inherit from pandas DataFrames,
and have some additional methods for plotting and loading from Serpent output.
s2 (pd.Series or pd.DataFrame, optional) – Second sensitivity vector. If None, s2 is assumed to be s1.
Returns:
A Series with a 4-level MultiIndex:
(ZAI_1, MT_1, E_min_eV_1, E_max_eV_1, ZAI_2, MT_2, E_min_eV_2, E_max_eV_2) representing the contribution
of the correlation between those specific bins.
sens0_path (str) – Path to the Serpent _sens0.m sensitivity file.
results_path (str) – Path to the Serpent _res.m results file.
kind (str, optional) – Kind of observable, by default "keff".
materials (list of str, optional) – Materials for which the sensitivity is extracted. Defaults to
["total"].
zailist (list of int, optional) – ZAIs to extract from the sensitivity file. Defaults to all ZAIs
present in the file.
pertlist (list of str, optional) – Perturbations to extract from the sensitivity file. Defaults to
the standard set of reactions.
m (float, optional) – Measured value for the application. Default is None.
dm (float, optional) – Measurement uncertainty. Default is None.
flux_det (tuple of (str, str), optional) – A (det_name,det_path) pair identifying the Serpent detector
whose tally is used to build a FluxSpectrum. When
None (default) no flux spectrum is attached.
Returns:
An Application with the calculated value, sensitivity, and
(optionally) flux spectrum extracted from the Serpent files.
file_path (str) – file path where the database is located.
titles (list, optional) – Titles which have to be extracted from the database, if None
return all the applications available in the database, by default None.
Returns:
Returns a BenchmarkSuite object containing the imported Benchmark objects.
Class to manage a collection of benchmark, application and covariance
data for assimilation purposes. This class can be used to assemble a complete
dataset for assimilation, and to perform operations on the entire suite.
Concatenate calculated values from all benchmarks and applications.
This property gathers calculated values from available benchmark and
application suites, aligns them by their titles, and fills missing
values with zeros to create a unified calculated value vector.
Returns:
A combined Series containing calculated values, aligned by index.
Return type:
pd.Series
Raises:
ValueError – If both benchmarks and applications are None or empty.
Concatenate calculated value uncertainties from all benchmarks and applications.
This property gathers calculated value uncertainties from available benchmark
and application suites, aligns them by their titles, and fills missing
values with zeros to create a unified calculated value uncertainty vector.
Returns:
A combined Series containing calculated value uncertainties, aligned by index.
Return type:
pd.Series
Raises:
ValueError – If both benchmarks and applications are None or empty.
Concatenate flux vector uncertainties data from all benchmarks and applications.
This property gathers flux vector uncertainty vectors from available benchmark
and application suites, aligns them by their MultiIndex, and fills missing
values with zeros to create a unified sensitivity uncertainty matrix.
Returns:
A combined DataFrame containing flux vector uncertainties, aligned
along the columns (axis=1).
Return type:
pd.DataFrame
Raises:
ValueError – If both benchmarks and applications are None or empty.
Concatenate sensitivity uncertainties data from all benchmarks and applications.
This property gathers sensitivity uncertainty vectors from available benchmark
and application suites, aligns them by their MultiIndex, and fills missing
values with zeros to create a unified sensitivity uncertainty matrix.
Returns:
A combined DataFrame containing sensitivity uncertainties, aligned
along the columns (axis=1).
Return type:
pd.DataFrame
Raises:
ValueError – If both benchmarks and applications are None or empty.
This is the cosine similarity of the sensitivity vectors.
Returns:
A DataFrame with shape (N,N) containing the E-index values
between every pair of benchmarks and applications in the suite.
Entries are NaN when either sensitivity vector is all zeros.
Concatenate flux data from all benchmarks and applications.
This property gathers flux vectors from available benchmark and
application suites, aligns them by their MultiIndex, and fills missing
values with zeros to create a unified sensitivity matrix.
Returns:
A combined DataFrame containing flux vectors, aligned along the
columns (axis=1).
Return type:
pd.DataFrame
Raises:
ValueError – If both benchmarks and applications are None or empty.
This is the cosine similarity of the flux vectors.
Returns:
A DataFrame with shape (N,N) containing the flux similarity values
between every pair of benchmarks and applications in the suite.
Entries are NaN when either flux vector is all zeros.
Perform a GLLS update [1] on the assimilation suite using the sensitivity
profiles and covariance data loaded in the AssimilationSuite. This method updates
the calculated response and the covariance matrices.
Returns:
A new AssimilationSuite instance with updated sensitivity profiles.
Propagate the nuclear data uncertainty through the sensitivity profiles
to calculate the contribution of the nuclear data uncertainty to the
overall uncertainty in the calculated values.
Returns:
A Series containing the propagated nuclear data uncertainty for each case in the suite.
Concatenate sensitivity data from all benchmarks and applications.
This property gathers sensitivity vectors from available benchmark and
application suites, aligns them by their MultiIndex, and fills missing
values with zeros to create a unified sensitivity matrix.
Returns:
A combined DataFrame containing sensitivities, aligned along the
columns (axis=1).
Return type:
pd.DataFrame
Raises:
ValueError – If both benchmarks and applications are None or empty.
Print a summary of the assimilation suite, including the number of benchmarks and applications,
the titles of the cases included, and the chi-squared values with and without nuclear data.
Export the current assimilation suite to an adjusted ACE library format via SANDY.
This method iterates through the unique ZAIs in the cross-section adjustments,
retrieves the base ENDF6 files from the specified library, applies the
calculated perturbations, and generates ACE files. Optionally, it can
append entries to a Serpent-style ‘xsdata’ directory file.
Parameters:
library (str) – Path to the base ENDF6 library or the name of the library
recognized by sandy.
reaction_dict (dict, optional) – A dictionary mapping ENDF6 MT numbers to reaction types.
Default handles standard cross-sections (MF31, 33, 34, 35).
Format: {MF: [MT_list]}.
verbose (bool, default False) – If True, prints detailed progress and SANDY execution logs.
temperature (int, default 300) – The temperature in Kelvin for the ACE file generation.
create_xsdata (bool, default False) – If True, appends isotope definitions to ‘adjusted.xsdata’
formatted for the Serpent Monte Carlo code.
parallel (bool, default False) – If True, process ZAIs concurrently using a thread pool.
max_workers (int | None, default None) – Maximum number of worker threads used when parallel=True.
If None, Python chooses a default.
only_zais_applications (bool, default False) – If True, only process ZAIs that are present in the application suite,
Raises:
ValueError – If self.xs_adjustment is None, indicating no posterior
has been calculated.
Notes
Currently the method supports perturbations to nubar, cross sections
and prompt fission neutron energy spectrum.
See also
sandy.get_endf6_file
The underlying function for library retrieval.
sandy.Samples
Object used to containerize perturbations.
sandy.Endf6.apply_perturbations
The function that applies perturbations and generates ACE files.
Export cross-section, nu-bar, and chi adjustments directly onto existing ACE files.
Unlike to_ace, which reprocesses each isotope from ENDF via SANDY/NJOY
(a matter of minutes per isotope), this method edits an already-processed
ACE file’s XSS array directly via andalus.ace.ACE.perturb/perturb_nu/
perturb_chi, which takes a fraction of a second per isotope. It requires
a source ASCII ACE file per ZAI being adjusted; it does not talk to ENDF
or run NJOY.
MTs are routed by ANDALUS’s own numbering convention: 452/456 go to
perturb_nu, MT >= 35000 (ANDALUS’s MF*1000+MT chi encoding, e.g.
35018 for prompt fission chi) go to perturb_chi, and everything else
goes to perturb.
Source ACE files can be located either by directory convention
(ace_dir) or, for libraries that don’t follow that naming convention
(e.g. JEFF-4.0’s 1-H-1g-300.0), via a Serpent-style xsdata directory
file (xsdata_path). Exactly one of the two must be given.
Parameters:
out_dir (str) – Directory to write perturbed ACE files to (created if it doesn’t
exist). Written files are named {ZAID}.{temperature_code}c
(e.g. 92235.03c for U-235 at 300 K).
ace_dir (str, optional) – Directory containing source ACE files, named
{ZAID}.{temperature_code}c — the same naming convention
to_ace’s xsdata output uses. Mutually exclusive with xsdata_path.
xsdata_path (str, optional) – Path to a Serpent-style xsdata file mapping ZAIDs to source ACE
file paths (relative paths are resolved against the xsdata file’s
directory), allowing source libraries with arbitrary file naming.
Mutually exclusive with ace_dir.
temperature (int, default 300) – Temperature in Kelvin, used to build the ACE filename suffix
(e.g. 300 -> “03c”).
verbose (bool, default False) – If True, print progress for each ZAI.
only_zais_applications (bool, default False) – If True, only process ZAIs present in the application suite.
create_xsdata (bool, default False) – If True, writes a Serpent-style xsdata directory file
(adjusted.xsdata in out_dir) listing the written ACE files.
Returns:
Paths to the written ACE files, one per processed ZAI.
Return type:
list[str]
Raises:
ValueError – If self.xs_adjustment is None, indicating no posterior has
been calculated, or if ace_dir/xsdata_path are not given
exactly one at a time.
FileNotFoundError – If the source ACE file for a ZAI cannot be located.
sens0_path (str) – Path to the Serpent _sens0.m sensitivity file.
results_path (str) – Path to the Serpent _res.m results file.
kind (str, optional) – Kind of observable, by default "keff".
materials (list of str, optional) – Materials for which the sensitivity is extracted. Defaults to
["total"].
zailist (list of int, optional) – ZAIs to extract from the sensitivity file. Defaults to all ZAIs
present in the file.
pertlist (list of str, optional) – Perturbations to extract from the sensitivity file. Defaults to
the standard set of reactions.
flux_det (tuple of (str, str), optional) – A (det_name,det_path) pair identifying the Serpent detector
whose tally is used to build a FluxSpectrum. When
None (default) no flux spectrum is attached.
Returns:
A Benchmark with the calculated value, sensitivity, and
(optionally) flux spectrum extracted from the Serpent files.
file_path (str) – file path where the database is located.
titles (list, optional) – Titles which have to be extracted from the database, if None
return all the benchmarks available in the database, by default None.
Returns:
Returns a BenchmarkSuite object containing the imported Benchmark objects.