pypdevsbbl.generic.collectors.html 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>pypdevsbbl.generic.collectors module &#8212; Python(P)DEVS-BBL documentation</title>
  8. <link rel="stylesheet" href="_static/nature.css" type="text/css" />
  9. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  10. <link rel="stylesheet" type="text/css" href="_static/custom.css" />
  11. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  12. <script type="text/javascript" src="_static/jquery.js"></script>
  13. <script type="text/javascript" src="_static/underscore.js"></script>
  14. <script type="text/javascript" src="_static/doctools.js"></script>
  15. <script type="text/javascript" src="_static/language_data.js"></script>
  16. <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  17. <link rel="index" title="Index" href="genindex.html" />
  18. <link rel="search" title="Search" href="search.html" />
  19. <link rel="next" title="pypdevsbbl.generic.generators module" href="pypdevsbbl.generic.generators.html" />
  20. <link rel="prev" title="pypdevsbbl.generic package" href="pypdevsbbl.generic.html" />
  21. </head><body>
  22. <div class="related" role="navigation" aria-label="related navigation">
  23. <h3>Navigation</h3>
  24. <ul>
  25. <li class="right" style="margin-right: 10px">
  26. <a href="genindex.html" title="General Index"
  27. accesskey="I">index</a></li>
  28. <li class="right" >
  29. <a href="py-modindex.html" title="Python Module Index"
  30. >modules</a> |</li>
  31. <li class="right" >
  32. <a href="pypdevsbbl.generic.generators.html" title="pypdevsbbl.generic.generators module"
  33. accesskey="N">next</a> |</li>
  34. <li class="right" >
  35. <a href="pypdevsbbl.generic.html" title="pypdevsbbl.generic package"
  36. accesskey="P">previous</a> |</li>
  37. <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> &#187;</li>
  38. <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" >pypdevsbbl package</a> &#187;</li>
  39. <li class="nav-item nav-item-2"><a href="pypdevsbbl.generic.html" accesskey="U">pypdevsbbl.generic package</a> &#187;</li>
  40. </ul>
  41. </div>
  42. <div class="document">
  43. <div class="documentwrapper">
  44. <div class="bodywrapper">
  45. <div class="body" role="main">
  46. <div class="section" id="module-pypdevsbbl.generic.collectors">
  47. <span id="pypdevsbbl-generic-collectors-module"></span><h1>pypdevsbbl.generic.collectors module<a class="headerlink" href="#module-pypdevsbbl.generic.collectors" title="Permalink to this headline">¶</a></h1>
  48. <p>Set of PythonPDEVS collectors for keeping track of all data.</p>
  49. <p>The classes in this file will allow for obtaining some well
  50. required statistical data from your models.</p>
  51. <dl class="class">
  52. <dt id="pypdevsbbl.generic.collectors.BaseCollector">
  53. <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.collectors.</code><code class="descname">BaseCollector</code><span class="sig-paren">(</span><em>name: str</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#BaseCollector"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.BaseCollector" title="Permalink to this definition">¶</a></dt>
  54. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  55. <p>Base class for all the collectors.</p>
  56. <p>This building block itself is not useful, but mainly acts as a root
  57. from which all collectors can inherit.</p>
  58. <table class="docutils field-list" frame="void" rules="none">
  59. <col class="field-name" />
  60. <col class="field-body" />
  61. <tbody valign="top">
  62. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>name</strong> (<em>str</em>) – The name of the Collector.</p>
  63. </td>
  64. </tr>
  65. <tr class="field-even field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first last simple">
  66. <li><strong>input</strong> (<em>any</em>) – Obtains values.</li>
  67. <li><strong>clear</strong> (<em>any</em>) – Clears the contents of the block.</li>
  68. </ul>
  69. </td>
  70. </tr>
  71. </tbody>
  72. </table>
  73. <dl class="method">
  74. <dt id="pypdevsbbl.generic.collectors.BaseCollector.clearContents">
  75. <code class="descname">clearContents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#BaseCollector.clearContents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.BaseCollector.clearContents" title="Permalink to this definition">¶</a></dt>
  76. <dd><p>Clears the contents of the block.</p>
  77. </dd></dl>
  78. <dl class="method">
  79. <dt id="pypdevsbbl.generic.collectors.BaseCollector.plot">
  80. <code class="descname">plot</code><span class="sig-paren">(</span><em>axis</em>, <em>arg</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#BaseCollector.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.BaseCollector.plot" title="Permalink to this definition">¶</a></dt>
  81. <dd><p>Plots the data of the collector.</p>
  82. <table class="docutils field-list" frame="void" rules="none">
  83. <col class="field-name" />
  84. <col class="field-body" />
  85. <tbody valign="top">
  86. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  87. <li><strong>axis</strong> – The <code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib</span></code> axis to plot on.</li>
  88. <li><strong>arg</strong> – Additional argument.</li>
  89. </ul>
  90. </td>
  91. </tr>
  92. </tbody>
  93. </table>
  94. </dd></dl>
  95. </dd></dl>
  96. <dl class="class">
  97. <dt id="pypdevsbbl.generic.collectors.Collector">
  98. <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.collectors.</code><code class="descname">Collector</code><span class="sig-paren">(</span><em>name: str</em>, <em>positive: bool = False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector" title="Permalink to this definition">¶</a></dt>
  99. <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.collectors.BaseCollector" title="pypdevsbbl.generic.collectors.BaseCollector"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.collectors.BaseCollector</span></code></a></p>
  100. <p>Collects base information about items that arrive on <cite>input</cite>.</p>
  101. <p>The Collector block keeps track of the basic information about all items that
  102. arrive. This includes minima, maxima, means, sums, sums of squares and the
  103. amount of items that it has seen.</p>
  104. <p>Using this data, the min, max, mean, variance, standard derivation and count
  105. of the passed items can be obtained. See their respective functions below.</p>
  106. <div class="admonition note">
  107. <p class="first admonition-title">Note</p>
  108. <p class="last">In order to do this, the items must be numeric and therefore have the
  109. <code class="docutils literal notranslate"><span class="pre">__lt__</span></code>, <code class="docutils literal notranslate"><span class="pre">__gt__</span></code>, <code class="docutils literal notranslate"><span class="pre">__add__</span></code>, <code class="docutils literal notranslate"><span class="pre">__pow__</span></code> and <code class="docutils literal notranslate"><span class="pre">__div__</span></code> operators
  110. available.</p>
  111. </div>
  112. <div align="center" class="align-center"><img alt="_images/collector.svg" src="_images/collector.svg" /></div>
  113. <table class="docutils field-list" frame="void" rules="none">
  114. <col class="field-name" />
  115. <col class="field-body" />
  116. <tbody valign="top">
  117. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  118. <li><strong>name</strong> (<em>str</em>) – The name for the Collector.</li>
  119. <li><strong>positive</strong> (<em>bool</em>) – When <code class="docutils literal notranslate"><span class="pre">True</span></code>, only data from strict positive values will be
  120. captured. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</li>
  121. </ul>
  122. </td>
  123. </tr>
  124. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  125. <li><strong>min</strong> (<em>numeric</em>) – The minimal value that arrived. When no items passed
  126. through, this will be INFINITY.</li>
  127. <li><strong>max</strong> (<em>numeric</em>) – The maximal value that arrived. When no items passed
  128. through, this will be -INFINITY.</li>
  129. <li><strong>n</strong> (<em>int</em>) – The amount of items that have arrived.</li>
  130. <li><strong>sum</strong> (<em>numeric</em>) – The sum of all values that have arrived.</li>
  131. <li><strong>squares</strong> (<em>numeric</em>) – The sum of the squares of all values that have arrived.</li>
  132. </ul>
  133. </td>
  134. </tr>
  135. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first last simple">
  136. <li><strong>input</strong> (<em>numeric</em>) – Obtains values.
  137. Note that INFINITY inputs will shape the data in an undefined way.</li>
  138. <li><strong>clear</strong> (<em>any</em>) – Clears the contents of the block.</li>
  139. </ul>
  140. </td>
  141. </tr>
  142. </tbody>
  143. </table>
  144. <dl class="method">
  145. <dt id="pypdevsbbl.generic.collectors.Collector.plot">
  146. <code class="descname">plot</code><span class="sig-paren">(</span><em>axis</em>, <em>cols=1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.plot" title="Permalink to this definition">¶</a></dt>
  147. <dd><p>Plots the data of the collector.</p>
  148. <table class="docutils field-list" frame="void" rules="none">
  149. <col class="field-name" />
  150. <col class="field-body" />
  151. <tbody valign="top">
  152. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  153. <li><strong>axis</strong> – The <code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib</span></code> axis to plot on.</li>
  154. <li><strong>cols</strong> – How many columns to split the info into.
  155. Defaults to 1.</li>
  156. </ul>
  157. </td>
  158. </tr>
  159. </tbody>
  160. </table>
  161. </dd></dl>
  162. <dl class="method">
  163. <dt id="pypdevsbbl.generic.collectors.Collector.extTransition">
  164. <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.extTransition" title="Permalink to this definition">¶</a></dt>
  165. <dd></dd></dl>
  166. <dl class="method">
  167. <dt id="pypdevsbbl.generic.collectors.Collector.clearContents">
  168. <code class="descname">clearContents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.clearContents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.clearContents" title="Permalink to this definition">¶</a></dt>
  169. <dd></dd></dl>
  170. <dl class="method">
  171. <dt id="pypdevsbbl.generic.collectors.Collector.min">
  172. <code class="descname">min</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.min"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.min" title="Permalink to this definition">¶</a></dt>
  173. <dd><p>Conveniance method to obtain the minimal value.</p>
  174. <table class="docutils field-list" frame="void" rules="none">
  175. <col class="field-name" />
  176. <col class="field-body" />
  177. <tbody valign="top">
  178. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The minimal value that arrived.</td>
  179. </tr>
  180. </tbody>
  181. </table>
  182. </dd></dl>
  183. <dl class="method">
  184. <dt id="pypdevsbbl.generic.collectors.Collector.max">
  185. <code class="descname">max</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.max"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.max" title="Permalink to this definition">¶</a></dt>
  186. <dd><p>Conveniance method to obtain the maximal value.</p>
  187. <table class="docutils field-list" frame="void" rules="none">
  188. <col class="field-name" />
  189. <col class="field-body" />
  190. <tbody valign="top">
  191. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The maximal value that arrived.</td>
  192. </tr>
  193. </tbody>
  194. </table>
  195. </dd></dl>
  196. <dl class="method">
  197. <dt id="pypdevsbbl.generic.collectors.Collector.count">
  198. <code class="descname">count</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.count"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.count" title="Permalink to this definition">¶</a></dt>
  199. <dd><p>Conveniance method to obtain the amount of items.</p>
  200. <table class="docutils field-list" frame="void" rules="none">
  201. <col class="field-name" />
  202. <col class="field-body" />
  203. <tbody valign="top">
  204. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The amount of items that have arrived.</td>
  205. </tr>
  206. </tbody>
  207. </table>
  208. </dd></dl>
  209. <dl class="method">
  210. <dt id="pypdevsbbl.generic.collectors.Collector.sum">
  211. <code class="descname">sum</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.sum"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.sum" title="Permalink to this definition">¶</a></dt>
  212. <dd><p>Conveniance method to obtain the sum.</p>
  213. <table class="docutils field-list" frame="void" rules="none">
  214. <col class="field-name" />
  215. <col class="field-body" />
  216. <tbody valign="top">
  217. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The sum of the items that have arrived.</td>
  218. </tr>
  219. </tbody>
  220. </table>
  221. </dd></dl>
  222. <dl class="method">
  223. <dt id="pypdevsbbl.generic.collectors.Collector.sumOfSquares">
  224. <code class="descname">sumOfSquares</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.sumOfSquares"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.sumOfSquares" title="Permalink to this definition">¶</a></dt>
  225. <dd><p>Conveniance method to obtain the sum of squares.</p>
  226. <table class="docutils field-list" frame="void" rules="none">
  227. <col class="field-name" />
  228. <col class="field-body" />
  229. <tbody valign="top">
  230. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The sum of squares of the items that have arrived.</td>
  231. </tr>
  232. </tbody>
  233. </table>
  234. </dd></dl>
  235. <dl class="method">
  236. <dt id="pypdevsbbl.generic.collectors.Collector.mean">
  237. <code class="descname">mean</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.mean"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.mean" title="Permalink to this definition">¶</a></dt>
  238. <dd><p>Get the mean of all values that have arrived.</p>
  239. <p>It is computed as <span class="math notranslate nohighlight">\(\mu = \dfrac{\sum_i i}{n}\)</span>, with
  240. <span class="math notranslate nohighlight">\(i\)</span> an item that arrived.</p>
  241. <table class="docutils field-list" frame="void" rules="none">
  242. <col class="field-name" />
  243. <col class="field-body" />
  244. <tbody valign="top">
  245. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The mean or 0 if no items have arrived.</td>
  246. </tr>
  247. </tbody>
  248. </table>
  249. </dd></dl>
  250. <dl class="method">
  251. <dt id="pypdevsbbl.generic.collectors.Collector.variance">
  252. <code class="descname">variance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.variance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.variance" title="Permalink to this definition">¶</a></dt>
  253. <dd><p>Get the variance of all values that have arrived.</p>
  254. <p>It is computed as
  255. <span class="math notranslate nohighlight">\(\sigma^2 = \dfrac{\sum_i i^2}{n} + \mu^2 - \dfrac{2\mu\sum_i i}{n}\)</span>,
  256. with <span class="math notranslate nohighlight">\(i\)</span> an item that arrived.</p>
  257. <table class="docutils field-list" frame="void" rules="none">
  258. <col class="field-name" />
  259. <col class="field-body" />
  260. <tbody valign="top">
  261. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The variance or 0 if no items have arrived.</td>
  262. </tr>
  263. </tbody>
  264. </table>
  265. </dd></dl>
  266. <dl class="method">
  267. <dt id="pypdevsbbl.generic.collectors.Collector.std">
  268. <code class="descname">std</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Collector.std"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Collector.std" title="Permalink to this definition">¶</a></dt>
  269. <dd><p>Get the standard derivation of all values that have arrived.</p>
  270. <p>It is computed as <span class="math notranslate nohighlight">\(\sigma = \sqrt{v}\)</span>, with
  271. <span class="math notranslate nohighlight">\(v\)</span> the result from the <a class="reference internal" href="#pypdevsbbl.generic.collectors.Collector.variance" title="pypdevsbbl.generic.collectors.Collector.variance"><code class="xref py py-meth docutils literal notranslate"><span class="pre">variance()</span></code></a> function.</p>
  272. <table class="docutils field-list" frame="void" rules="none">
  273. <col class="field-name" />
  274. <col class="field-body" />
  275. <tbody valign="top">
  276. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The standard derivation or 0 if no items have arrived.</td>
  277. </tr>
  278. </tbody>
  279. </table>
  280. </dd></dl>
  281. </dd></dl>
  282. <dl class="class">
  283. <dt id="pypdevsbbl.generic.collectors.EstimateCollector">
  284. <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.collectors.</code><code class="descname">EstimateCollector</code><span class="sig-paren">(</span><em>name: str</em>, <em>b: int = 4</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector" title="Permalink to this definition">¶</a></dt>
  285. <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.collectors.BaseCollector" title="pypdevsbbl.generic.collectors.BaseCollector"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.collectors.BaseCollector</span></code></a></p>
  286. <p>Collects information about items that arrive.</p>
  287. <p>The EstimateCollector block is a block that keeps track of everything that
  288. passes through, allowing it to yield important information.</p>
  289. <p>Whereas the <a class="reference internal" href="#pypdevsbbl.generic.collectors.Collector" title="pypdevsbbl.generic.collectors.Collector"><code class="xref py py-class docutils literal notranslate"><span class="pre">Collector</span></code></a> can collect general information data, this
  290. collector will use the <cite>P-squared Algorithm for Dynamic Calculation of
  291. Quantiles and Histograms without Scoring Observations</cite>.</p>
  292. <p>It has a <a class="reference internal" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState" title="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState"><code class="xref py py-class docutils literal notranslate"><span class="pre">CollectorState</span></code></a> class, which is used to handle the information
  293. of passed-through items. Besides the <code class="docutils literal notranslate"><span class="pre">PythonPDEVS</span></code>-functionality, it also
  294. has a function that can obtain all boxplot- and histogram-data, called
  295. <a class="reference internal" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.histoplot" title="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.histoplot"><code class="xref py py-meth docutils literal notranslate"><span class="pre">CollectorState.histoplot()</span></code></a>.</p>
  296. <div class="admonition seealso">
  297. <p class="first admonition-title">See also</p>
  298. <ul class="last simple">
  299. <li><a class="reference internal" href="pypdevsbbl.extra.mathutils.html#pypdevsbbl.extra.mathutils.histogram" title="pypdevsbbl.extra.mathutils.histogram"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pypdevsbbl.extra.mathutils.histogram()</span></code></a></li>
  300. <li><a class="reference internal" href="pypdevsbbl.extra.mathutils.html#pypdevsbbl.extra.mathutils.histostep" title="pypdevsbbl.extra.mathutils.histostep"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pypdevsbbl.extra.mathutils.histostep()</span></code></a></li>
  301. </ul>
  302. </div>
  303. <div align="center" class="align-center"><img alt="_images/estimate-collector.svg" src="_images/estimate-collector.svg" /></div>
  304. <table class="docutils field-list" frame="void" rules="none">
  305. <col class="field-name" />
  306. <col class="field-body" />
  307. <tbody valign="top">
  308. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  309. <li><strong>name</strong> (<em>str</em>) – The name of the EstimateCollector.</li>
  310. <li><strong>b</strong> (<em>int</em>) – The amount of cells you want for the histogram.
  311. 4 is often used, because it yields [min, Q1, median, Q3, max].
  312. When 1 or less, the histogram will only keep track of the min
  313. and the max. Defaults to 4.</li>
  314. </ul>
  315. </td>
  316. </tr>
  317. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><p class="first">See <a class="reference internal" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState" title="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState"><code class="xref py py-class docutils literal notranslate"><span class="pre">EstimateCollector.CollectorState</span></code></a>.</p>
  318. </td>
  319. </tr>
  320. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first last simple">
  321. <li><strong>input</strong> (<em>numeric</em>) – Obtains values.
  322. Note that <code class="docutils literal notranslate"><span class="pre">INFINITY</span></code> inputs will shape the data in an undefined way.</li>
  323. <li><strong>clear</strong> (<em>any</em>) – Clears the contents of the block.</li>
  324. </ul>
  325. </td>
  326. </tr>
  327. </tbody>
  328. </table>
  329. <dl class="class">
  330. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState">
  331. <em class="property">class </em><code class="descname">CollectorState</code><span class="sig-paren">(</span><em>b=4</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.CollectorState"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState" title="Permalink to this definition">¶</a></dt>
  332. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
  333. <p>Helperclass for the EstimateCollector.</p>
  334. <div class="admonition note">
  335. <p class="first admonition-title">Note</p>
  336. <p class="last">This class allows for the creation of boxplots and histogram, thanks to the
  337. <a class="reference internal" href="pypdevsbbl.extra.mathutils.html#module-pypdevsbbl.extra.mathutils" title="pypdevsbbl.extra.mathutils"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pypdevsbbl.extra.mathutils</span></code></a> module. This makes use of the <code class="docutils literal notranslate"><span class="pre">_hq</span></code>, <code class="docutils literal notranslate"><span class="pre">_hq0</span></code>,
  338. <code class="docutils literal notranslate"><span class="pre">_hn</span></code> and <code class="docutils literal notranslate"><span class="pre">_hn0</span></code> attributes. Changing these will make it so the histogram,
  339. min, max, median, Q1 and Q3 also changes, so please… <strong>DON’T</strong>.</p>
  340. </div>
  341. <p>For the sake of the P^2 algorithm, b (number of cells) is chosen to be 4.</p>
  342. <table class="docutils field-list" frame="void" rules="none">
  343. <col class="field-name" />
  344. <col class="field-body" />
  345. <tbody valign="top">
  346. <tr class="field-odd field"><th class="field-name">Variables:</th><td class="field-body"><ul class="first simple">
  347. <li><strong>N</strong> (<em>int</em>) – The total number of items that have arrived.</li>
  348. <li><strong>N0</strong> (<em>int</em>) – The total number of non-zero items that have arrived.</li>
  349. <li><strong>_b</strong> (<em>int</em>) – The amount of cells in the histogram.</li>
  350. <li><strong>_hq</strong> (<em>list</em>) – Datavalues of the bars in the histogram of all items.
  351. <strong>DON’T CHANGE THIS LIST!</strong></li>
  352. <li><strong>_hq0</strong> (<em>list</em>) – Datavalues of the bars in the histogram of all non-zero items.
  353. <strong>DON’T CHANGE THIS LIST!</strong></li>
  354. <li><strong>_hn</strong> (<em>list</em>) – Positions of the bars in the histogram of all items.
  355. <strong>DON’T CHANGE THIS LIST!</strong></li>
  356. <li><strong>_hn0</strong> (<em>list</em>) – Positions of the bars in the histogram of all non-zero items.
  357. <strong>DON’T CHANGE THIS LIST!</strong></li>
  358. </ul>
  359. </td>
  360. </tr>
  361. <tr class="field-even field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first last"><strong>b</strong> (<em>int</em>) – The amount of cells you want for the histogram.
  362. When 1 or less, the histogram will only keep track of the min and
  363. the max. Defaults to 4.</p>
  364. </td>
  365. </tr>
  366. </tbody>
  367. </table>
  368. <dl class="method">
  369. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState._hstep">
  370. <code class="descname">_hstep</code><span class="sig-paren">(</span><em>val</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.CollectorState._hstep"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState._hstep" title="Permalink to this definition">¶</a></dt>
  371. <dd><p>Do the histostep function of the mathutils on this state.</p>
  372. <p>Additionally, this will do some size checks to make sure histostep can be executed correctly.
  373. The general histogram will change.</p>
  374. <div class="admonition seealso">
  375. <p class="first admonition-title">See also</p>
  376. <p class="last"><a class="reference internal" href="pypdevsbbl.extra.mathutils.html#pypdevsbbl.extra.mathutils.histogram" title="pypdevsbbl.extra.mathutils.histogram"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pypdevsbbl.extra.mathutils.histogram()</span></code></a></p>
  377. </div>
  378. <div class="admonition warning">
  379. <p class="first admonition-title">Warning</p>
  380. <p class="last">Only use this function if you know what you’re doing.</p>
  381. </div>
  382. <table class="docutils field-list" frame="void" rules="none">
  383. <col class="field-name" />
  384. <col class="field-body" />
  385. <tbody valign="top">
  386. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>val</strong> (<em>numeric</em>) – A value that passes through and must update the histogram.</td>
  387. </tr>
  388. </tbody>
  389. </table>
  390. </dd></dl>
  391. <dl class="method">
  392. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState._hstep0">
  393. <code class="descname">_hstep0</code><span class="sig-paren">(</span><em>val</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.CollectorState._hstep0"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState._hstep0" title="Permalink to this definition">¶</a></dt>
  394. <dd><p>Do the histostep function of the mathutils on this state.</p>
  395. <p>Additionally, this will do some size checks to make sure histostep can be executed correctly.
  396. The non-zero histogram will change.</p>
  397. <div class="admonition seealso">
  398. <p class="first admonition-title">See also</p>
  399. <p class="last"><a class="reference internal" href="pypdevsbbl.extra.mathutils.html#pypdevsbbl.extra.mathutils.histogram" title="pypdevsbbl.extra.mathutils.histogram"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pypdevsbbl.extra.mathutils.histogram()</span></code></a></p>
  400. </div>
  401. <div class="admonition warning">
  402. <p class="first admonition-title">Warning</p>
  403. <p class="last">Only use this function if you know what you’re doing.</p>
  404. </div>
  405. <table class="docutils field-list" frame="void" rules="none">
  406. <col class="field-name" />
  407. <col class="field-body" />
  408. <tbody valign="top">
  409. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>val</strong> (<em>numeric</em>) – A non-zero value that passes through and must update the histogram.</td>
  410. </tr>
  411. </tbody>
  412. </table>
  413. </dd></dl>
  414. <dl class="method">
  415. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.min">
  416. <code class="descname">min</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.CollectorState.min"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.min" title="Permalink to this definition">¶</a></dt>
  417. <dd><p>Get the smallest value that has arrived.</p>
  418. <table class="docutils field-list" frame="void" rules="none">
  419. <col class="field-name" />
  420. <col class="field-body" />
  421. <tbody valign="top">
  422. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The smallest value, or INFINITY if no values have arrived yet.</td>
  423. </tr>
  424. </tbody>
  425. </table>
  426. </dd></dl>
  427. <dl class="method">
  428. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.min0">
  429. <code class="descname">min0</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.CollectorState.min0"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.min0" title="Permalink to this definition">¶</a></dt>
  430. <dd><p>Get the smallest non-zero value that has arrived.</p>
  431. <table class="docutils field-list" frame="void" rules="none">
  432. <col class="field-name" />
  433. <col class="field-body" />
  434. <tbody valign="top">
  435. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The smallest non-zero value, or INFINITY if no values have arrived yet.</td>
  436. </tr>
  437. </tbody>
  438. </table>
  439. </dd></dl>
  440. <dl class="method">
  441. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.max">
  442. <code class="descname">max</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.CollectorState.max"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.max" title="Permalink to this definition">¶</a></dt>
  443. <dd><p>Get the largest value that has arrived.</p>
  444. <table class="docutils field-list" frame="void" rules="none">
  445. <col class="field-name" />
  446. <col class="field-body" />
  447. <tbody valign="top">
  448. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The largest value, or -INFINITY if no values have arrived yet.</td>
  449. </tr>
  450. </tbody>
  451. </table>
  452. </dd></dl>
  453. <dl class="method">
  454. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.max0">
  455. <code class="descname">max0</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.CollectorState.max0"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.max0" title="Permalink to this definition">¶</a></dt>
  456. <dd><p>Get the largest non-zero value that has arrived.</p>
  457. <table class="docutils field-list" frame="void" rules="none">
  458. <col class="field-name" />
  459. <col class="field-body" />
  460. <tbody valign="top">
  461. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The largest non-zero value, or -INFINITY if no values have arrived yet.</td>
  462. </tr>
  463. </tbody>
  464. </table>
  465. </dd></dl>
  466. <dl class="method">
  467. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.histoplot">
  468. <code class="descname">histoplot</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.CollectorState.histoplot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.CollectorState.histoplot" title="Permalink to this definition">¶</a></dt>
  469. <dd><p>Obtain all boxplot and histogram data from the state.</p>
  470. <p>This function is meant to be used as an unpacking of all data and only
  471. reads from the state. In fact, its result is a <em>copy</em> of the actual data,
  472. making sure it remains immutable.</p>
  473. <table class="docutils field-list" frame="void" rules="none">
  474. <col class="field-name" />
  475. <col class="field-body" />
  476. <tbody valign="top">
  477. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  478. <dt>A 4-tuple (q, h, q0, h0), where</dt>
  479. <dd><ul class="first last simple">
  480. <li>q (list): Datavalues of the bars in the histogram of all items.</li>
  481. <li>h (list): Heights of the bars in the histogram, w.r.t. the item count.</li>
  482. <li>q0 (list): Datavalues of the bars in the histogram of all non-zero items.</li>
  483. <li>h0 (list): Heights of the bars in the histogram, w.r.t. the non-zero item count.</li>
  484. </ul>
  485. </dd>
  486. </dl>
  487. </td>
  488. </tr>
  489. </tbody>
  490. </table>
  491. <p class="rubric">Examples</p>
  492. <ul class="simple">
  493. <li>To plot the histogram of all items, use q as x-values and h as its y-values.</li>
  494. <li>To plot the histogram of all non-zero items, use q0 as x-values and h0 as its y-values.</li>
  495. <li>To plot the boxplot of all items, unpack q and use it as input in the
  496. mathutils.draw_boxplot function (and plot it thereafter).</li>
  497. <li>To plot the boxplot of all non-zero items, unpack q0 and use it as input in the
  498. mathutils.draw_boxplot function (and plot it thereafter).</li>
  499. </ul>
  500. </dd></dl>
  501. </dd></dl>
  502. <dl class="method">
  503. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.plot">
  504. <code class="descname">plot</code><span class="sig-paren">(</span><em>axis</em>, <em>type='hist'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.plot" title="Permalink to this definition">¶</a></dt>
  505. <dd><p>Plots the data of the collector.</p>
  506. <table class="docutils field-list" frame="void" rules="none">
  507. <col class="field-name" />
  508. <col class="field-body" />
  509. <tbody valign="top">
  510. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  511. <li><strong>axis</strong> – The <code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib</span></code> axis to plot on.</li>
  512. <li><strong>type</strong> – <p>A string indicating which plot to create.
  513. Defaults to <cite>‘hist’</cite>.</p>
  514. <p>For the histogram, use any of
  515. <code class="docutils literal notranslate"><span class="pre">['hist',</span> <span class="pre">'histogram',</span> <span class="pre">'bars',</span> <span class="pre">'H',</span> <span class="pre">'h',</span> <span class="pre">0]</span></code>.</p>
  516. <p>For the boxplot, use any of
  517. <code class="docutils literal notranslate"><span class="pre">['bxpt',</span> <span class="pre">'boxplot',</span> <span class="pre">'box',</span> <span class="pre">'B',</span> <span class="pre">'b',</span> <span class="pre">1]</span></code></p>
  518. </li>
  519. </ul>
  520. </td>
  521. </tr>
  522. </tbody>
  523. </table>
  524. </dd></dl>
  525. <dl class="method">
  526. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.plot_boxplot">
  527. <code class="descname">plot_boxplot</code><span class="sig-paren">(</span><em>axis</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.plot_boxplot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.plot_boxplot" title="Permalink to this definition">¶</a></dt>
  528. <dd><p>Plots the data of the collector as a boxplot.</p>
  529. <table class="docutils field-list" frame="void" rules="none">
  530. <col class="field-name" />
  531. <col class="field-body" />
  532. <tbody valign="top">
  533. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>axis</strong> – The <code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib</span></code> axis to plot on.</td>
  534. </tr>
  535. </tbody>
  536. </table>
  537. </dd></dl>
  538. <dl class="method">
  539. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.plot_histogram">
  540. <code class="descname">plot_histogram</code><span class="sig-paren">(</span><em>axis</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.plot_histogram"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.plot_histogram" title="Permalink to this definition">¶</a></dt>
  541. <dd><p>Plots the data of the collector as a histogram.</p>
  542. <table class="docutils field-list" frame="void" rules="none">
  543. <col class="field-name" />
  544. <col class="field-body" />
  545. <tbody valign="top">
  546. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>axis</strong> – The <code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib</span></code> axis to plot on.</td>
  547. </tr>
  548. </tbody>
  549. </table>
  550. </dd></dl>
  551. <dl class="method">
  552. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.extTransition">
  553. <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.extTransition" title="Permalink to this definition">¶</a></dt>
  554. <dd></dd></dl>
  555. <dl class="method">
  556. <dt id="pypdevsbbl.generic.collectors.EstimateCollector.clearContents">
  557. <code class="descname">clearContents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#EstimateCollector.clearContents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.EstimateCollector.clearContents" title="Permalink to this definition">¶</a></dt>
  558. <dd></dd></dl>
  559. </dd></dl>
  560. <dl class="class">
  561. <dt id="pypdevsbbl.generic.collectors.TableCollector">
  562. <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.collectors.</code><code class="descname">TableCollector</code><span class="sig-paren">(</span><em>name: str</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#TableCollector"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.TableCollector" title="Permalink to this definition">¶</a></dt>
  563. <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.collectors.BaseCollector" title="pypdevsbbl.generic.collectors.BaseCollector"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.collectors.BaseCollector</span></code></a></p>
  564. <p>Builds a table of all collected data.</p>
  565. <p>Contrary to the other collectors, the TableCollector will create
  566. a table from ALL data that arrived. This implies that the usage
  567. of this component will allocate a lot of memory and, if you’re using
  568. mere numerical data, will be overkill. Nevertheless, if your data is
  569. not numerical, or you require to know when certain data arrived, this
  570. collector is the one you need.</p>
  571. <p>For every item that arrives, it will add another record in a table,
  572. which is accessible as a dictionary (see the <a class="reference internal" href="#pypdevsbbl.generic.collectors.TableCollector.table" title="pypdevsbbl.generic.collectors.TableCollector.table"><code class="xref py py-meth docutils literal notranslate"><span class="pre">table()</span></code></a> method).</p>
  573. <div align="center" class="align-center"><img alt="_images/table-collector.svg" src="_images/table-collector.svg" /></div>
  574. <table class="docutils field-list" frame="void" rules="none">
  575. <col class="field-name" />
  576. <col class="field-body" />
  577. <tbody valign="top">
  578. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>name</strong> (<em>str</em>) – The name for the TableizeCollector.</p>
  579. </td>
  580. </tr>
  581. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><p class="first"><strong>table</strong> (<em>list</em>) – The table, as a pair/tuple of (<cite>elapsed time</cite>, <cite>item</cite>)</p>
  582. </td>
  583. </tr>
  584. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first last simple">
  585. <li><strong>input</strong> (<em>any</em>) – Obtains values.</li>
  586. <li><strong>clear</strong> (<em>any</em>) – Clears the contents of the block.</li>
  587. </ul>
  588. </td>
  589. </tr>
  590. </tbody>
  591. </table>
  592. <dl class="method">
  593. <dt id="pypdevsbbl.generic.collectors.TableCollector.clearContents">
  594. <code class="descname">clearContents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#TableCollector.clearContents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.TableCollector.clearContents" title="Permalink to this definition">¶</a></dt>
  595. <dd></dd></dl>
  596. <dl class="method">
  597. <dt id="pypdevsbbl.generic.collectors.TableCollector.extTransition">
  598. <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#TableCollector.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.TableCollector.extTransition" title="Permalink to this definition">¶</a></dt>
  599. <dd></dd></dl>
  600. <dl class="method">
  601. <dt id="pypdevsbbl.generic.collectors.TableCollector.plot">
  602. <code class="descname">plot</code><span class="sig-paren">(</span><em>axis</em>, <em>kwargs=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#TableCollector.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.TableCollector.plot" title="Permalink to this definition">¶</a></dt>
  603. <dd><p>Plots the data of the collector.</p>
  604. <table class="docutils field-list" frame="void" rules="none">
  605. <col class="field-name" />
  606. <col class="field-body" />
  607. <tbody valign="top">
  608. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  609. <li><strong>axis</strong> – The <code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib</span></code> axis to plot on.</li>
  610. <li><strong>kwargs</strong> – Dictionary of keyword arguments to pass to the
  611. <code class="xref py py-meth docutils literal notranslate"><span class="pre">matplotlib.axes.Axes.plot()</span></code> function.
  612. Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code> (= no arguments).</li>
  613. </ul>
  614. </td>
  615. </tr>
  616. </tbody>
  617. </table>
  618. </dd></dl>
  619. <dl class="method">
  620. <dt id="pypdevsbbl.generic.collectors.TableCollector.table">
  621. <code class="descname">table</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#TableCollector.table"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.TableCollector.table" title="Permalink to this definition">¶</a></dt>
  622. <dd><p>Fetches the table that was built upto this point in time.</p>
  623. <dl class="docutils">
  624. <dt>This table will be returned as a dict, in the form of</dt>
  625. <dd><cite>elapsed time</cite> -&gt; <cite>item</cite></dd>
  626. </dl>
  627. <table class="docutils field-list" frame="void" rules="none">
  628. <col class="field-name" />
  629. <col class="field-body" />
  630. <tbody valign="top">
  631. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The table.</td>
  632. </tr>
  633. </tbody>
  634. </table>
  635. </dd></dl>
  636. </dd></dl>
  637. <dl class="class">
  638. <dt id="pypdevsbbl.generic.collectors.Counter">
  639. <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.collectors.</code><code class="descname">Counter</code><span class="sig-paren">(</span><em>name: str</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Counter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Counter" title="Permalink to this definition">¶</a></dt>
  640. <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.collectors.BaseCollector" title="pypdevsbbl.generic.collectors.BaseCollector"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.collectors.BaseCollector</span></code></a></p>
  641. <p>Counts the amount of arrived messages.</p>
  642. <div align="center" class="align-center"><img alt="_images/counter.svg" src="_images/counter.svg" /></div>
  643. <table class="docutils field-list" frame="void" rules="none">
  644. <col class="field-name" />
  645. <col class="field-body" />
  646. <tbody valign="top">
  647. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>name</strong> (<em>str</em>) – The name of the block.</p>
  648. </td>
  649. </tr>
  650. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  651. <li><strong>item</strong> (<em>any</em>) – The current item.</li>
  652. <li><strong>count</strong> (<em>int</em>) – The current count.</li>
  653. </ul>
  654. </td>
  655. </tr>
  656. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
  657. <li><strong>input</strong> (<em>any</em>) – The items that need to be counted.</li>
  658. <li><strong>clear</strong> (<em>any</em>) – Clears the contents of the block.</li>
  659. </ul>
  660. </td>
  661. </tr>
  662. <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
  663. <li><strong>output</strong> (<em>any</em>) – The item that was counted.</li>
  664. <li><strong>count</strong> (<em>int</em>) – How many items have been counted, including the one
  665. outputted on the <cite>output</cite> port.</li>
  666. </ul>
  667. </td>
  668. </tr>
  669. </tbody>
  670. </table>
  671. <dl class="method">
  672. <dt id="pypdevsbbl.generic.collectors.Counter.plot">
  673. <code class="descname">plot</code><span class="sig-paren">(</span><em>axis</em>, <em>pos=(0.5</em>, <em>0.5)</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Counter.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Counter.plot" title="Permalink to this definition">¶</a></dt>
  674. <dd><p>Plots the counted info</p>
  675. <table class="docutils field-list" frame="void" rules="none">
  676. <col class="field-name" />
  677. <col class="field-body" />
  678. <tbody valign="top">
  679. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  680. <li><strong>axis</strong> – The <code class="xref py py-mod docutils literal notranslate"><span class="pre">matplotlib</span></code> axis to plot on.</li>
  681. <li><strong>pos</strong> – The position to plot the data. Must be
  682. in [0, 1] for both x and y to be visible.
  683. Defaults to <code class="docutils literal notranslate"><span class="pre">(0.5,</span> <span class="pre">0.5)</span></code>.</li>
  684. </ul>
  685. </td>
  686. </tr>
  687. </tbody>
  688. </table>
  689. </dd></dl>
  690. <dl class="method">
  691. <dt id="pypdevsbbl.generic.collectors.Counter.clearContents">
  692. <code class="descname">clearContents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Counter.clearContents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Counter.clearContents" title="Permalink to this definition">¶</a></dt>
  693. <dd></dd></dl>
  694. <dl class="method">
  695. <dt id="pypdevsbbl.generic.collectors.Counter.timeAdvance">
  696. <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Counter.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Counter.timeAdvance" title="Permalink to this definition">¶</a></dt>
  697. <dd></dd></dl>
  698. <dl class="method">
  699. <dt id="pypdevsbbl.generic.collectors.Counter.extTransition">
  700. <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Counter.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Counter.extTransition" title="Permalink to this definition">¶</a></dt>
  701. <dd></dd></dl>
  702. <dl class="method">
  703. <dt id="pypdevsbbl.generic.collectors.Counter.outputFnc">
  704. <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Counter.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Counter.outputFnc" title="Permalink to this definition">¶</a></dt>
  705. <dd></dd></dl>
  706. <dl class="method">
  707. <dt id="pypdevsbbl.generic.collectors.Counter.intTransition">
  708. <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/collectors.html#Counter.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.collectors.Counter.intTransition" title="Permalink to this definition">¶</a></dt>
  709. <dd></dd></dl>
  710. </dd></dl>
  711. </div>
  712. </div>
  713. </div>
  714. </div>
  715. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  716. <div class="sphinxsidebarwrapper">
  717. <h4>Previous topic</h4>
  718. <p class="topless"><a href="pypdevsbbl.generic.html"
  719. title="previous chapter">pypdevsbbl.generic package</a></p>
  720. <h4>Next topic</h4>
  721. <p class="topless"><a href="pypdevsbbl.generic.generators.html"
  722. title="next chapter">pypdevsbbl.generic.generators module</a></p>
  723. <div id="searchbox" style="display: none" role="search">
  724. <h3>Quick search</h3>
  725. <div class="searchformwrapper">
  726. <form class="search" action="search.html" method="get">
  727. <input type="text" name="q" />
  728. <input type="submit" value="Go" />
  729. <input type="hidden" name="check_keywords" value="yes" />
  730. <input type="hidden" name="area" value="default" />
  731. </form>
  732. </div>
  733. </div>
  734. <script type="text/javascript">$('#searchbox').show(0);</script>
  735. </div>
  736. </div>
  737. <div class="clearer"></div>
  738. </div>
  739. <div class="related" role="navigation" aria-label="related navigation">
  740. <h3>Navigation</h3>
  741. <ul>
  742. <li class="right" style="margin-right: 10px">
  743. <a href="genindex.html" title="General Index"
  744. >index</a></li>
  745. <li class="right" >
  746. <a href="py-modindex.html" title="Python Module Index"
  747. >modules</a> |</li>
  748. <li class="right" >
  749. <a href="pypdevsbbl.generic.generators.html" title="pypdevsbbl.generic.generators module"
  750. >next</a> |</li>
  751. <li class="right" >
  752. <a href="pypdevsbbl.generic.html" title="pypdevsbbl.generic package"
  753. >previous</a> |</li>
  754. <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> &#187;</li>
  755. <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" >pypdevsbbl package</a> &#187;</li>
  756. <li class="nav-item nav-item-2"><a href="pypdevsbbl.generic.html" >pypdevsbbl.generic package</a> &#187;</li>
  757. </ul>
  758. </div>
  759. <div class="footer" role="contentinfo">
  760. &#169; Copyright 2020, Randy Paredis.
  761. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
  762. </div>
  763. </body>
  764. </html>