popsim-consortium / demes-python

Tools for describing and manipulating demographic models.
https://popsim-consortium.github.io/demes-docs/
ISC License
19 stars 6 forks source link

Graphs inconsistent w/the specification are accepted #576

Open molpopgen opened 1 day ago

molpopgen commented 1 day ago

The Python API will accept this graph:

import demes

yaml = """
time_units: generations
demes:
 - name: A
   epochs:
    - start_size: 1000
 - name: B
   epochs:
    - start_size: 1000
 - name: C
   epochs:
    - start_size: 1000
pulses:
- sources: [A]
  dest: C
  proportions: [0.]
  time: 10
"""

g = demes.loads(yaml)

The JSON schema of the specification excludes 0 as a valid value for a proportion:

  proportion:
    type: number
    exclusiveMinimum: 0
    maximum: 1

Some casually grepping of the test cases in the demes-spec repo indicated that 0.0 doesn't appear anywhere over there. I could have missed it, though.