BreakingBytes / simkit

Model Simulation Framework
http://breakingbytes.github.io/simkit/
BSD 3-Clause "New" or "Revised" License
27 stars 16 forks source link

don't make meta keys in data registry required arguments and don't use negative booleaness #115

Open mikofski opened 7 years ago

mikofski commented 7 years ago

Currently the data registry meta keys: uncertainty, variance and isconstant are required arguments and if you don't enter them, then your any attempts to register data will raise an unhandled exception.

Also, currently the data registry using negative booleaness to test whether or not to include the values of these meta keys, and if False then the default value is an empty dictionary, {}. But what if you want the value to be None, this equates to False and get's changed to {} which can cause problems.

This was an issue in reg_copy in the LazyLoopingCalculator because it iterates over keys using .get(k) so the new uncertainty was {'key1': None, 'key2': None, ...} which then was registered in the "new" registry, and since the dictionary is not empty the registry tries to treat it as uncertainty, but uncertainty and variance are nested dictionaries to account for covariance (unnecessary for uncertainty actually). See #100