Uncertainties should not all be zero error

I have a yaml file:

dependent_variables:
- header:
    name: N
  values:
    - errors:
    - label: Total
      symerror: 0.00
    value: 0.0
  - errors:
    - label: Total
      symerror: 0.012174
    value: 24.978
  - errors:
    - label: Total
      symerror: 0.00
    value: 0.0
 independent_variables:
- header:
    name: n
    units: n
  values:
  - high: 1.5
    low: 0.5
  - high: 2.5
    low: 1.5
  - high: 3.5
    low: 2.5

It is obvious that where the binconent is 0.0 the error is 0.0. However the yaml validation produces an error b"Uncertainties should not all be zero in {'errors': [{'label': 'Total', 'symerror': 0.0}], 'value': 0.0}"

In order to escape this problem I twitch the yaml file

  dependent_variables:
    - header:
        name: N
      values:
        - errors:
        - label: Total
          symerror: 0.01
        value: 0.0
      - errors:
        - label: Total
          symerror: 0.012174
        value: 24.978
      - errors:
        - label: Total
          symerror: 0.01
        value: 0.0
     independent_variables:
    - header:
        name: n
        units: n
      values:
      - high: 1.5
        low: 0.5
      - high: 2.5
        low: 1.5
      - high: 3.5
        low: 2.5

Does not seem right

Thanks for the question. If the bin content is zero, you can miss out the errors completely, i.e.

dependent_variables:
- header:
    name: N
  values:
  - value: 0.0
  - errors:
    - label: Total
      symerror: 0.012174
    value: 24.978
  - value: 0.0

I’ll add an explanation to the submission docs.

How can I achieve this effect programmatically in hepdata_lib?
What I need to change in

data.add_uncertainty(unc)
table.add_variable(data)
submission.add_table(table)

I’ve added a new second paragraph to the Uncertainties section of the submission documentation. I don’t think it’s currently possible to omit the errors using hepdata_lib. I’ve opened a GitHub issue, but for now you might need to post-process the YAML files produced by hepdata_lib to remove the errors.

Alternatively, if the bin content is zero for the 0.5-1.5 and 2.5-3.5 bins of your example, couldn’t you just remove these rows completely from the HEPData table, i.e. only give results for the bin 1.5-2.5 with non-zero content?

The latest hepdata-lib v0.5.0 now automatically suppresses the errors key (with a warning message) if all uncertainties are zero for a particular bin.