salabim 24.0.4.post1__py3-none-any.whl → 24.0.6__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
salabim/LICENSE.txt CHANGED
@@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
17
  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
18
  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
19
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
salabim/salabim.py CHANGED
@@ -1,13 +1,13 @@
1
- # _ _ _ ____ _ _ ___ _ _
2
- # ___ __ _ | | __ _ | |__ (_) _ __ ___ |___ \ | || | / _ \ | || |
3
- # / __| / _` || | / _` || '_ \ | || '_ ` _ \ __) || || |_ | | | | | || |_
4
- # \__ \| (_| || || (_| || |_) || || | | | | | / __/ |__ _| _ | |_| | _ |__ _|
5
- # |___/ \__,_||_| \__,_||_.__/ |_||_| |_| |_| |_____| |_| (_) \___/ (_) |_|
1
+ # _ _ _ ____ _ _ ___ __
2
+ # ___ __ _ | | __ _ | |__ (_) _ __ ___ |___ \ | || | / _ \ / /_
3
+ # / __| / _` || | / _` || '_ \ | || '_ ` _ \ __) || || |_ | | | | | '_ \
4
+ # \__ \| (_| || || (_| || |_) || || | | | | | / __/ |__ _| _ | |_| | _ | (_) |
5
+ # |___/ \__,_||_| \__,_||_.__/ |_||_| |_| |_| |_____| |_| (_) \___/ (_) \___/
6
6
  # discrete event simulation
7
7
  #
8
8
  # see www.salabim.org for more information, the documentation and license information
9
9
 
10
- __version__ = "24.0.4"
10
+ __version__ = "24.0.6"
11
11
 
12
12
  import heapq
13
13
  import random
@@ -581,6 +581,7 @@ class Monitor:
581
581
  name = kwargs.pop("name", None)
582
582
  if kwargs:
583
583
  raise TypeError("merge() got an unexpected keyword argument '" + tuple(kwargs)[0] + "'")
584
+ new_xtype = self.xtype
584
585
 
585
586
  for m in monitors:
586
587
  m._block_stats_only()
@@ -589,9 +590,12 @@ class Monitor:
589
590
  if self._level != m._level:
590
591
  raise TypeError("not possible to mix level monitor with non level monitor")
591
592
  if self.xtype != m.xtype:
592
- raise TypeError("not possible to mix type '" + self.xtype + "' with type '" + m.xtype + "'")
593
+ new_xtype = "any"
593
594
  if self.env != m.env:
594
595
  raise TypeError("not possible to mix environments")
596
+ if m.xtype != new_xtype:
597
+ new_xtype = "any" # to allow mixed xtypes
598
+
595
599
  if name is None:
596
600
  if self.name().endswith(".merged"):
597
601
  # this to avoid multiple .merged (particularly when merging with the + operator)
@@ -599,7 +603,7 @@ class Monitor:
599
603
  else:
600
604
  name = self.name() + ".merged"
601
605
 
602
- new = _SystemMonitor(name=name, type=self.xtype, level=self._level, env=self.env)
606
+ new = _SystemMonitor(name=name, type=new_xtype, level=self._level, env=self.env)
603
607
 
604
608
  merge = [self] + list(monitors)
605
609
 
@@ -3156,7 +3160,9 @@ class Monitor:
3156
3160
  self.cached_xweight[(ex0, force_numeric)] = (t_extra, xweight)
3157
3161
  return xweight
3158
3162
 
3159
- def as_dataframe(self, include_t: bool = True, use_datetime0=False) -> "dataframe":
3163
+ def as_dataframe(
3164
+ self, include_t: bool = True, use_datetime0=False, ex0: bool = False, exoff=False, force_numeric: bool = True, add_now: bool = True
3165
+ ) -> "dataframe":
3160
3166
  """
3161
3167
  makes a pandas dataframe with the x-values and optionally the t-values of the monitors
3162
3168
 
@@ -3188,14 +3194,15 @@ class Monitor:
3188
3194
  import pandas as pd
3189
3195
  except ImportError:
3190
3196
  raise ImportError("Monitor.as_dataframe requires pandas")
3197
+ xs, ts = self.xt(ex0=ex0, exoff=exoff, force_numeric=force_numeric, add_now=add_now)
3191
3198
  if include_t:
3192
3199
  if use_datetime0:
3193
- df = pd.DataFrame({"t": [self.env.t_to_datetime(t) for t in self._t]})
3200
+ df = pd.DataFrame({"t": [self.env.t_to_datetime(t) for t in ts]})
3194
3201
  else:
3195
- df = pd.DataFrame({"t": self._t})
3202
+ df = pd.DataFrame({"t": ts})
3196
3203
  else:
3197
3204
  df = pd.DataFrame()
3198
- df[f"{self.name()}.x"] = self._x
3205
+ df[f"{self.name()}.x"] = xs
3199
3206
 
3200
3207
  return df
3201
3208
 
@@ -3368,6 +3375,15 @@ class _StateMonitor(Monitor):
3368
3375
  def _value(self, value: Any) -> None:
3369
3376
  self.parent.set(value)
3370
3377
 
3378
+ @property
3379
+ def value(self) -> Any:
3380
+ return self.parent.get()
3381
+
3382
+ @value.setter
3383
+ def value(self, value: Any) -> None:
3384
+ self.parent.set(value)
3385
+
3386
+
3371
3387
 
3372
3388
  class _SystemMonitor(Monitor):
3373
3389
  @property
@@ -13642,7 +13658,7 @@ class Environment:
13642
13658
 
13643
13659
  lastwidth = 0
13644
13660
  for fontsize in range(1, 300):
13645
- f = getfont(font, fontsize)
13661
+ f, heightA = getfont(font, fontsize)
13646
13662
  thiswidth, thisheight = f.getbbox(text)[2:]
13647
13663
  if thiswidth > width:
13648
13664
  break
@@ -23428,7 +23444,7 @@ class Resource:
23428
23444
  else:
23429
23445
  q = quantity
23430
23446
 
23431
- self._claimed_quantity -= q_claimers
23447
+ self._claimed_quantity -= q
23432
23448
  if self._claimed_quantity < 1e-8:
23433
23449
  self._claimed_quantity = 0
23434
23450
  self.claimed_quantity.tally(self._claimed_quantity)
@@ -27086,7 +27102,7 @@ reset()
27086
27102
  set_environment_aliases()
27087
27103
 
27088
27104
  if __name__ == "__main__":
27089
- sys.path.insert(0,str(Path.cwd()/"misc"))
27105
+ sys.path.insert(0, str(Path.cwd() / "misc"))
27090
27106
  try:
27091
27107
  import salabim_exp
27092
27108
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: salabim
3
- Version: 24.0.4.post1
3
+ Version: 24.0.6
4
4
  Summary: salabim - discrete event simulation in Python
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://salabim.org
@@ -11,13 +11,11 @@ Classifier: Programming Language :: Python :: 3 :: Only
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
 
14
- <img src="https://www.salabim.org/salabim_logo_payoff.png" />
15
-
16
- </br>
14
+ <img src="https://www.salabim.org/salabim_logo_payoff.png" width=400 />
17
15
 
18
16
  Salabim is a Python library for object-oriented discrete event simulation (DES) and animation.
19
17
 
20
- ## Introduction
18
+ ### Introduction
21
19
 
22
20
  Discrete event simulation (DES) finds applications in various logistical domains including production facilities, warehousing, airports, hospitals, mining, materials handling, steel mills, and computer network analysis.
23
21
 
@@ -29,36 +27,51 @@ Salabim follows a well-proven and intuitive process description method similar t
29
27
  - Stores
30
28
  - States
31
29
  - Monitors for data collection and presentation
32
- - 2D and 3D animation (including video production)
30
+ - 2D and 3D animation (including video production) (see below)
33
31
  - Tracing facilities
34
32
  - Advanced statistical sampling
35
33
 
36
34
  In contrast to some other Python DES packages, salabim does not require the use of yield statements for process control, making it more straightforward to use. Salabim has minimal requirements, especially when animation is disabled.
37
35
 
38
- ## Features and documentation
36
+
37
+
38
+ ### Some salabim animations
39
+
40
+ <img src="https://www.salabim.org/cymulation3d.gif" width=700 />
41
+
42
+ <img src="https://www.salabim.org/elevator.gif" width=700 />
43
+
44
+ <img src="https://www.salabim.org/lights-3d.gif" width=700 />
45
+
46
+ ### Features and documentation
39
47
 
40
48
  - Cross-platform support: salabim runs on Windows, macOS, Linux, iOS/iPadOS (Pythonista), and can even be used with "Python In Excel".
41
49
  - Comprehensive documentation: Visit [www.salabim.org/manual](www.salabim.org/manual) for detailed documentation.
42
50
 
43
- ## Contributing and Reporting Issues
51
+ ### Resources
52
+
53
+ The salabim package can be found on GitHub: www.github.com/salabim/salabim
54
+
55
+ And on PyPI: https://pypi.org/project/salabim/
56
+
57
+ ### Contributing and Reporting Issues
44
58
 
45
59
  Contributions to salabim are highly appreciated! You can contribute by issuing a pull request or submitting an issue on [GitHub](https://github.com/salabim/salabim). Alternatively, you can use the [salabim Google user group](https://groups.google.com/g/salabim) for discussions and reporting issues.
46
60
 
47
- ## License
61
+ ### License
48
62
 
49
63
  Salabim is licensed under the MIT License. For details, please refer to the [LICENSE](LICENSE) file.
50
64
 
51
- ## Support
65
+ ### Support
52
66
 
53
- Ruud van der Ham is available and willing to help users with issues related to the package and modeling in general. He also provides services such as code and model reviews, consultancy, and training.
67
+ Ruud van der Ham, the core developer, is available and willing to help users with issues related to the package and modeling in general. He also provides services such as code and model reviews, consultancy, and training.
54
68
 
55
- ## Getting Started
69
+ ### Getting Started
56
70
 
57
71
  To start using salabim, visit [www.salabim.org](www.salabim.org) for installation instructions and further details.
58
72
 
59
- ## Badges
73
+ ### Badges
60
74
 
61
75
  ![PyPI](https://img.shields.io/pypi/v/salabim) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/salabim) ![PyPI - Implementation](https://img.shields.io/pypi/implementation/salabim)
62
-
63
76
  ![PyPI - License](https://img.shields.io/pypi/l/salabim) ![Black](https://img.shields.io/badge/code%20style-black-000000.svg)
64
- ![GitHub last commit](https://img.shields.io/github/last-commit/salabim/salabim)
77
+ ![GitHub last commit](https://img.shields.io/github/last-commit/salabim/salabim)
@@ -0,0 +1,10 @@
1
+ salabim/DejaVuSansMono.ttf,sha256=Z_oIXp5yp1Zaw2y2p3vaxwHhjHpG0MFbmwhxSh4aIEI,335068
2
+ salabim/LICENSE.txt,sha256=qHlBa-POyexatCxDTjSKMlYtkBFQDn9lu-YV_1L6V0U,1106
3
+ salabim/__init__.py,sha256=r7qPLvlmX0dkZDyjuTo8Jo3ex3sD1L4pmK6K5ib9vyw,56
4
+ salabim/calibri.ttf,sha256=RWpf8Uo31RfvGGNaSt9-2sXSuN87AVE_NFMRsV3LhBk,1330156
5
+ salabim/mplus-1m-regular.ttf,sha256=EuFHr90BJjuAn_r5MleJFN-WfkeWJ4tf7DweI5zr8tU,289812
6
+ salabim/salabim.py,sha256=SZiOHDFUZuBReQtdElsUmOsDdPBYjhOFo-9nXGypjxk,1094051
7
+ salabim-24.0.6.dist-info/METADATA,sha256=u32xh-FoKdDNMsNEc7lVRunBKk2Yfvd7Frujwlx7NFQ,3449
8
+ salabim-24.0.6.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
9
+ salabim-24.0.6.dist-info/top_level.txt,sha256=UE6zVlbi3F6T5ma1a_5TrojMaF21GYKDt9svvm0U4cQ,8
10
+ salabim-24.0.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5