slowpy 0.4.0__tar.gz
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.
- slowpy-0.4.0/PKG-INFO +27 -0
- slowpy-0.4.0/pyproject.toml +55 -0
- slowpy-0.4.0/setup.cfg +4 -0
- slowpy-0.4.0/slowpy/__init__.py +11 -0
- slowpy-0.4.0/slowpy/basetypes.py +118 -0
- slowpy-0.4.0/slowpy/control/__init__.py +13 -0
- slowpy-0.4.0/slowpy/control/control_AsyncDripline.py +492 -0
- slowpy-0.4.0/slowpy/control/control_AsyncHTTP.py +153 -0
- slowpy-0.4.0/slowpy/control/control_AsyncLocalPubsub.py +213 -0
- slowpy-0.4.0/slowpy/control/control_AsyncMQTT.py +370 -0
- slowpy-0.4.0/slowpy/control/control_AsyncModbus.py +208 -0
- slowpy-0.4.0/slowpy/control/control_AsyncNATS.py +275 -0
- slowpy-0.4.0/slowpy/control/control_AsyncRabbitMQ.py +594 -0
- slowpy-0.4.0/slowpy/control/control_AsyncRedis.py +500 -0
- slowpy-0.4.0/slowpy/control/control_AsyncSlowMQ.py +321 -0
- slowpy-0.4.0/slowpy/control/control_AsyncSlowdash.py +43 -0
- slowpy-0.4.0/slowpy/control/control_CAMAC.py +497 -0
- slowpy-0.4.0/slowpy/control/control_DataStore.py +53 -0
- slowpy-0.4.0/slowpy/control/control_Dripline.py +229 -0
- slowpy-0.4.0/slowpy/control/control_DriplineInterface.py +61 -0
- slowpy-0.4.0/slowpy/control/control_DummyDevice.py +178 -0
- slowpy-0.4.0/slowpy/control/control_Ethernet.py +398 -0
- slowpy-0.4.0/slowpy/control/control_HTTP.py +156 -0
- slowpy-0.4.0/slowpy/control/control_LabJackU.py +466 -0
- slowpy-0.4.0/slowpy/control/control_MQTT.py +246 -0
- slowpy-0.4.0/slowpy/control/control_Microphone.py +198 -0
- slowpy-0.4.0/slowpy/control/control_Modbus.py +172 -0
- slowpy-0.4.0/slowpy/control/control_NanotechMotor.py +528 -0
- slowpy-0.4.0/slowpy/control/control_RabbitMQ.py +596 -0
- slowpy-0.4.0/slowpy/control/control_Redis.py +499 -0
- slowpy-0.4.0/slowpy/control/control_Serial.py +104 -0
- slowpy-0.4.0/slowpy/control/control_Shell.py +95 -0
- slowpy-0.4.0/slowpy/control/control_Slowdash.py +42 -0
- slowpy-0.4.0/slowpy/control/control_UDP.py +119 -0
- slowpy-0.4.0/slowpy/control/control_VISA.py +108 -0
- slowpy-0.4.0/slowpy/control/dummy_device.py +132 -0
- slowpy-0.4.0/slowpy/control/hdl/__init__.py +3 -0
- slowpy-0.4.0/slowpy/control/hdl/hdl.py +177 -0
- slowpy-0.4.0/slowpy/control/netutils.py +127 -0
- slowpy-0.4.0/slowpy/control/node.py +819 -0
- slowpy-0.4.0/slowpy/control/scpi_server.py +344 -0
- slowpy-0.4.0/slowpy/control/system.py +372 -0
- slowpy-0.4.0/slowpy/graphs.py +121 -0
- slowpy-0.4.0/slowpy/histograms.py +316 -0
- slowpy-0.4.0/slowpy/mesh/__init__.py +5 -0
- slowpy-0.4.0/slowpy/mesh/dash.py +81 -0
- slowpy-0.4.0/slowpy/mesh/mesh.py +645 -0
- slowpy-0.4.0/slowpy/mesh/packet.py +107 -0
- slowpy-0.4.0/slowpy/mesh/stdio.py +403 -0
- slowpy-0.4.0/slowpy/mesh/tasklet.py +755 -0
- slowpy-0.4.0/slowpy/mpldata.py +348 -0
- slowpy-0.4.0/slowpy/slowfetch.py +184 -0
- slowpy-0.4.0/slowpy/slowplot.py +540 -0
- slowpy-0.4.0/slowpy/store/__init__.py +9 -0
- slowpy-0.4.0/slowpy/store/blob_storage.py +155 -0
- slowpy-0.4.0/slowpy/store/factory.py +32 -0
- slowpy-0.4.0/slowpy/store/store.py +156 -0
- slowpy-0.4.0/slowpy/store/store_CSV.py +95 -0
- slowpy-0.4.0/slowpy/store/store_HDF5.py +239 -0
- slowpy-0.4.0/slowpy/store/store_InfluxDB2.py +143 -0
- slowpy-0.4.0/slowpy/store/store_Redis.py +163 -0
- slowpy-0.4.0/slowpy/store/store_SQL.py +489 -0
- slowpy-0.4.0/slowpy/treetable.py +71 -0
- slowpy-0.4.0/slowpy/trend.py +200 -0
- slowpy-0.4.0/slowpy.egg-info/PKG-INFO +27 -0
- slowpy-0.4.0/slowpy.egg-info/SOURCES.txt +112 -0
- slowpy-0.4.0/slowpy.egg-info/dependency_links.txt +1 -0
- slowpy-0.4.0/slowpy.egg-info/requires.txt +28 -0
- slowpy-0.4.0/slowpy.egg-info/top_level.txt +1 -0
- slowpy-0.4.0/test/test-control-async-modbus.py +32 -0
- slowpy-0.4.0/test/test-control-async-mqtt.py +40 -0
- slowpy-0.4.0/test/test-control-async-nats.py +40 -0
- slowpy-0.4.0/test/test-control-async-rabbitmq.py +42 -0
- slowpy-0.4.0/test/test-control-async-redis-pubsub.py +40 -0
- slowpy-0.4.0/test/test-control-async-redis.py +34 -0
- slowpy-0.4.0/test/test-control-async-slowdash.py +28 -0
- slowpy-0.4.0/test/test-control-async-slowmq.py +40 -0
- slowpy-0.4.0/test/test-control-dripline.py +10 -0
- slowpy-0.4.0/test/test-control-dummydevice.py +24 -0
- slowpy-0.4.0/test/test-control-dummyevents.py +10 -0
- slowpy-0.4.0/test/test-control-ethernet-scpi.py +27 -0
- slowpy-0.4.0/test/test-control-labjack.py +20 -0
- slowpy-0.4.0/test/test-control-modbus.py +27 -0
- slowpy-0.4.0/test/test-control-mqtt-callback.py +20 -0
- slowpy-0.4.0/test/test-control-mqtt.py +34 -0
- slowpy-0.4.0/test/test-control-rabbitmq.py +35 -0
- slowpy-0.4.0/test/test-control-redis-pubsub.py +32 -0
- slowpy-0.4.0/test/test-control-redis.py +29 -0
- slowpy-0.4.0/test/test-control-shell.py +14 -0
- slowpy-0.4.0/test/test-control-slowdash.py +23 -0
- slowpy-0.4.0/test/test-data-hist-graph.py +28 -0
- slowpy-0.4.0/test/test-data-trend.py +29 -0
- slowpy-0.4.0/test/test-hdl-dummy-store.py +27 -0
- slowpy-0.4.0/test/test-hdl-simple.py +25 -0
- slowpy-0.4.0/test/test-hdl.py +80 -0
- slowpy-0.4.0/test/test-mesh-node.py +54 -0
- slowpy-0.4.0/test/test-mesh-pubsub.py +40 -0
- slowpy-0.4.0/test/test-mesh-rpc.py +41 -0
- slowpy-0.4.0/test/test-mesh-slowtask.py +59 -0
- slowpy-0.4.0/test/test-mesh-tasklet.py +70 -0
- slowpy-0.4.0/test/test-scpi-server.py +46 -0
- slowpy-0.4.0/test/test-scpize-dummydevice-nodes.py +28 -0
- slowpy-0.4.0/test/test-slowfetch-obj.py +28 -0
- slowpy-0.4.0/test/test-slowfetch.py +28 -0
- slowpy-0.4.0/test/test-slowplot-hist-graph.py +48 -0
- slowpy-0.4.0/test/test-slowplot-plt.py +34 -0
- slowpy-0.4.0/test/test-store-csv.py +22 -0
- slowpy-0.4.0/test/test-store-hdf5.py +23 -0
- slowpy-0.4.0/test/test-store-influxdb.py +22 -0
- slowpy-0.4.0/test/test-store-mysql.py +22 -0
- slowpy-0.4.0/test/test-store-postgresql.py +22 -0
- slowpy-0.4.0/test/test-store-redis.py +22 -0
- slowpy-0.4.0/test/test-store-sqlite-blob.py +20 -0
- slowpy-0.4.0/test/test-store-sqlite.py +22 -0
slowpy-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: slowpy
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: SlowDash Python Library
|
|
5
|
+
Author: Sanshiro Enomoto
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Dist: numpy
|
|
8
|
+
Requires-Dist: matplotlib
|
|
9
|
+
Provides-Extra: pandas
|
|
10
|
+
Requires-Dist: pandas; extra == "pandas"
|
|
11
|
+
Provides-Extra: postgres
|
|
12
|
+
Requires-Dist: psycopg2-binary; extra == "postgres"
|
|
13
|
+
Provides-Extra: mysql
|
|
14
|
+
Requires-Dist: mysql-connector-python; extra == "mysql"
|
|
15
|
+
Provides-Extra: influxdb
|
|
16
|
+
Requires-Dist: influxdb-client; extra == "influxdb"
|
|
17
|
+
Provides-Extra: redis
|
|
18
|
+
Requires-Dist: redis; extra == "redis"
|
|
19
|
+
Provides-Extra: hdf5
|
|
20
|
+
Requires-Dist: h5py; extra == "hdf5"
|
|
21
|
+
Provides-Extra: all
|
|
22
|
+
Requires-Dist: pandas; extra == "all"
|
|
23
|
+
Requires-Dist: psycopg2-binary; extra == "all"
|
|
24
|
+
Requires-Dist: mysql-connector-python; extra == "all"
|
|
25
|
+
Requires-Dist: influxdb-client; extra == "all"
|
|
26
|
+
Requires-Dist: redis; extra == "all"
|
|
27
|
+
Requires-Dist: h5py; extra == "all"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "slowpy"
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
description = "SlowDash Python Library"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Sanshiro Enomoto" }
|
|
11
|
+
]
|
|
12
|
+
license = "MIT"
|
|
13
|
+
|
|
14
|
+
dependencies = [
|
|
15
|
+
"numpy",
|
|
16
|
+
"matplotlib",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.optional-dependencies]
|
|
20
|
+
pandas = [
|
|
21
|
+
"pandas",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
postgres = [
|
|
25
|
+
"psycopg2-binary",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
mysql = [
|
|
29
|
+
"mysql-connector-python",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
influxdb = [
|
|
33
|
+
"influxdb-client",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
redis = [
|
|
37
|
+
"redis",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
hdf5 = [
|
|
41
|
+
"h5py",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
all = [
|
|
45
|
+
"pandas",
|
|
46
|
+
"psycopg2-binary",
|
|
47
|
+
"mysql-connector-python",
|
|
48
|
+
"influxdb-client",
|
|
49
|
+
"redis",
|
|
50
|
+
"h5py",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["."]
|
|
55
|
+
include = ["slowpy*"]
|
slowpy-0.4.0/setup.cfg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
from .basetypes import DataElement, TimeSeries
|
|
3
|
+
from .histograms import Histogram, Histogram2d, HistogramBasicStat, HistogramCountStat, Histogram2dBasicStat
|
|
4
|
+
from .graphs import Graph, GraphYStat
|
|
5
|
+
from .trend import Trend, RateTrend
|
|
6
|
+
from .treetable import Tree, Table
|
|
7
|
+
|
|
8
|
+
from .slowfetch import SlowFetch
|
|
9
|
+
|
|
10
|
+
from .mpldata import slowdashify
|
|
11
|
+
from .slowplot import slowplot
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Created by Sanshiro Enomoto on 17 July 2024 #
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import time, json
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class DataElement:
|
|
8
|
+
def __init__(self):
|
|
9
|
+
self.attr_values = {}
|
|
10
|
+
self.stat_values = {}
|
|
11
|
+
self.stat_functors = []
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def add_attr(self, name, value):
|
|
15
|
+
self.attr_values[name] = value
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def add_stat(self, arg0, arg1=None):
|
|
19
|
+
# add_stat(key, value) or add_stat(functor) where functor takes an DataElement and returns a dict
|
|
20
|
+
if callable(arg0):
|
|
21
|
+
self.stat_functors.append(arg0)
|
|
22
|
+
else:
|
|
23
|
+
self.stat_values[arg0] = arg1
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def clear(self):
|
|
27
|
+
self.stat_values = {}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def to_json(self):
|
|
31
|
+
for f in self.stat_functors:
|
|
32
|
+
self.stat_values.update(f(self))
|
|
33
|
+
|
|
34
|
+
record = {}
|
|
35
|
+
if any(self.attr_values):
|
|
36
|
+
record.update({ '_attr': self.attr_values })
|
|
37
|
+
if any(self.stat_values):
|
|
38
|
+
record.update({ '_stat': self.stat_values })
|
|
39
|
+
return record
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@staticmethod
|
|
43
|
+
def from_json(obj):
|
|
44
|
+
if type(obj) is not dict:
|
|
45
|
+
return obj
|
|
46
|
+
|
|
47
|
+
from .graphs import Graph
|
|
48
|
+
from .histograms import Histogram, Histogram2d
|
|
49
|
+
|
|
50
|
+
if 'bins' in obj:
|
|
51
|
+
return Histogram.from_json(obj)
|
|
52
|
+
elif 'ybins' in obj:
|
|
53
|
+
return Histogram2d.from_json(obj)
|
|
54
|
+
elif 'y' in obj:
|
|
55
|
+
return Graph.from_json(obj)
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def __str__(self):
|
|
60
|
+
return json.dumps(self.to_json())
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class TimeSeries:
|
|
65
|
+
def __init__(self, *, fields:list[str]|None=None, start:float=0, length:float|None=None):
|
|
66
|
+
self.start = start
|
|
67
|
+
self.length = length
|
|
68
|
+
self.fields = fields if fields is not None and len(fields) > 0 else ['x']
|
|
69
|
+
self.t = []
|
|
70
|
+
self.values = [ [] for _ in self.fields ] # self.values[field] is a time-series (array) for the field
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def write(self, values, t=None):
|
|
74
|
+
'''
|
|
75
|
+
# add one point to the time-series #
|
|
76
|
+
- values: dict for field name-value pairs, or list for field values, or a value
|
|
77
|
+
where a value can be a number, string, or data-element.
|
|
78
|
+
- time: UNIX time-stamp, if None if given, the current time will be used.
|
|
79
|
+
'''
|
|
80
|
+
if t is None:
|
|
81
|
+
t = time.time()
|
|
82
|
+
|
|
83
|
+
record = [None] * len(self.fields)
|
|
84
|
+
if isinstance(values, dict):
|
|
85
|
+
for i in range(len(record)):
|
|
86
|
+
record[i] = values.get(self.fields[i], None)
|
|
87
|
+
elif isinstance(values, list):
|
|
88
|
+
for i in range(min(len(values), len(record))):
|
|
89
|
+
record[i] = values[i]
|
|
90
|
+
else:
|
|
91
|
+
record[0] = values
|
|
92
|
+
|
|
93
|
+
self.t.append(t - self.start)
|
|
94
|
+
for k in range(len(self.fields)):
|
|
95
|
+
self.values[k].append(record[k])
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def to_json(self):
|
|
99
|
+
length = self.length
|
|
100
|
+
if length is None:
|
|
101
|
+
if len(self.t) < 1:
|
|
102
|
+
length = 1
|
|
103
|
+
else:
|
|
104
|
+
length = self.t[-1] + 1
|
|
105
|
+
|
|
106
|
+
data = {
|
|
107
|
+
'start': self.start,
|
|
108
|
+
'length': length,
|
|
109
|
+
't': self.t,
|
|
110
|
+
}
|
|
111
|
+
for k in range(len(self.fields)):
|
|
112
|
+
data[self.fields[k]] = self.values[k]
|
|
113
|
+
|
|
114
|
+
return data
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def __str__(self):
|
|
118
|
+
return json.dumps(self.to_json())
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
from .node import ControlNode, ControlVariableNode, ControlThreadNode, ControlException
|
|
3
|
+
from .system import ControlSystem, ValueNode, control_system
|
|
4
|
+
from .control_Ethernet import EthernetNode, ScpiNode, ScpiCommandNode
|
|
5
|
+
from .control_UDP import UdpSocketNode
|
|
6
|
+
from .control_HTTP import HttpNode
|
|
7
|
+
from .control_Shell import ShellNode
|
|
8
|
+
from .control_DataStore import DataStoreNode
|
|
9
|
+
|
|
10
|
+
from .scpi_server import ScpiServer, ScpiAdapter
|
|
11
|
+
from .netutils import find_ip
|
|
12
|
+
|
|
13
|
+
from .dummy_device import RandomWalkDevice, RandomHitDevice, RandomChargeDevice, RandomTimeDevice
|