Skip to content
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

Chi get perturbation #337

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion sandy/core/endf6.py
Original file line number Diff line number Diff line change
Expand Up @@ -2279,12 +2279,19 @@ def get_perturbations_xs(self, nsmp, njoy_kws={}, smp_kws={}, **kwargs,):
>>> assert len(smps) == 1
>>> assert isinstance(smps[33], sandy.Samples)
>>> assert (smps[33].data.index.get_level_values("MT") == 102).all()

Test get perturbations from MF 35
>>> njoy_kws = dict(err=1, errorr_kws=dict(mt=18))
>>> tape = sandy.get_endf6_file("jeff_33", "xs", 922350)
>>> smps = tape.get_perturbations(nsmp=2, njoy_kws=njoy_kws)
>>> assert len(smps) == 3
>>> assert isinstance(smps[35], sandy.Samples)
>>> assert (smps[35].data.index.get_level_values("MT") == 18).all()
"""
smp = {}

# -- produce ERRORR files with covariance data
njoy_kws["mubar"] = False
njoy_kws["chi"] = False
outs = self.get_errorr(**njoy_kws)
filename = "PERT_{}_MF{}.xlsx"
filenamecov = "COV_{}_MF{}.tape"
Expand All @@ -2301,6 +2308,12 @@ def get_perturbations_xs(self, nsmp, njoy_kws={}, smp_kws={}, **kwargs,):
xls = filename.format(self.get_id(), 33)
smp[33] = outs["errorr33"].get_cov().sampling(nsmp, to_excel=xls, seed=smp_kws.get("seed33"), **smp_kws)

# -- Extract samples from MF35 covariance data
if "errorr35" in outs:
outs["errorr35"].to_file(filenamecov.format(self.get_id(), 35))
xls = filename.format(self.get_id(), 35)
smp[35] = outs["errorr35"].get_cov().sampling(nsmp, to_excel=xls, seed=smp_kws.get("seed35"), **smp_kws)

return smp

def get_perturbations_rdd(self, nsmp, smp_hl_kws={}, smp_de_kws={}, smp_br_kws={}, fill_zeros=0.05, **kwargs,):
Expand Down Expand Up @@ -2700,6 +2713,7 @@ def apply_perturbations_xs(self, smps, processes=1, pendf=None, njoy_kws={}, **k
data["pnu"] = smps[31].iterate_xs_samples()
if 33 in smps:
data["pxs"] = smps[33].iterate_xs_samples()
# this I'd like to change

if processes == 1:
outs = {}
Expand Down
Loading