Skip to content

Commit

Permalink
yoda writer: check number of y values does not exceed number of x values
Browse files Browse the repository at this point in the history
* This mistake is now caught at the validation stage for new uploads.

Signed-off-by: Graeme Watt <graeme.watt@durham.ac.uk>
  • Loading branch information
GraemeWatt committed Dec 20, 2018
1 parent 0369bfb commit 96a853a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hepdata_converter/writers/yoda_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ def _create_scatter(self):
graph = self.get_scatter_cls()()

for i in xrange(len(self.yval)):

# Check that number of y values does not exceed number of x values.
too_many_y_values = False
for dim_i in xrange(self.dim):
if i > len(self.xval[dim_i]) - 1:
too_many_y_values = True
if too_many_y_values: break

args = []
for dim_i in xrange(self.dim):
args.append(self.xval[dim_i][i])
Expand Down

0 comments on commit 96a853a

Please sign in to comment.