Make `genpdf` run on `LUXqed17_plus_PDF4LHC15_nnlo_100`

Aperta
#230 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start with src/ekobox/genpdf/load.py and trace how load_blocks_from_file parses the PDF data file, especially its header and PID row. Check whether comment lines and extra whitespace or chunks in the named set explain the failure; done means genpdf can parse LUXqed17_plus_PDF4LHC15_nnlo_100 while preserving the intended header handling.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

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
Lingua principale
Python
Stelle
13
Fork
9
Merge medio
6g 16h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NNPDF/eko

Tutte le issue di NNPDF/eko

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.