diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ab7ee2..0694420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.14.7] +### Changed +* Minor change to traceback handling in async simulations +### Fixed +* Incomplete example in the docs (example.yml) caused an exception ## [0.14.6] ### Fixed * Bug with newer versions of networkx (0.24) where the Graph.node attribute has been removed. We have updated our calls, but the code in nxsim is not under our control, so we have pinned the networkx version until that issue is solved. diff --git a/docs/configuration.rst b/docs/configuration.rst index c012cb1..0d2bb9a 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -8,32 +8,8 @@ The advantage of a configuration file is that it is a clean declarative descript Simulation configuration files can be formatted in ``json`` or ``yaml`` and they define all the parameters of a simulation. Here's an example (``example.yml``). -.. code:: yaml - - --- - name: MyExampleSimulation - max_time: 50 - num_trials: 3 - interval: 2 - network_params: - generator: barabasi_albert_graph - n: 100 - m: 2 - network_agents: - - agent_type: SISaModel - weight: 1 - state: - id: content - - agent_type: SISaModel - weight: 1 - state: - id: discontent - - agent_type: SISaModel - weight: 8 - state: - id: neutral - environment_params: - prob_infect: 0.075 +.. literalinclude:: example.yml + :language: yaml This example configuration will run three trials (``num_trials``) of a simulation containing a randomly generated network (``network_params``). diff --git a/docs/example.yml b/docs/example.yml new file mode 100644 index 0000000..4ef6ef2 --- /dev/null +++ b/docs/example.yml @@ -0,0 +1,35 @@ +--- +name: MyExampleSimulation +max_time: 50 +num_trials: 3 +interval: 2 +network_params: + generator: barabasi_albert_graph + n: 100 + m: 2 +network_agents: + - agent_type: SISaModel + weight: 1 + state: + id: content + - agent_type: SISaModel + weight: 1 + state: + id: discontent + - agent_type: SISaModel + weight: 8 + state: + id: neutral +environment_params: + prob_infect: 0.075 + neutral_discontent_spon_prob: 0.1 + neutral_discontent_infected_prob: 0.3 + neutral_content_spon_prob: 0.3 + neutral_content_infected_prob: 0.4 + discontent_neutral: 0.5 + discontent_content: 0.5 + variance_d_c: 0.2 + content_discontent: 0.2 + variance_c_d: 0.2 + content_neutral: 0.2 + standard_variance: 1 diff --git a/soil/VERSION b/soil/VERSION index 66fb941..0adfe40 100644 --- a/soil/VERSION +++ b/soil/VERSION @@ -1 +1 @@ -0.14.6 \ No newline at end of file +0.14.7 \ No newline at end of file diff --git a/soil/simulation.py b/soil/simulation.py index 6dd9c18..a414da4 100644 --- a/soil/simulation.py +++ b/soil/simulation.py @@ -216,9 +216,10 @@ class Simulation(NetworkSimulation): try: return self.run_trial(*args, **kwargs) except Exception as ex: - c = ex.__cause__ - c.message = ''.join(traceback.format_exception(type(c), c, c.__traceback__)[:]) - return c + if ex.__cause__ is not None: + ex = ex.__cause__ + ex.message = ''.join(traceback.format_exception(type(ex), ex, ex.__traceback__)[:]) + return ex def to_dict(self): return self.__getstate__()