better-rtplot 0.1.5__tar.gz → 0.1.7__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.
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: better-rtplot
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary:
5
5
  License: GPL V3.0
6
6
  Author: jmontp
7
7
  Author-email: jmontp@umich.edu
8
- Requires-Python: >=3.9,<3.12
8
+ Requires-Python: >=3.9,<3.13
9
9
  Classifier: License :: Other/Proprietary License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.9
@@ -36,9 +36,12 @@ The main highlight in this plotter are the following:
36
36
 
37
37
 
38
38
  # Install
39
- To isntall just the client (can only send data)
39
+ To install just the client (can only send data)
40
+
40
41
  ```pip install better-rtplot```
42
+
41
43
  To install the client and the dependencies for the server. This is not recommended for smaller devices since some dependencies are large.
44
+
42
45
  ```pip install better-rtplot[server]```
43
46
 
44
47
  If you are using WSL, you need to install an xorg server such as [vcXsrv](https://sourceforge.net/projects/vcxsrv/) to see the plot. However, this should run in a native windows install of python.
@@ -46,22 +49,24 @@ If you are using WSL, you need to install an xorg server such as [vcXsrv](https:
46
49
  # How to use
47
50
  The general steps to use the plotter are as follows:
48
51
 
49
- 1. Run the server script on the computer that will be used to visualize the data
52
+ 1. Run the server.py script on the computer that will be used to visualize the data
50
53
  2. Import the client library to (lightly) modify your code so that it can send data to the server
51
54
 
52
55
  In more detail:
53
56
 
54
- ### Step 1: Run the server
57
+ ## Step 1: Run the program that visualizes the data (server.py)
55
58
 
56
59
  To run the server script, you can run the following code in the command line
60
+
57
61
  ```python3 -m rtplot.server```
58
62
 
59
63
  This will open a window which will wait for plots that are sent by a client. This is a convenient setup if you know the IP address of the computer that is running the server. However, if you don't know the IP address, you can specify the ip address of the computer that is sending data (e.g. the client) with the following line:
60
- ``` python3 server.py -p xxx.xxx.xxx.xxx```
64
+
65
+ ``` python3 -m rtplot server.py -p 192.168.1.1```
61
66
 
62
- Where the xxx.xxx.xxx.xxx represents the pi's ip address (note, you must be on the same network)
67
+ Where the"192.168.1.1" represents the IP address of the computer you want to connect to (note, you must be on the same network).
63
68
 
64
- ### Step 2: Modify your code to send data
69
+ ## Step 2: Modify your code to send data (use "client" library)
65
70
 
66
71
  You only need to follow a few steps to update your code to send data to a server
67
72
 
@@ -94,43 +99,53 @@ for i in range(1000):
94
99
 
95
100
  Here is a more detailed explanation of every step
96
101
 
97
- ## Step 1: (Optional) Set the IP address of the server
102
+ ### Code changes 1: (Optional) Set the IP address of the server
98
103
 
99
104
  There are three function calls that will allow you to configure the IP address of the plotter
100
105
 
101
106
  ```client.configure_ip(ip)```
107
+
102
108
  This is the most common function you will use. The ip address is a string in the normal format. For example ```client.configure_ip(192.168.1.1)``` will connect to the computer addressed at 192.168.1.1 on port 5555 by default. You can also specify the port by adding it with a colon. Therefore, ```client.configure_ip(192.168.1.1:1234)``` connects to IP address 192.168.1.1 on port 1234.
103
109
 
104
110
  ```client.local_plot()```
111
+
105
112
  This will indicate that the server is running in the same machine. It is a shorthand for ```client.configure_ip(127.0.0.1)```
106
113
 
107
114
  ```client.plot_to_neurobionics_tv()```
115
+
108
116
  This will send data to the TV in the rehab lab bigscreen TV.
109
117
 
110
118
 
111
- ## Step 2: Send the plot configuration to the server
119
+ ### Code changes 2: Send the plot configuration to the server
112
120
 
113
121
  The client specifies what the plot looks like. Therefore, that has to be added to where you send the data. The only function that you need to call is ```client.initialize_plots()```. This function can take in many different arguments to define the look and feel. At the most basic level you can have one plot with one or more traces. However, you can add multiple sub-plots with different amounts of traces in each. Therefore the different ways that you can call ```client.initialize_plots(plot_layout)``` are:
114
122
 
115
- * No argument
123
+ - No argument
124
+
116
125
  This will intialize the plot to have one subplot with one trace
117
126
 
118
- * Integer
127
+ - Integer
128
+
119
129
  This will configure one subplot to have the a
120
130
 
121
- * String
131
+ - String
132
+
122
133
  This will configure the plots to have one subplot with a trace named the same as the string
123
134
 
124
- * List of strings
135
+ - List of strings
136
+
125
137
  One subplot with as many traces as names in the list, each with the corresponding name.
126
138
 
127
- * List that contains lists of strings
139
+ - List that contains lists of strings
140
+
128
141
  Same as above, but now with as many subplots as sublists
129
142
 
130
- * Dictionary
143
+ - Dictionary
144
+
131
145
  One subplot with a more advanced configuration
132
146
 
133
- * List of dictionaries
147
+ - List of dictionaries
148
+
134
149
  Many subplots, each with an advanced configuration
135
150
 
136
151
 
@@ -139,46 +154,46 @@ Many subplots, each with an advanced configuration
139
154
  You can control the look and feel of the plots by sending a dictionary that contains specific strings as the keys. These are as follows
140
155
 
141
156
 
142
- * 'names' - This defines the names of the traces. The plot will have as many traces as names.
157
+ - 'names' - This defines the names of the traces. The plot will have as many traces as names.
143
158
 
144
- * 'colors' - Defines the colors for each trace. [Follow documentation on how to specify color](https://pyqtgraph.readthedocs.io/en/latest/style.html). Should have at least the same length as the number of traces.
159
+ - 'colors' - Defines the colors for each trace. [Follow documentation on how to specify color](https://pyqtgraph.readthedocs.io/en/latest/style.html). Should have at least the same length as the number of traces.
145
160
 
146
- * 'line_style' - Defines wheter or not a trace is dashed or not.
161
+ - 'line_style' - Defines wheter or not a trace is dashed or not.
147
162
  * '-' - represents dashed line
148
163
  * "" - emptry string (or any other string) represents a normal line
149
164
 
150
- * 'line_width' - Defines how thick the plot lines are. Expects an integer
165
+ - 'line_width' - Defines how thick the plot lines are. Expects an integer
151
166
 
152
- * 'title' - Sets the title to the plot
167
+ - 'title' - Sets the title to the plot
153
168
 
154
- * 'ylabel' - Sets the y label of the plot
169
+ - 'ylabel' - Sets the y label of the plot
155
170
 
156
- * 'xlabel' - Sets the x label of the plot
171
+ - 'xlabel' - Sets the x label of the plot
157
172
 
158
- * 'yrange' - Sets the range of values of y. This provides a performance boost to the plotter
173
+ - 'yrange' - Sets the range of values of y. This provides a performance boost to the plotter
159
174
  * Expects values as a iterable in the order [min, max]. Example: [-2,2]
160
175
 
161
- * 'xrange' - Sets the number of datapoints that will be in the real time plotter at a given time.
176
+ - 'xrange' - Sets the number of datapoints that will be in the real time plotter at a given time.
162
177
  * Expects values as a integer that describes how many datapoints are in the subplot. Default is 200 datapoints
163
178
 
164
179
  You only need to specify the things that you want, if the dictionary element is left out then the default value is used.
165
180
 
166
181
  You can see the [example code](https://github.com/jmontp/rtplot/blob/master/rtplot/example_code.py) to see how these are used.
167
182
 
168
- ## Step 3: How to send data
183
+ ### Code changes 3: How to send data
169
184
 
170
185
  To send data to the server, you use the ```client.send_array(arr)``` function. Similar to initialize plots, this function also takes in multiple different argument types:
171
186
 
172
- * Float
187
+ - Float
173
188
  When there is only one trace
174
189
 
175
- * List of float
190
+ - List of float
176
191
  The length of the list has to equal the total number of traces that are configured for the plot
177
192
 
178
- * 1-d Numpy array
193
+ - 1-d Numpy array
179
194
  The size of the numpy array has to be equal to the total number of traces that are configured for the plot
180
195
 
181
- * 2-d Numpy array
196
+ - 2-d Numpy array
182
197
  The number of rows must equal the total number of traces. The column can vary in length. The sever will plot as many datapoints as you send in. E.g. the plot will be updated with 10 new points if you have 10 columns. This can make the plot looks less smooth but it will increase performance. More on improving performance later.
183
198
 
184
199
  # Saving plots
@@ -235,20 +250,18 @@ Where xxx.xxx.xxx.xxx is the IP address of the server.
235
250
 
236
251
  Even though the plotter is built to be fast, if you have enough traces in the screen it can cause it to slow down. The bottleneck in the code is redrawing the traces. In particular, the amount of pixels it has to redraw will close it down (weird bottleneck, I know). To get around this you can do serveral things to improve the frames per second of the plotter.
237
252
 
238
- * Plot multiple points at the same time. You can redraw the plot after multiple datapoints instead of updating every single data point. This will cause the plotter to look un-smooth if too many points are sent at the same time. This can be done in one of two ways:
253
+ - Fix y range. The easiest way to get a significant increase in frames per second is to set the 'yrange' configuration of the plot. If you are having slower than desired performance this is the first step I would take.
239
254
 
255
+ - Plot multiple points at the same time. You can redraw the plot after multiple datapoints instead of updating every single data point. This will cause the plotter to look un-smooth if too many points are sent at the same time. This can be done in one of two ways:
256
+ * Pass in the '-s' flag along with an integer to the server. This will cause the server to skip datapoints between plot refreshing. For example,
257
+ ```python3 -m rtplot.server -s 5```
258
+ will refresh the plot once it receives 5 transmissions of data. If you set the -a flag in the server, it will automatically update the skip rate. This is only good to experiment to find the skip rate that works for you and bad if you want the time data to have the correct timestamps since the rate at which you consume data will change. The adapted rate is printed to the terminal
259
+
260
+ * Send a batch of data from the client. Using a 2-d numpy array, the first axis will represent the amount of traces in the plot configuration and the second axis will determine how many datapoints you want to send. The server will automatically determine how much data you are sending. This stacks with the server's '-s' flag.
240
261
 
241
- ** Fix y range. The easiest way to get a significant increase in frames per second is to set the 'yrange' configuration of the plot. If you are having slower than desired performance this is the first step I would take.
242
-
243
- ** Pass in the '-s' flag along with an integer to the server. This will cause the server to skip datapoints between plot refreshing. For example,
244
- ```python3 -m rtplot.server -s 5```
245
- will refresh the plot once it receives 5 transmissions of data. If you set the -a flag in the server, it will automatically update the skip rate. This is only good to experiment to find the skip rate that works for you and bad if you want the time data to have the correct timestamps since the rate at which you consume data will change. The adapted rate is printed to the terminal
246
-
247
- ** Send a batch of data from the client. Using a 2-d numpy array, the first axis will represent the amount of traces in the plot configuration and the second axis will determine how many datapoints you want to send. The server will automatically determine how much data you are sending. This stacks with the server's '-s' flag.
248
-
249
- ** Reduce the amount of pixels that you have to plot. If you reduce the size of the plotter window, or reduce the resolution of the monitor.
262
+ - Reduce the amount of pixels that you have to plot. If you reduce the size of the plotter window, or reduce the resolution of the monitor.
250
263
 
251
- ** Reduce the line width of the plot. There is an option in the plotter configuration dictionary to increase the line width of each trace. While this makes the lots much easier to read it also makes it much slower. Therefore, keeping the line width at a minimum helps to keep the speed up.
264
+ - Reduce the line width of the traces. There is an option in the plotter configuration dictionary to increase the line width of each trace. While this makes the lots much easier to read it also makes it much slower. Therefore, keeping the line width at a minimum helps to keep the speed up.
252
265
 
253
266
 
254
267
 
@@ -14,9 +14,12 @@ The main highlight in this plotter are the following:
14
14
 
15
15
 
16
16
  # Install
17
- To isntall just the client (can only send data)
17
+ To install just the client (can only send data)
18
+
18
19
  ```pip install better-rtplot```
20
+
19
21
  To install the client and the dependencies for the server. This is not recommended for smaller devices since some dependencies are large.
22
+
20
23
  ```pip install better-rtplot[server]```
21
24
 
22
25
  If you are using WSL, you need to install an xorg server such as [vcXsrv](https://sourceforge.net/projects/vcxsrv/) to see the plot. However, this should run in a native windows install of python.
@@ -24,22 +27,24 @@ If you are using WSL, you need to install an xorg server such as [vcXsrv](https:
24
27
  # How to use
25
28
  The general steps to use the plotter are as follows:
26
29
 
27
- 1. Run the server script on the computer that will be used to visualize the data
30
+ 1. Run the server.py script on the computer that will be used to visualize the data
28
31
  2. Import the client library to (lightly) modify your code so that it can send data to the server
29
32
 
30
33
  In more detail:
31
34
 
32
- ### Step 1: Run the server
35
+ ## Step 1: Run the program that visualizes the data (server.py)
33
36
 
34
37
  To run the server script, you can run the following code in the command line
38
+
35
39
  ```python3 -m rtplot.server```
36
40
 
37
41
  This will open a window which will wait for plots that are sent by a client. This is a convenient setup if you know the IP address of the computer that is running the server. However, if you don't know the IP address, you can specify the ip address of the computer that is sending data (e.g. the client) with the following line:
38
- ``` python3 server.py -p xxx.xxx.xxx.xxx```
42
+
43
+ ``` python3 -m rtplot server.py -p 192.168.1.1```
39
44
 
40
- Where the xxx.xxx.xxx.xxx represents the pi's ip address (note, you must be on the same network)
45
+ Where the"192.168.1.1" represents the IP address of the computer you want to connect to (note, you must be on the same network).
41
46
 
42
- ### Step 2: Modify your code to send data
47
+ ## Step 2: Modify your code to send data (use "client" library)
43
48
 
44
49
  You only need to follow a few steps to update your code to send data to a server
45
50
 
@@ -72,43 +77,53 @@ for i in range(1000):
72
77
 
73
78
  Here is a more detailed explanation of every step
74
79
 
75
- ## Step 1: (Optional) Set the IP address of the server
80
+ ### Code changes 1: (Optional) Set the IP address of the server
76
81
 
77
82
  There are three function calls that will allow you to configure the IP address of the plotter
78
83
 
79
84
  ```client.configure_ip(ip)```
85
+
80
86
  This is the most common function you will use. The ip address is a string in the normal format. For example ```client.configure_ip(192.168.1.1)``` will connect to the computer addressed at 192.168.1.1 on port 5555 by default. You can also specify the port by adding it with a colon. Therefore, ```client.configure_ip(192.168.1.1:1234)``` connects to IP address 192.168.1.1 on port 1234.
81
87
 
82
88
  ```client.local_plot()```
89
+
83
90
  This will indicate that the server is running in the same machine. It is a shorthand for ```client.configure_ip(127.0.0.1)```
84
91
 
85
92
  ```client.plot_to_neurobionics_tv()```
93
+
86
94
  This will send data to the TV in the rehab lab bigscreen TV.
87
95
 
88
96
 
89
- ## Step 2: Send the plot configuration to the server
97
+ ### Code changes 2: Send the plot configuration to the server
90
98
 
91
99
  The client specifies what the plot looks like. Therefore, that has to be added to where you send the data. The only function that you need to call is ```client.initialize_plots()```. This function can take in many different arguments to define the look and feel. At the most basic level you can have one plot with one or more traces. However, you can add multiple sub-plots with different amounts of traces in each. Therefore the different ways that you can call ```client.initialize_plots(plot_layout)``` are:
92
100
 
93
- * No argument
101
+ - No argument
102
+
94
103
  This will intialize the plot to have one subplot with one trace
95
104
 
96
- * Integer
105
+ - Integer
106
+
97
107
  This will configure one subplot to have the a
98
108
 
99
- * String
109
+ - String
110
+
100
111
  This will configure the plots to have one subplot with a trace named the same as the string
101
112
 
102
- * List of strings
113
+ - List of strings
114
+
103
115
  One subplot with as many traces as names in the list, each with the corresponding name.
104
116
 
105
- * List that contains lists of strings
117
+ - List that contains lists of strings
118
+
106
119
  Same as above, but now with as many subplots as sublists
107
120
 
108
- * Dictionary
121
+ - Dictionary
122
+
109
123
  One subplot with a more advanced configuration
110
124
 
111
- * List of dictionaries
125
+ - List of dictionaries
126
+
112
127
  Many subplots, each with an advanced configuration
113
128
 
114
129
 
@@ -117,46 +132,46 @@ Many subplots, each with an advanced configuration
117
132
  You can control the look and feel of the plots by sending a dictionary that contains specific strings as the keys. These are as follows
118
133
 
119
134
 
120
- * 'names' - This defines the names of the traces. The plot will have as many traces as names.
135
+ - 'names' - This defines the names of the traces. The plot will have as many traces as names.
121
136
 
122
- * 'colors' - Defines the colors for each trace. [Follow documentation on how to specify color](https://pyqtgraph.readthedocs.io/en/latest/style.html). Should have at least the same length as the number of traces.
137
+ - 'colors' - Defines the colors for each trace. [Follow documentation on how to specify color](https://pyqtgraph.readthedocs.io/en/latest/style.html). Should have at least the same length as the number of traces.
123
138
 
124
- * 'line_style' - Defines wheter or not a trace is dashed or not.
139
+ - 'line_style' - Defines wheter or not a trace is dashed or not.
125
140
  * '-' - represents dashed line
126
141
  * "" - emptry string (or any other string) represents a normal line
127
142
 
128
- * 'line_width' - Defines how thick the plot lines are. Expects an integer
143
+ - 'line_width' - Defines how thick the plot lines are. Expects an integer
129
144
 
130
- * 'title' - Sets the title to the plot
145
+ - 'title' - Sets the title to the plot
131
146
 
132
- * 'ylabel' - Sets the y label of the plot
147
+ - 'ylabel' - Sets the y label of the plot
133
148
 
134
- * 'xlabel' - Sets the x label of the plot
149
+ - 'xlabel' - Sets the x label of the plot
135
150
 
136
- * 'yrange' - Sets the range of values of y. This provides a performance boost to the plotter
151
+ - 'yrange' - Sets the range of values of y. This provides a performance boost to the plotter
137
152
  * Expects values as a iterable in the order [min, max]. Example: [-2,2]
138
153
 
139
- * 'xrange' - Sets the number of datapoints that will be in the real time plotter at a given time.
154
+ - 'xrange' - Sets the number of datapoints that will be in the real time plotter at a given time.
140
155
  * Expects values as a integer that describes how many datapoints are in the subplot. Default is 200 datapoints
141
156
 
142
157
  You only need to specify the things that you want, if the dictionary element is left out then the default value is used.
143
158
 
144
159
  You can see the [example code](https://github.com/jmontp/rtplot/blob/master/rtplot/example_code.py) to see how these are used.
145
160
 
146
- ## Step 3: How to send data
161
+ ### Code changes 3: How to send data
147
162
 
148
163
  To send data to the server, you use the ```client.send_array(arr)``` function. Similar to initialize plots, this function also takes in multiple different argument types:
149
164
 
150
- * Float
165
+ - Float
151
166
  When there is only one trace
152
167
 
153
- * List of float
168
+ - List of float
154
169
  The length of the list has to equal the total number of traces that are configured for the plot
155
170
 
156
- * 1-d Numpy array
171
+ - 1-d Numpy array
157
172
  The size of the numpy array has to be equal to the total number of traces that are configured for the plot
158
173
 
159
- * 2-d Numpy array
174
+ - 2-d Numpy array
160
175
  The number of rows must equal the total number of traces. The column can vary in length. The sever will plot as many datapoints as you send in. E.g. the plot will be updated with 10 new points if you have 10 columns. This can make the plot looks less smooth but it will increase performance. More on improving performance later.
161
176
 
162
177
  # Saving plots
@@ -213,20 +228,18 @@ Where xxx.xxx.xxx.xxx is the IP address of the server.
213
228
 
214
229
  Even though the plotter is built to be fast, if you have enough traces in the screen it can cause it to slow down. The bottleneck in the code is redrawing the traces. In particular, the amount of pixels it has to redraw will close it down (weird bottleneck, I know). To get around this you can do serveral things to improve the frames per second of the plotter.
215
230
 
216
- * Plot multiple points at the same time. You can redraw the plot after multiple datapoints instead of updating every single data point. This will cause the plotter to look un-smooth if too many points are sent at the same time. This can be done in one of two ways:
231
+ - Fix y range. The easiest way to get a significant increase in frames per second is to set the 'yrange' configuration of the plot. If you are having slower than desired performance this is the first step I would take.
217
232
 
233
+ - Plot multiple points at the same time. You can redraw the plot after multiple datapoints instead of updating every single data point. This will cause the plotter to look un-smooth if too many points are sent at the same time. This can be done in one of two ways:
234
+ * Pass in the '-s' flag along with an integer to the server. This will cause the server to skip datapoints between plot refreshing. For example,
235
+ ```python3 -m rtplot.server -s 5```
236
+ will refresh the plot once it receives 5 transmissions of data. If you set the -a flag in the server, it will automatically update the skip rate. This is only good to experiment to find the skip rate that works for you and bad if you want the time data to have the correct timestamps since the rate at which you consume data will change. The adapted rate is printed to the terminal
237
+
238
+ * Send a batch of data from the client. Using a 2-d numpy array, the first axis will represent the amount of traces in the plot configuration and the second axis will determine how many datapoints you want to send. The server will automatically determine how much data you are sending. This stacks with the server's '-s' flag.
218
239
 
219
- ** Fix y range. The easiest way to get a significant increase in frames per second is to set the 'yrange' configuration of the plot. If you are having slower than desired performance this is the first step I would take.
220
-
221
- ** Pass in the '-s' flag along with an integer to the server. This will cause the server to skip datapoints between plot refreshing. For example,
222
- ```python3 -m rtplot.server -s 5```
223
- will refresh the plot once it receives 5 transmissions of data. If you set the -a flag in the server, it will automatically update the skip rate. This is only good to experiment to find the skip rate that works for you and bad if you want the time data to have the correct timestamps since the rate at which you consume data will change. The adapted rate is printed to the terminal
224
-
225
- ** Send a batch of data from the client. Using a 2-d numpy array, the first axis will represent the amount of traces in the plot configuration and the second axis will determine how many datapoints you want to send. The server will automatically determine how much data you are sending. This stacks with the server's '-s' flag.
226
-
227
- ** Reduce the amount of pixels that you have to plot. If you reduce the size of the plotter window, or reduce the resolution of the monitor.
240
+ - Reduce the amount of pixels that you have to plot. If you reduce the size of the plotter window, or reduce the resolution of the monitor.
228
241
 
229
- ** Reduce the line width of the plot. There is an option in the plotter configuration dictionary to increase the line width of each trace. While this makes the lots much easier to read it also makes it much slower. Therefore, keeping the line width at a minimum helps to keep the speed up.
242
+ - Reduce the line width of the traces. There is an option in the plotter configuration dictionary to increase the line width of each trace. While this makes the lots much easier to read it also makes it much slower. Therefore, keeping the line width at a minimum helps to keep the speed up.
230
243
 
231
244
 
232
245
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "better-rtplot"
3
- version = "0.1.5"
3
+ version = "0.1.7"
4
4
  description = ""
5
5
  authors = ["jmontp <jmontp@umich.edu>"]
6
6
  license = "GPL V3.0"
@@ -8,7 +8,7 @@ readme = "README.md"
8
8
  packages = [{include = "rtplot"}]
9
9
 
10
10
  [tool.poetry.dependencies]
11
- python = ">= 3.9, < 3.12"
11
+ python = ">= 3.9, < 3.13"
12
12
  numpy = ">= 1.23.5"
13
13
  pyzmq = ">= 25.0.0"
14
14
 
File without changes