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

Pendf single process #255

Open
wants to merge 16 commits into
base: v1.0
Choose a base branch
from

Conversation

fdcroce
Copy link
Contributor

@fdcroce fdcroce commented Feb 17, 2023

Edit the function for applying perturbation to nuclear data. Pendf files creation as generators in single processing and possibility to create ace files in single or multiprocessing. The task is carried out by new function to_ace_worker that is intended to replace endf6_perturb_worker.

@luca-fiorito-11
Copy link
Owner

Can you split this PR in 2? Also, as it is It probably won't pass the unit tests. Can you first run them on your computer.

@fdcroce
Copy link
Contributor Author

fdcroce commented Feb 20, 2023

I removed nuclide2latex function from the PR.
Small change to the function run() in sampling module was made for consistency to the reviewed _mp_apply_perturbation function and to allow all tests to run without troubles.

Di Croce Federico added 2 commits March 7, 2023 12:47
@fdcroce
Copy link
Contributor Author

fdcroce commented Mar 7, 2023

Replacement of the pendf perturbation procedure. New static method pendf_perturb to apply perturbations sample by sample.

err=0.01,
temperature=0,
)
njoy_kws = {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove these default options.
I think the reconstruction tolerance err does not need to be the default value of 0.001.

These keywords are only used to produce the ERRORR file right?
Then a low tolerance should be ok.

Also, removing the temperature would just assume by default that the temperature is 0.
Is this the reason why you removed it?

#to transfer keywords to the worker
kwargs["filename"] = filename
kwargs["to_file"] = to_file
kwargs["verbose"] = verbose
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include verbose in input in kwargs and then call it using kwargs["verbose"]

pendf_pert = self.pendf_perturb(pxs, pendf_)
outs[nxs] = to_ace_worker(self.data,
pendf_pert.data,
nxs, **kwargs)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to_ace_worker(self.data, pendf_pert.data, nxs, filename=filename, to_file=to_file, **kwargs)?

--------

"""

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In intro data preprocessing comment saying that kwargs are used for workers and njoy_kws for get_pendf (pendf creation)


if to_ace:
if implicit_effect:
njoy_kws["temperature"] = kwargs["temperature"] = temperature
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment on this

#Temperature
njoy_kws["temperature"] = temperature


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specific case for xs that requires PENDF generation

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be extended (with more if clauses) for other data types

#instances cannot be pickled

for (nxs,pxs) in seq_xs:
pendf_pert = self.pendf_perturb(pxs, pendf_)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to regular method

@@ -2175,56 +2175,174 @@ def apply_perturbations(self, smp, processes=1, **kwargs):
else:
return self._mp_apply_perturbations(smp, processes=processes, **kwargs)

@staticmethod
def pendf_perturb(pxs, pendf):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call it perturb_xs

if processes == 1:
# Passed ENDF-6 and PENDF as dictionaries because class
#instances cannot be pickled
outs = {nxs: to_ace_worker(self.data,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be deleted

# Passed ENDF-6 and PENDF as dictionaries because class
#instances cannot be pickled
outs = {nxs: to_ace_worker(self.data,
self.pendf_perturb(pxs, pendf_).data,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a function/method to englobe pertrub_xs, perturb_nu, perturb_chi, perturb_mu.
Inputs are endf6 + pendf + perturbed xs, nu, chi, mu
Outputs are pert endf6 and pert pendf.

possibly it returns an iterator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants