optimamodel / optima

Optima HIV software tool
http://optimamodel.com
GNU Lesser General Public License v3.0
7 stars 1 forks source link

Fixed a couple of dict gets that gave spurious Falses #1626

Closed gchadder3 closed 7 years ago

gchadder3 commented 7 years ago

I found a couple of cases in scenarios.py where if _dict_.get(_key_) was used where if _dict_.get(_key_) is not None was the correct choice.

I did not fix other potential cases, but I did a grep in the optima files in the optima/optima directory: grep "\.get(" and some additional cases came up in plotting.py and programs.py that look like potentially the same issue.

To test the present fix, do

import optima as op
loadProjFileName = 'C:\\Users\\George\\Documents\\Career\\Contract Coding\\Optima HIV\\Optima HIV Projects\\Ontario_NSP_20170505.prj' # wherever file is on your system
P = op.loadproj(loadProjFileName)
P.runscenarios()
op.pygui(P.results[1])

The NSP_lower curve should now be under the Without NSP_lower curve in the New infections acquired graph.

cliffckerr commented 7 years ago

@gchadder3 looks good!