Skip to content

Commit

Permalink
Merge pull request #22 from HEPData/converter_fixes
Browse files Browse the repository at this point in the history
conversion: more small corrections and improvements
  • Loading branch information
eamonnmag committed Apr 21, 2016
2 parents 8379a09 + b2ba0bd commit 4d40a38
Show file tree
Hide file tree
Showing 15 changed files with 219 additions and 204 deletions.
4 changes: 2 additions & 2 deletions hepdata_converter/parsers/oldhepdata_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def _read_multiline(self, init_data):
result += data

result = result.strip()
if not result.endswith('.'):
if result and not result.endswith('.'):
result += '.'

return result
Expand All @@ -551,7 +551,7 @@ def _bind_set_table_metadata(self, key, multiline=False):
def set_table_metadata(self, data):
if multiline:
data = self._read_multiline(data)
if key == 'location':
if key == 'location' and data:
data = 'Data from ' + data
self.current_table.metadata[key] = data.strip()

Expand Down
14 changes: 7 additions & 7 deletions hepdata_converter/testsuite/testdata/csv/full/Table3.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#: keyword reactions: P P --> Z0 Z0 X
#: keyword observables: DSIG/DPT
#: keyword energies: 7000.0
#: RE,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < LEPTON+ LEPTON- > X
#: SQRT(S) [GEV],,7000.0
'Leading dilepton PT [GEV] LOW','Leading dilepton PT [GEV] HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DPT [GEV**-1]','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
0.0,60.0,7000.0,1100.0,-1100.0,79.0,-79.0,15.0,-15.0
60.0,100.0,9800.0,1600.0,-1600.0,75.0,-75.0,15.0,-15.0
100.0,200.0,1600.0,490.0,-490.0,41.0,-41.0,2.0,-2.0
200.0,600.0,80.0,60.0,-60.0,2.0,-2.0,0.0,-0.0
#: RE,,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < LEPTON+ LEPTON- > X
#: SQRT(S) [GEV],,,7000.0
'Leading dilepton PT [GEV]','Leading dilepton PT [GEV] LOW','Leading dilepton PT [GEV] HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DPT [GEV**-1]','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
30.0,0.0,60.0,7000.0,1100.0,-1100.0,79.0,-79.0,15.0,-15.0
80.0,60.0,100.0,9800.0,1600.0,-1600.0,75.0,-75.0,15.0,-15.0
150.0,100.0,200.0,1600.0,490.0,-490.0,41.0,-41.0,2.0,-2.0
400.0,200.0,600.0,80.0,60.0,-60.0,2.0,-2.0,0.0,-0.0

12 changes: 6 additions & 6 deletions hepdata_converter/testsuite/testdata/csv/full/Table4.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#: keyword reactions: P P --> Z0 Z0 X
#: keyword observables: DSIG/DPT
#: keyword energies: 7000.0
#: RE,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < NU NUBAR > X
#: SQRT(S) [GEV],,7000.0
'Leading dilepton PT [GEV] LOW','Leading dilepton PT [GEV] HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DPT [GEV**-1]','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
50.0,90.0,9930.0,3340.0,-3340.0,80.0,-80.0,740.0,-740.0
90.0,130.0,8280.0,3210.0,-3210.0,200.0,-200.0,260.0,-260.0
130.0,200.0,3900.0,1490.0,-1490.0,120.0,-120.0,390.0,-390.0
#: RE,,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < NU NUBAR > X
#: SQRT(S) [GEV],,,7000.0
'Leading dilepton PT [GEV]','Leading dilepton PT [GEV] LOW','Leading dilepton PT [GEV] HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DPT [GEV**-1]','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
70.0,50.0,90.0,9930.0,3340.0,-3340.0,80.0,-80.0,740.0,-740.0
110.0,90.0,130.0,8280.0,3210.0,-3210.0,200.0,-200.0,260.0,-260.0
165.0,130.0,200.0,3900.0,1490.0,-1490.0,120.0,-120.0,390.0,-390.0

14 changes: 7 additions & 7 deletions hepdata_converter/testsuite/testdata/csv/full/Table5.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ UPDATE (30 APR 2014): extra significant digit added for first bin.
#: keyword reactions: P P --> Z0 Z0 X
#: keyword observables: DSIG/DPHI
#: keyword energies: 7000.0
#: RE,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < LEPTON+ LEPTON- > X
#: SQRT(S) [GEV],,7000.0
'Leading dilepton DELTA(PHI(LEPTON+,LEPTON-)) LOW','Leading dilepton DELTA(PHI(LEPTON+,LEPTON-)) HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DDELTA(PHI(LEPTON+,LEPTON-))','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
0.0,0.5,130000.0,69000.0,-69000.0,6600.0,-6600.0,10.0,-10.0
0.5,1.0,280000.0,100000.0,-100000.0,9000.0,-9000.0,400.0,-400.0
1.0,1.7,260000.0,80000.0,-80000.0,10000.0,-10000.0,300.0,-300.0
1.7,3.14159,420000.0,50000.0,-50000.0,2000.0,-2000.0,300.0,-300.0
#: RE,,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < LEPTON+ LEPTON- > X
#: SQRT(S) [GEV],,,7000.0
'Leading dilepton DELTA(PHI(LEPTON+,LEPTON-))','Leading dilepton DELTA(PHI(LEPTON+,LEPTON-)) LOW','Leading dilepton DELTA(PHI(LEPTON+,LEPTON-)) HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DDELTA(PHI(LEPTON+,LEPTON-))','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
0.25,0.0,0.5,130000.0,69000.0,-69000.0,6600.0,-6600.0,10.0,-10.0
0.75,0.5,1.0,280000.0,100000.0,-100000.0,9000.0,-9000.0,400.0,-400.0
1.35,1.0,1.7,260000.0,80000.0,-80000.0,10000.0,-10000.0,300.0,-300.0
2.420795,1.7,3.14159,420000.0,50000.0,-50000.0,2000.0,-2000.0,300.0,-300.0

12 changes: 6 additions & 6 deletions hepdata_converter/testsuite/testdata/csv/full/Table6.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#: keyword reactions: P P --> Z0 Z0 X
#: keyword observables: DSIG/DPHI
#: keyword energies: 7000.0
#: RE,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < NU NUBAR > X
#: SQRT(S) [GEV],,7000.0
'Leading dilepton DELTA(PHI(LEPTON+,LEPTON-)) LOW','Leading dilepton DELTA(PHI(LEPTON+,LEPTON-)) HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DDELTA(PHI(LEPTON+,LEPTON-))','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
0.0,0.5,346000.0,158000.0,-158000.0,4000.0,-4000.0,19000.0,-19000.0
0.5,1.7,569000.0,91000.0,-91000.0,4000.0,-4000.0,71000.0,-71000.0
1.7,3.14159,100000.0,70000.0,-70000.0,2000.0,-2000.0,58000.0,-58000.0
#: RE,,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < NU NUBAR > X
#: SQRT(S) [GEV],,,7000.0
'Leading dilepton DELTA(PHI(LEPTON+,LEPTON-))','Leading dilepton DELTA(PHI(LEPTON+,LEPTON-)) LOW','Leading dilepton DELTA(PHI(LEPTON+,LEPTON-)) HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DDELTA(PHI(LEPTON+,LEPTON-))','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
0.25,0.0,0.5,346000.0,158000.0,-158000.0,4000.0,-4000.0,19000.0,-19000.0
1.1,0.5,1.7,569000.0,91000.0,-91000.0,4000.0,-4000.0,71000.0,-71000.0
2.420795,1.7,3.14159,100000.0,70000.0,-70000.0,2000.0,-2000.0,58000.0,-58000.0

14 changes: 7 additions & 7 deletions hepdata_converter/testsuite/testdata/csv/full/Table7.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#: keyword reactions: P P --> Z0 Z0 X
#: keyword observables: DSIG/DM
#: keyword energies: 7000.0
#: RE,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < LEPTON+ LEPTON- > X
#: SQRT(S) [GEV],,7000.0
'M(ZZ) [GEV] LOW','M(ZZ) [GEV] HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DM(ZZ)','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
0.0,240.0,2200.0,300.0,-300.0,40.0,-40.0,2.0,-2.0
240.0,300.0,4500.0,1000.0,-1000.0,100.0,-100.0,5.0,-5.0
300.0,400.0,1000.0,400.0,-400.0,20.0,-20.0,2.0,-2.0
400.0,800.0,280.0,100.0,-100.0,10.0,-10.0,1.0,-1.0
#: RE,,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < LEPTON+ LEPTON- > X
#: SQRT(S) [GEV],,,7000.0
'M(ZZ) [GEV]','M(ZZ) [GEV] LOW','M(ZZ) [GEV] HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DM(ZZ)','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
120.0,0.0,240.0,2200.0,300.0,-300.0,40.0,-40.0,2.0,-2.0
270.0,240.0,300.0,4500.0,1000.0,-1000.0,100.0,-100.0,5.0,-5.0
350.0,300.0,400.0,1000.0,400.0,-400.0,20.0,-20.0,2.0,-2.0
600.0,400.0,800.0,280.0,100.0,-100.0,10.0,-10.0,1.0,-1.0

12 changes: 6 additions & 6 deletions hepdata_converter/testsuite/testdata/csv/full/Table8.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#: keyword reactions: P P --> Z0 Z0 X
#: keyword observables: DSIG/DM
#: keyword energies: 7000.0
#: RE,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < NU NUBAR > X
#: SQRT(S) [GEV],,7000.0
'MT(ZZ) [GEV] LOW','MT(ZZ) [GEV] HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DMT(ZZ)','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
220.0,250.0,10500.0,4400.0,-4400.0,300.0,-300.0,1900.0,-1900.0
250.0,300.0,6320.0,2630.0,-2630.0,230.0,-230.0,280.0,-280.0
300.0,400.0,3680.0,1210.0,-1210.0,60.0,-60.0,480.0,-480.0
#: RE,,,P P --> Z0 < LEPTON+ LEPTON- > Z0 < NU NUBAR > X
#: SQRT(S) [GEV],,,7000.0
'MT(ZZ) [GEV]','MT(ZZ) [GEV] LOW','MT(ZZ) [GEV] HIGH','10**6 * 1/SIG(fiducial) * D(SIG(fiducial))/DMT(ZZ)','stat +','stat -','sys,detector +','sys,detector -','sys,background +','sys,background -'
235.0,220.0,250.0,10500.0,4400.0,-4400.0,300.0,-300.0,1900.0,-1900.0
275.0,250.0,300.0,6320.0,2630.0,-2630.0,230.0,-230.0,280.0,-280.0
350.0,300.0,400.0,3680.0,1210.0,-1210.0,60.0,-60.0,480.0,-480.0

30 changes: 15 additions & 15 deletions hepdata_converter/testsuite/testdata/csv/table_9.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
#: description: The observed and expected EmissT distribution in the dielectron SR-Z. The negigible estimated contribution from Z+jets is omitted in these distributions. The last bin contains the overflow.
#: data_file: data9.yaml
#: keyword energies: 8000
#: EVENTS [GEV],,25,25,,,25,25
#: SQRT(S) [GeV],,8000.0,8000.0,,,8000.0,8000.0
'ETMISS [GEV] LOW','ETMISS [GEV] HIGH','Data','Expected Background','error +','error -','GGM 700 200 1.5','GGM 900 600 1.5'
200.0,225.0,0.0,0.0,0.0,-0.0,0.0,0.0
225.0,250.0,6.0,0.95,0.41,-0.51,6.46,0.97
250.0,275.0,1.0,0.9,0.41,-0.26,6.82,1.07
275.0,300.0,1.0,0.42,0.12,-0.19,2.82,1.17
300.0,325.0,1.0,0.34,0.16,-0.15,2.41,1.05
325.0,350.0,2.0,0.07,0.19,-0.16,3.11,1.08
350.0,375.0,1.0,0.68,0.56,-0.55,0.7,1.13
375.0,400.0,1.0,0.17,0.1,-0.15,0.9,1.2
400.0,425.0,0.0,0.24,0.11,-0.1,0.69,1.01
425.0,450.0,1.0,0.01,0.08,-0.08,0.72,0.94
450.0,475.0,0.0,0.3,0.33,-0.33,0.0,0.88
475.0,500.0,2.0,0.16,0.17,-0.14,0.93,4.59
#: EVENTS [GEV],,,25,25,,,25,25
#: SQRT(S) [GeV],,,8000.0,8000.0,,,8000.0,8000.0
'ETMISS [GEV]','ETMISS [GEV] LOW','ETMISS [GEV] HIGH','Data','Expected Background','error +','error -','GGM 700 200 1.5','GGM 900 600 1.5'
212.5,200.0,225.0,0.0,0.0,0.0,-0.0,0.0,0.0
237.5,225.0,250.0,6.0,0.95,0.41,-0.51,6.46,0.97
262.5,250.0,275.0,1.0,0.9,0.41,-0.26,6.82,1.07
287.5,275.0,300.0,1.0,0.42,0.12,-0.19,2.82,1.17
312.5,300.0,325.0,1.0,0.34,0.16,-0.15,2.41,1.05
337.5,325.0,350.0,2.0,0.07,0.19,-0.16,3.11,1.08
362.5,350.0,375.0,1.0,0.68,0.56,-0.55,0.7,1.13
387.5,375.0,400.0,1.0,0.17,0.1,-0.15,0.9,1.2
412.5,400.0,425.0,0.0,0.24,0.11,-0.1,0.69,1.01
437.5,425.0,450.0,1.0,0.01,0.08,-0.08,0.72,0.94
462.5,450.0,475.0,0.0,0.3,0.33,-0.33,0.0,0.88
487.5,475.0,500.0,2.0,0.16,0.17,-0.14,0.93,4.59
120 changes: 60 additions & 60 deletions hepdata_converter/testsuite/testdata/csv/table_9_unpacked.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,67 @@
#: description: The observed and expected EmissT distribution in the dielectron SR-Z. The negigible estimated contribution from Z+jets is omitted in these distributions. The last bin contains the overflow.
#: data_file: data9.yaml
#: keyword energies: 8000
#: EVENTS [GEV];;25
#: SQRT(S) [GeV];;8000.0
'ETMISS [GEV] LOW';'ETMISS [GEV] HIGH';'Data'
200.0;225.0;0.0
225.0;250.0;6.0
250.0;275.0;1.0
275.0;300.0;1.0
300.0;325.0;1.0
325.0;350.0;2.0
350.0;375.0;1.0
375.0;400.0;1.0
400.0;425.0;0.0
425.0;450.0;1.0
450.0;475.0;0.0
475.0;500.0;2.0
#: EVENTS [GEV];;;25
#: SQRT(S) [GeV];;;8000.0
'ETMISS [GEV]';'ETMISS [GEV] LOW';'ETMISS [GEV] HIGH';'Data'
212.5;200.0;225.0;0.0
237.5;225.0;250.0;6.0
262.5;250.0;275.0;1.0
287.5;275.0;300.0;1.0
312.5;300.0;325.0;1.0
337.5;325.0;350.0;2.0
362.5;350.0;375.0;1.0
387.5;375.0;400.0;1.0
412.5;400.0;425.0;0.0
437.5;425.0;450.0;1.0
462.5;450.0;475.0;0.0
487.5;475.0;500.0;2.0

#: EVENTS [GEV];;25
#: SQRT(S) [GeV];;8000.0
'ETMISS [GEV] LOW';'ETMISS [GEV] HIGH';'Expected Background';'error +';'error -'
200.0;225.0;0.0;0.0;-0.0
225.0;250.0;0.95;0.41;-0.51
250.0;275.0;0.9;0.41;-0.26
275.0;300.0;0.42;0.12;-0.19
300.0;325.0;0.34;0.16;-0.15
325.0;350.0;0.07;0.19;-0.16
350.0;375.0;0.68;0.56;-0.55
375.0;400.0;0.17;0.1;-0.15
400.0;425.0;0.24;0.11;-0.1
425.0;450.0;0.01;0.08;-0.08
450.0;475.0;0.3;0.33;-0.33
475.0;500.0;0.16;0.17;-0.14
#: EVENTS [GEV];;;25
#: SQRT(S) [GeV];;;8000.0
'ETMISS [GEV]';'ETMISS [GEV] LOW';'ETMISS [GEV] HIGH';'Expected Background';'error +';'error -'
212.5;200.0;225.0;0.0;0.0;-0.0
237.5;225.0;250.0;0.95;0.41;-0.51
262.5;250.0;275.0;0.9;0.41;-0.26
287.5;275.0;300.0;0.42;0.12;-0.19
312.5;300.0;325.0;0.34;0.16;-0.15
337.5;325.0;350.0;0.07;0.19;-0.16
362.5;350.0;375.0;0.68;0.56;-0.55
387.5;375.0;400.0;0.17;0.1;-0.15
412.5;400.0;425.0;0.24;0.11;-0.1
437.5;425.0;450.0;0.01;0.08;-0.08
462.5;450.0;475.0;0.3;0.33;-0.33
487.5;475.0;500.0;0.16;0.17;-0.14

#: EVENTS [GEV];;25
#: SQRT(S) [GeV];;8000.0
'ETMISS [GEV] LOW';'ETMISS [GEV] HIGH';'GGM 700 200 1.5'
200.0;225.0;0.0
225.0;250.0;6.46
250.0;275.0;6.82
275.0;300.0;2.82
300.0;325.0;2.41
325.0;350.0;3.11
350.0;375.0;0.7
375.0;400.0;0.9
400.0;425.0;0.69
425.0;450.0;0.72
450.0;475.0;0.0
475.0;500.0;0.93
#: EVENTS [GEV];;;25
#: SQRT(S) [GeV];;;8000.0
'ETMISS [GEV]';'ETMISS [GEV] LOW';'ETMISS [GEV] HIGH';'GGM 700 200 1.5'
212.5;200.0;225.0;0.0
237.5;225.0;250.0;6.46
262.5;250.0;275.0;6.82
287.5;275.0;300.0;2.82
312.5;300.0;325.0;2.41
337.5;325.0;350.0;3.11
362.5;350.0;375.0;0.7
387.5;375.0;400.0;0.9
412.5;400.0;425.0;0.69
437.5;425.0;450.0;0.72
462.5;450.0;475.0;0.0
487.5;475.0;500.0;0.93

#: EVENTS [GEV];;25
#: SQRT(S) [GeV];;8000.0
'ETMISS [GEV] LOW';'ETMISS [GEV] HIGH';'GGM 900 600 1.5'
200.0;225.0;0.0
225.0;250.0;0.97
250.0;275.0;1.07
275.0;300.0;1.17
300.0;325.0;1.05
325.0;350.0;1.08
350.0;375.0;1.13
375.0;400.0;1.2
400.0;425.0;1.01
425.0;450.0;0.94
450.0;475.0;0.88
475.0;500.0;4.59
#: EVENTS [GEV];;;25
#: SQRT(S) [GeV];;;8000.0
'ETMISS [GEV]';'ETMISS [GEV] LOW';'ETMISS [GEV] HIGH';'GGM 900 600 1.5'
212.5;200.0;225.0;0.0
237.5;225.0;250.0;0.97
262.5;250.0;275.0;1.07
287.5;275.0;300.0;1.17
312.5;300.0;325.0;1.05
337.5;325.0;350.0;1.08
362.5;350.0;375.0;1.13
387.5;375.0;400.0;1.2
412.5;400.0;425.0;1.01
437.5;425.0;450.0;0.94
462.5;450.0;475.0;0.88
487.5;475.0;500.0;4.59

Loading

0 comments on commit 4d40a38

Please sign in to comment.