The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings EMULSION public releases
Summary Activity Surveys SCM Listes Sympa

SCM Repository

authorSébastien Picault <sebastien.picault@inra.fr>
Tue, 9 Jul 2019 15:59:45 +0000 (17:59 +0200)
committerSébastien Picault <sebastien.picault@inra.fr>
Tue, 9 Jul 2019 15:59:45 +0000 (17:59 +0200)
README.md
doc/html/_modules/emulsion/agent/managers/compart_process_manager.html
doc/html/_static/documentation_options.js
doc/html/index.html
doc/html/models.zip
doc/html/objects.inv
doc/html/pages/License.html
src/emulsion/__init__.py
src/emulsion/__main__.py
src/emulsion/agent/managers/compart_process_manager.py

index a2e6f94..74414b5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 EMULSION: Epidemiological Multi-Level Simulation framework
 ======================
 
-![Version](https://img.shields.io/badge/version-1.0.7-f16152.svg)
+![Version](https://img.shields.io/badge/version-1.0.8-f16152.svg)
 ![License](https://img.shields.io/badge/license-Apache--2.0-8cd0c3.svg)
 
 <!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
@@ -36,7 +36,7 @@ individual-based models, metapopulations) and multiple scales (from
 individuals to metapopulations), thanks to recent research in
 Artificial Intelligence.
 
-- **Version 1.0.7**
+- **Version 1.0.8**
 - **License:** Apache-2.0
 - **Contributors and contact:**
   - Sébastien Picault (`sebastien.picault@inra.fr`)
index 07cc356..444551a 100644 (file)
 <div class="viewcode-block" id="CompartProcessManager.add_new_population"><a class="viewcode-back" href="../../../../emulsion.agent.managers.html#emulsion.agent.managers.compart_process_manager.CompartProcessManager.add_new_population">[docs]</a>    <span class="k">def</span> <span class="nf">add_new_population</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">process_name</span><span class="p">,</span> <span class="n">population</span><span class="p">):</span>
         <span class="n">to_add</span> <span class="o">=</span> <span class="p">{}</span>
         <span class="k">for</span> <span class="n">target_state</span><span class="p">,</span> <span class="n">amount</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">population</span><span class="p">:</span>
-            <span class="n">to_add</span><span class="p">[(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_model_value</span><span class="p">(</span><span class="n">target_state</span><span class="p">),)]</span> <span class="o">=</span> <span class="n">amount</span>
+            <span class="n">key</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_model_value</span><span class="p">(</span><span class="n">target_state</span><span class="p">),)</span>
+            <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">to_add</span> <span class="ow">and</span> <span class="n">amount</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">to_add</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">amount</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">to_add</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">+=</span> <span class="n">amount</span>
         <span class="bp">self</span><span class="o">.</span><span class="n">add_population</span><span class="p">({</span><span class="n">process_name</span><span class="p">:</span> <span class="n">to_add</span><span class="p">})</span></div>
 
 
index f5d9455..8faf40d 100644 (file)
@@ -1,6 +1,6 @@
 var DOCUMENTATION_OPTIONS = {
     URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
-    VERSION: '1.0.7',
+    VERSION: '1.0.8',
     LANGUAGE: 'en',
     COLLAPSE_INDEX: false,
     FILE_SUFFIX: '.html',
index 4ab4393..7dcd70d 100644 (file)
@@ -36,7 +36,7 @@
             
   <div class="section" id="emulsion-manual">
 <h1>EMULSION Manual<a class="headerlink" href="#emulsion-manual" title="Permalink to this headline">¶</a></h1>
-<p><img alt="badge-license" src="https://img.shields.io/badge/license-Apache--2.0-8cd0c3.svg" /> <img alt="badge-release" src="https://img.shields.io/badge/version-1.0.7-f16152.svg" /></p>
+<p><img alt="badge-license" src="https://img.shields.io/badge/license-Apache--2.0-8cd0c3.svg" /> <img alt="badge-release" src="https://img.shields.io/badge/version-1.0.8-f16152.svg" /></p>
 <p>Framework EMULSION is intended for modellers in epidemiology, to help
 them design, simulate, and revise complex mechanistic stochastic
 models, without having to write or rewrite huge amounts of code.</p>
index 0bc8a2a..c93d1f6 100644 (file)
Binary files a/doc/html/models.zip and b/doc/html/models.zip differ
index 4e5d531..301962b 100644 (file)
Binary files a/doc/html/objects.inv and b/doc/html/objects.inv differ
index 6c1119f..15b820a 100644 (file)
@@ -41,7 +41,7 @@
 <p>Framework EMULSION is deposited at the French <a class="reference external" href="https://www.app.asso.fr/en">APP (Agency for the
 Protection of Programs)</a> with reference:
 <code class="docutils literal notranslate"><span class="pre">IDDN.FR.001.280043.000.R.P.2018.000.10000</span></code>.</p>
-<p>EMULSION version 1.0.7 is released under the following license (Apache-2.0):</p>
+<p>EMULSION version 1.0.8 is released under the following license (Apache-2.0):</p>
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
                                  <span class="n">Apache</span> <span class="n">License</span>
                            <span class="n">Version</span> <span class="mf">2.0</span><span class="p">,</span> <span class="n">January</span> <span class="mi">2004</span>
index 3043405..f8a70a7 100644 (file)
@@ -54,5 +54,5 @@ EMULSION: Epidemiologic Multi-Level Simulation framework
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 
-__version__ = '1.0.7'
+__version__ = '1.0.8'
 __all__ = ['tools', 'agent', 'model', 'templates']
index c21c071..400fe98 100644 (file)
@@ -182,7 +182,7 @@ from   emulsion.tools.misc          import load_class
 from   emulsion.tools.plot          import plot_outputs
 from   emulsion.tools.simulation    import MultiSimulation
 
-VERSION = '1.0.7'
+VERSION = '1.0.8'
 DEFAULT_VERSION = "1.0"
 LICENSE = 'Apache-2.0'
 DEFAULT_LICENSE = "Apache-2.0"
index 07be0cf..d71e9fa 100644 (file)
@@ -161,7 +161,11 @@ class CompartProcessManager(AbstractProcessManager):
     def add_new_population(self, process_name, population):
         to_add = {}
         for target_state, amount, _ in population:
-            to_add[(self.get_model_value(target_state),)] = amount
+            key = (self.get_model_value(target_state),)
+            if key not in to_add and amount > 0:
+                to_add[key] = amount
+            else:
+                to_add[key] += amount
         self.add_population({process_name: to_add})