Skip to content

Commit 9a60044

Browse files
committed
src (fix): remove numpy dependency
1 parent 685d46e commit 9a60044

File tree

2 files changed

+4
-49
lines changed

2 files changed

+4
-49
lines changed

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "practable"
7-
version = "0.0.23"
7+
version = "0.0.24"
88
authors = [
99
{ name="Timothy Drysdale", email="timothy.d.drysdale@gmail.com" },
1010
]
1111
description = "Connect to remote laboratory experiments hosted on a github.com/practable service"
1212
readme = "README.md"
1313
dependencies = [
14-
"numpy>=1.20",
1514
"platformdirs>=4.2",
1615
"requests>=2.32",
1716
"websockets>=12.0",

src/practable/core.py

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from datetime import datetime, timedelta, timezone
1616
import json
1717
import math
18-
import numpy as np
1918
import os.path
2019
from platformdirs import user_config_dir
2120
from pathlib import Path
@@ -589,8 +588,7 @@ def collect_duration(self,
589588
t0 = timedelta()
590589

591590
if self.time_format == "ms":
592-
if isinstance(times, (collections.abc.Sequence,
593-
np.ndarray)) and not isinstance(times, str):
591+
if isinstance(times, collections.abc.Sequence) and not isinstance(times, str):
594592
t0 = timedelta(milliseconds=times[0])
595593
else:
596594
t0 = timedelta(milliseconds=times)
@@ -664,9 +662,7 @@ def collect_duration(self,
664662
t1 = timedelta()
665663

666664
if self.time_format == "ms":
667-
if isinstance(times,
668-
(collections.abc.Sequence,
669-
np.ndarray)) and not isinstance(times, str):
665+
if isinstance(times,collections.abc.Sequence) and not isinstance(times, str):
670666
t1 = timedelta(milliseconds=times[-1])
671667
else:
672668
t1 = timedelta(milliseconds=times)
@@ -728,44 +724,4 @@ def printProgressBar(iteration,
728724
print()
729725

730726

731-
if __name__ == "__main__":
732-
733-
print("""
734-
#Example code:
735-
%pip install practable
736-
import matplotlib.pyplot as plt
737-
from practable.core import Experiment
738-
739-
messages = []
740-
741-
#modify with actual group code and experiment name
742-
with Experiment('g-open-xxxxx','Spinner 51', exact=True) as expt:
743-
744-
# Command a step of 2 radians & collect the data
745-
expt.command('{"set":"mode","to":"stop"}')
746-
expt.command('{"set":"mode","to":"position"}')
747-
expt.command('{"set":"parameters","kp":1,"ki":0,"kd":0}')
748-
749-
time.sleep(0.5)
750-
751-
expt.command('{"set":"position","to":2}')
752-
753-
expt.ignore(0.5)
754-
messages = expt.collect(1.5)
755-
756-
# Process the data
757-
ts = expt.extract_series(messages, "t")
758-
ds = expt.extract_series(messages, "d")
759-
cs = expt.extract_series(messages, "c")
760-
761-
t = np.array(ts)
762-
t = t - t[0]
763-
764-
# Plot the data
765-
plt.figure()
766-
plt.plot(t/1e3,ds,'-b',label="position")
767-
plt.plot(t/1e3,cs,':r',label="set point")
768-
plt.xlabel("time(s)")
769-
plt.ylabel("position(rad)")
770-
plt.legend()
771-
""")
727+

0 commit comments

Comments
 (0)