asim 25.12.1__cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of asim might be problematic. Click here for more details.

asim/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from .version import __version__
asim/dataset.pyi ADDED
@@ -0,0 +1,8 @@
1
+ from typing import List
2
+
3
+ import pandas as pd
4
+
5
+ class PhysicalDataManage:
6
+ def __init__(self, data: pd.DataFrame, columns: List, batch_size: int = 64): ...
7
+ @property
8
+ def df(self) -> pd.DataFrame: ...
asim/model.pyi ADDED
@@ -0,0 +1,9 @@
1
+ from io import BytesIO
2
+ from typing import Union
3
+
4
+ from .dataset import PhysicalDataManage
5
+
6
+ class PhysicalFieldModel:
7
+ def __init__(self, dm: PhysicalDataManage, lr: float): ...
8
+ def fit(self, epochs: int): ...
9
+ def export(self, fh: Union[str, BytesIO]): ...
asim/simulator.pyi ADDED
@@ -0,0 +1,37 @@
1
+ from io import BytesIO
2
+ from typing import Dict, Union, List
3
+
4
+ import numpy as np
5
+ import onnxruntime as ort
6
+ import pandas as pd
7
+
8
+ from .dataset import PhysicalDataManage
9
+
10
+ class PhysicalSimulator:
11
+
12
+ _sess: ort.InferenceSession
13
+ _dm: PhysicalDataManage
14
+
15
+ def __init__(self, fh: Union[str, BytesIO], dm: PhysicalDataManage):
16
+ """
17
+ init
18
+ """
19
+ ...
20
+
21
+ def get_group_names(self) -> List[List[str]]:
22
+ """
23
+ get_group_names
24
+ """
25
+ ...
26
+
27
+ def step(self, x1: Dict[str, np.ndarray], y0: Dict[str, np.ndarray]) -> Dict[str, list]:
28
+ """
29
+ sim.step({"load": 150.0}, {"power1": 60.0, "power2": 80.0})
30
+ """
31
+ ...
32
+
33
+ def steps(self, df: pd.DataFrame, x0: Dict[str, float]) -> pd.DataFrame:
34
+ """
35
+ steps
36
+ """
37
+ ...
asim/version.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "25.12.1"
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: asim
3
+ Version: 25.12.1
4
+ Summary: Automatic simulation system powered by neural networks
5
+ Keywords: simulation
6
+ Requires-Python: >=3.12
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: torch>=2.8.0
10
+ Requires-Dist: lightning>=2.5.5
11
+ Provides-Extra: dev
12
+ Requires-Dist: matplotlib; extra == "dev"
13
+ Dynamic: license-file
14
+
15
+ # Automatic simulation system powered by neural networks
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install asim
21
+ ```
22
+
23
+ ## What is asim
24
+
25
+ - Physical field modeling with automatic constraint enforcement
26
+ - Flexible data grouping and normalization
27
+ - Built-in support for recurrent architectures
28
+ - Export/import of trained models
29
+
30
+ ## Using asim
31
+
32
+ ```python
33
+ import matplotlib.pyplot as plt
34
+ import pandas as pd
35
+ from asim.dataset import PhysicalDataManage, Ts, Fi, Fo, DummyDatasets
36
+ from asim.model import PhysicalFieldModel
37
+ from asim.optimizer import ContinuousOptimizer
38
+ from asim.simulator import PhysicalSimulator
39
+
40
+ # 1. Define data and structure
41
+ df = DummyDatasets.basic_boiler(size=1000) # pd.read_csv("demo.csv")
42
+ cols = [
43
+ Ts(label="ts"),
44
+ Fi(group="boiler", label="power1", min=0.0, union="kw", control=True),
45
+ Fi(group="boiler", label="power2", min=0.0, union="kw", control=True),
46
+ Fo(group="boiler", label="load", min=0.0, union="t", loop=True),
47
+ ]
48
+ dm = PhysicalDataManage(df, columns=cols, batch_size=64)
49
+
50
+ # 2A. Select the model, define the parameters, train and save
51
+ fm = PhysicalFieldModel(dm, lr=0.003)
52
+ fm.fit(epochs=100)
53
+ fm.export("demo.sim.onnx")
54
+
55
+ # 2B. Use a simulator to simulate the operation
56
+ sim = PhysicalSimulator("demo.sim.onnx", dm=dm)
57
+ sim_df = df[100:310].copy()
58
+ sim_df["ts"] = pd.to_datetime(sim_df["ts"], unit="s")
59
+ sim_df = sim.steps(sim_df, x0={"load": 150.0})
60
+ sim_df.plot(
61
+ x="ts",
62
+ y=sum(sim.get_group_names(), []),
63
+ subplots=sim.get_group_names(),
64
+ sharex=True,
65
+ figsize=(10, 3),
66
+ ylim=(0, None),
67
+ grid=True,
68
+ )
69
+ plt.tight_layout()
70
+ plt.show()
71
+
72
+ # 3A. RL
73
+ opt = ContinuousOptimizer(sim=sim, dm=dm)
74
+ opt.fit(epochs=100)
75
+ opt.export("demo.opt.onnx")
76
+
77
+ # 3B. Use the simulator to reinforce the test
78
+ ```
@@ -0,0 +1,15 @@
1
+ asim/__init__.py,sha256=Jzb_RfgvXCrm_SQ4AfeGVi1N36YybxnM5mpyxrnihgI,33
2
+ asim/dataset.cpython-313-x86_64-linux-gnu.so,sha256=gqiFN_sm5X7UHBYL7WW-0frDzh012F2-pPKQQaM_GAw,1372528
3
+ asim/dataset.pyi,sha256=NZnlI9dEfYCP-kA8-BqjzFREClkwkEDaLQ_n0T78L9s,209
4
+ asim/explainer.cpython-313-x86_64-linux-gnu.so,sha256=MqeCPJ9UuZBQoa9GAf-NYwCn3rAbGllyR17hRx0KPuw,193456
5
+ asim/model.cpython-313-x86_64-linux-gnu.so,sha256=9Lmgp4MXi5RNE-XrPrTAOx_WM6OV0GEr9esvRk8NdTc,1392712
6
+ asim/model.pyi,sha256=qe0u6xUiv2yzFJWnScowi0_6LE6MAO2C8I4Rh8gKxBg,266
7
+ asim/optimizer.cpython-313-x86_64-linux-gnu.so,sha256=fDeqloPXjd3cHR5wDq6gO13SiuZy55nak0rCPBiF1Qc,235352
8
+ asim/simulator.cpython-313-x86_64-linux-gnu.so,sha256=KE-T8mRyDF9415ipUH83Ao2BNsYI6HIK_fmh1-37EJM,635144
9
+ asim/simulator.pyi,sha256=MrpJgkKo9DA5hi7QPHUr8zyPf8PaRtbts1uHmb8_0Ak,814
10
+ asim/version.py,sha256=rW4VI6vW4cu-DMZjtYqIe3FzMgXgKWI9l9RpcuMnVfw,24
11
+ asim-25.12.1.dist-info/METADATA,sha256=y-kDqVm4SexBRu0omFKTmTResmybUzWb-tDCWJfJ7Sc,2096
12
+ asim-25.12.1.dist-info/WHEEL,sha256=sLnxkimgGZnkHfiVG0CKXk3cbEzmkkBUHrkKJEO9o6g,151
13
+ asim-25.12.1.dist-info/top_level.txt,sha256=6tOoh20rJ_xz66lNdZVG11p8YArVbqac0k2MEp33X9M,5
14
+ asim-25.12.1.dist-info/RECORD,,
15
+ asim-25.12.1.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-manylinux_2_17_x86_64
5
+ Tag: cp313-cp313-manylinux2014_x86_64
6
+
File without changes
@@ -0,0 +1 @@
1
+ asim