- changed status to resolved
Missing tests in composite context
Issue #210
resolved
Currently if a test does not have a value entered for it, it is not included in the composite calculations context.
All tests, whether they have values entered for them or not should be included in the composite calculation context. This makes it easier to do calculations which have "optional" values.
For example if you want to average over 1 or more values you currently have to do something like
readings = []
try:
readings.append(elekta_6mv_r1)
except NameError:
pass
try:
readings.append(elekta_6mv_r2)
except NameError:
pass
try:
readings.append(elekta_6mv_r3)
except NameError:
pass
result = sum(readings)/len(readings)
If all the tests were available in the namespace than you could just do:
readings = [x for x in (elekta_6mv_r1, elekta_6mv_r2, elekta_6mv_r3) if x]
result = sum(readings)/len(readings)
Comments (1)
-
reporter - Log in to comment
fixed in dev.