Skip to content

Commit

Permalink
Chi get perturbation (#337)
Browse files Browse the repository at this point in the history
* test push

* No PFNS changes

* get perturbations MF 35

* remove njoy_outputs/
  • Loading branch information
GrimFe authored Aug 29, 2024
1 parent 76d2da8 commit 12ea4c2
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit 12ea4c2

Please sign in to comment.