running.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. How to run a CBD simulation?
  2. ============================
  3. A simple, local distribution can be executed by running an experiment file,
  4. which will look like this:
  5. .. code-block:: python
  6. model = MyModel()
  7. sim = Simulator()
  8. sim.run()
  9. For a more elaborate setup, you can take add some configuration information to
  10. the simulator (before the :func:`run` method is called); for instance:
  11. .. code-block:: python
  12. # Set the step delay to 0.1 seconds
  13. sim.setDeltaT(0.1)
  14. # Set the termination time to 500 seconds
  15. sim.setTerminationTime(500)
  16. # Set the the system to terminate whenever cond(model) returns True
  17. # Take a look at the LCG example for more information
  18. sim.setTerminationCondition(cond)
  19. # Show a progress indicator (requires `tqdm` to be installed)
  20. sim.setProgressBar()
  21. Take a look at the :class:`pyCBD.simulator.Simulator` class for more options
  22. and information.
  23. Running the Tests
  24. -----------------
  25. Not sure your code base is valid anymore? The CBD framework comes with its
  26. own battery of tests (located in the :code:`src/test` folder), which can
  27. be executed from the root folder with:
  28. .. code-block:: bash
  29. python -m unittest discover -v src.test "*.py"