Adding action to bundle PDFs#1340
Conversation
|
Will add docstrings if we're happy with the design |
|
Not sure I understand. What is "bundle" here doing exactly? And the PDF sets should be pdf: NNPDF40_nnlo_as_0118 pdfs:
actions_:
if I understand? |
|
Yeah, the runcard I posted above is just an example to get it working because I didn't know what sets to exactly work with. The |
|
ok, the proof is in the pudding, if someone can produce the bundled sets we can check whether or not they behave as they ought to |
@juanrojochacon With the runcard provided by @siranipour it's really trivial to produce a bundled set. I've just produced a bundled set for our NNLO baseline+alphas=0.117&alphas=0.119, you can find it on the server (its name is |
|
thanks let me check it |
|
If I compute the means and errors by hand from the bundled sets and from the individual sets I get perfect agreement, I think we are happy and should close this PR x, Q = 1e-05 1.65 x, Q = 1e-05 10 x, Q = 1e-05 100 x, Q = 1e-05 100000.0 x, Q = 0.0001 1.65 x, Q = 0.0001 10 x, Q = 0.0001 100 x, Q = 0.0001 100000.0 x, Q = 0.001 1.65 x, Q = 0.001 10 x, Q = 0.001 100 x, Q = 0.001 100000.0 x, Q = 0.01 1.65 x, Q = 0.01 10 x, Q = 0.01 100 x, Q = 0.01 100000.0 x, Q = 0.1 1.65 x, Q = 0.1 10 x, Q = 0.1 100 x, Q = 0.1 100000.0 x, Q = 0.3 1.65 |
|
Also, can you remind me what is the python command to compute PDF errors using the native LHAPDF routines, rather than our own ones? |
|
@siranipour Seems to me the choice of module where this is places is a bit obscure. |
|
@juanrojochacon A successful PR is "merged", not "closed" ;) |
|
|
||
| # Fixup the info file | ||
| info_file = (temp_pdf/temp_pdf.name).with_suffix('.info') | ||
| os.system(f"sed -i -e 's/NumMembers.*/NumMembers: {new_nrep}/g' {info_file}") |
There was a problem hiding this comment.
I'd rather use YAML at this point instead of the funny external commands.
There was a problem hiding this comment.
Yeah so would I but in place file manipulation is a true nightmare in python. Also, is it fair to assume the .info file is in yaml format? The suffix didn't imply it would always be yaml
There was a problem hiding this comment.
It is always YAML and LHAPDF uses that internally. No need to do anything "in place" AFAICT. It is load structure from file, manipulate structure, write structure to file (which may or may not be the same as before seeing as it is closed by now).
There was a problem hiding this comment.
Are you fine with using sed to prepend the alphas_MZ and alphas_Vals to the replica files?
There was a problem hiding this comment.
All things equal I'd rather not. It is one more external thing, with annoying differences between linux and mac. And we should have plenty of tools to do it the right way.
@juanrojochacon Which does not mean that we encourage you to merge this PR. Review is still pending. |
|
As an aside, I am thinking that if we ever want to support this ourselves, we would need things like def _find_as_variation_theories(main_theoryid: int) -> List[int]
...
def find_as_variation_theory_for(main_thoeryid: int, alpha_s: Real): -> int
...Could be done with a bit of sql magic, or my hardcoding these things in python. Similar for scale variations incidentally. |
|
Sorry ;) |
|
@Zaharid, I've removed our reliance on |
Co-authored-by: Zaharid <zk261@cam.ac.uk>
|
I still thing the action should be named differently. |
| """ | ||
| info_file = pathlib.Path(alphas_pdf.infopath) | ||
|
|
||
| with open(info_file, 'r') as stream: |
There was a problem hiding this comment.
Not that it matters, but these things should operate on bytes rather than text.
There was a problem hiding this comment.
Ah didn't know that, will fix
| info_file = pathlib.Path(alphas_pdf.infopath) | ||
|
|
||
| with open(info_file, 'r') as stream: | ||
| with open(info_file, 'rb') as stream: |
There was a problem hiding this comment.
Actually the only one that mattered a bit was new_replica_file (in and out). Reason being to avoid somewhat expensive utf 8 conversions on the relatively many big files.
|
@siranipour please delete the grid named |
Add type checks to target name.
For all we know the current path may not be writable or accessible.
|
@siranipour Please add some docs and merge. |
Add comment to description on alpha_s variations. Also use the newer interface to make sure it round trips.
An action that closes #1331. You specify the base pdf as
pdfand the alphas pdfs for which you want to add the replica 0s from withpdfs.Example runcard:
Edit: you can find the bundled PDF set inside the
outputfolder. Note it won't overwrite the bundled PDF if it already exists