optimamodel / optima-tb

Optima TB-UCL model
GNU Lesser General Public License v3.0
2 stars 0 forks source link

Negative value for junction #29

Closed hussainazfar closed 7 years ago

hussainazfar commented 7 years ago

The junctions are not clearing properly, resulting in a very small negative value.

A check in processJunction needs to be inserted to clear junction and check for small negative values. Error log is as follows:

Traceback (most recent call last):

  File "<ipython-input-6-c72b311486f3>", line 1, in <module>
    runfile('C:/Users/Azfar/Documents/tb-ucl-analyses/belarus/run_belarus_autofit.py', wdir='C:/Users/Azfar/Documents/tb-ucl-analyses/belarus')

  File "C:\Program Files\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
    execfile(filename, namespace)

  File "C:\Program Files\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "C:/Users/Azfar/Documents/tb-ucl-analyses/belarus/run_belarus_autofit.py", line 29, in <module>
    proj.runAutofitCalibration(new_parset_name=name,target_characs=['spd_inf', 'spm_inf', 'spx_inf', 'snd_inf', 'snm_inf', 'snx_inf', 'sp_inf', 'sn_inf', 'ac_inf'])

  File "C:\Users\Azfar\Documents\tb-ucl\optima_tb\project.py", line 184, in runAutofitCalibration
    new_parset = performAutofit(self,paramset,new_parset_name=new_parset_name,target_characs=target_characs,**self.settings.autofit_params)

  File "C:\Users\Azfar\Documents\tb-ucl\optima_tb\calibration.py", line 195, in performAutofit
    parvecnew, fval, exitflag, output = asd.asd(objective_calc, paramvec, init_compartments=compartment_init, xmin=mins,xmax=maxs,xnames=casc_labels+charac_labels,**calibration_settings)

  File "C:\Users\Azfar\Documents\tb-ucl\optima_tb\asd.py", line 97, in asd
    fval = sum(function(x,init_compartments))# Calculate initial value of the objective function

  File "C:\Users\Azfar\Documents\tb-ucl\optima_tb\calibration.py", line 189, in objective_calc
    results = project.runSim(parameterset = sample_param)

  File "C:\Users\Azfar\Documents\tb-ucl\optima_tb\project.py", line 67, in runSim
    results = runModel(settings = self.settings, parset = parset)

  File "C:\Users\Azfar\Documents\tb-ucl\optima_tb\model.py", line 722, in runModel
    m.build(settings = settings, parset = parset)

  File "C:\Users\Azfar\Documents\tb-ucl\optima_tb\model.py", line 341, in build
    raise OptimaException('ERROR: Initial value calculated for compartment "%s" in population "%s" is %f. Review and make sure each characteristic has at least as many people as the sum of all included compartments.' % (seed_label, pop_label, val))

OptimaException: ERROR: Initial value calculated for compartment "spj" in population "15-64" is -0.000000. Review and make sure each characteristic has at least as many people as the sum of all included compartments.
critcortex commented 7 years ago

This should have been fixed by 445abf0e3d193cbdfa1d7885e5708e5832556b32 ... but I forgot an import . Sigh.

hussainazfar commented 7 years ago

Resolved after adding tolerance for returned values by the following commits: 445abf0 & 929a451