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

Make genpdf run on LUXqed17_plus_PDF4LHC15_nnlo_100 #230

Open
felixhekhorn opened this issue Mar 23, 2023 · 0 comments
Open

Make genpdf run on LUXqed17_plus_PDF4LHC15_nnlo_100 #230

felixhekhorn opened this issue Mar 23, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@felixhekhorn
Copy link
Contributor

Talking with Stefan Kallweit I realized that genpdf can not parse LUXqed17_plus_PDF4LHC15_nnlo_100 because they added some more chunk to their .dat files. A minimal improvement would be

diff --git a/src/ekobox/genpdf/load.py b/src/ekobox/genpdf/load.py
index dbb23960..9b527f32 100644
--- a/src/ekobox/genpdf/load.py
+++ b/src/ekobox/genpdf/load.py
@@ -59,6 +59,19 @@ def load_blocks_from_file(pdfset_name, member):
     cnt = []
     with open(src / f"{pdfset_name}_{member:04d}.dat", encoding="utf-8") as o:
         cnt = o.readlines()
+    ccnt = []
+    for l in cnt:
+        if l.strip().startswith("#"): continue
+        ccnt.append(l)
+    cnt = ccnt
+    def clear(s):
+        l = s.strip().split(" ")
+        ll = []
+        for e in l:
+            if len(e) == 0:
+                continue
+            ll.append(e)
+        return ll
     # file head
     head = cnt[0]
     head_section = cnt.index("---\n")
@@ -69,7 +82,7 @@ def load_blocks_from_file(pdfset_name, member):
         # determine participating pids
         xgrid = np.array(cnt[head_section + 1].strip().split(" "), dtype=np.float_)
         Qgrid = np.array(cnt[head_section + 2].strip().split(" "), dtype=np.float_)
-        pids = np.array(cnt[head_section + 3].strip().split(" "), dtype=np.int_)
+        pids = np.array(clear(cnt[head_section + 3]), dtype=np.int_)
         # data
         data = []
         for line in cnt[head_section + 4 : next_head_section]:

TODO:

  • convert this issue into a PR
  • maybe keep the comments in the head of the file
@felixhekhorn felixhekhorn added the enhancement New feature or request label Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant