EMOD-Hub / EMOD

Source files for building the IDM EMOD disease transmission model.
MIT License
94 stars 41 forks source link

Check AgeDistribution for nested arrays #55

Closed Bridenbecker closed 1 week ago

Bridenbecker commented 1 week ago

Ricky and Northwestern had a situation where his demographics had an AgeDistribution where the DistributionValues and ResultValues where nested arrays. For example:

"AgeDistribution": {
    "ResultValues":       [ [   0,   10,  20,   30      ] ]
    "DistributionValues": [ [ 0.0, 0.25, 0.5, 0.75, 1.0 ] ]
}

Things can work correctly with the nested arrays but you must have the same number of elements for ResultValues and DistributionValues. However, as in the example above, Ricky did not and the checks to for this were fooled by the nested arrays to think that each parameter had one value. This resulted in random behavior because arrays were being indexed out of the arrays memory.

Solution: Add a check so that you can not have nested arrays.