Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8959f1b

Browse files
committed
first spell check pass before content additions
1 parent18aa060 commit8959f1b

File tree

1 file changed

+86
-95
lines changed

1 file changed

+86
-95
lines changed

‎README.md‎

Lines changed: 86 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
#tinySA_python
33
##AN UNOFFICIAL Python API for the tinySA Device Series
44

5-
#IN PROGRESS! The dev branch is not stable. refer to the main branch for the current stable version of the code
6-
7-
8-
95
A Non-GUI Python API for the tinySA series of devices. This repository uses official resources and documentation but is NOT endorsed by the official tinySA product or company. See the[references](#references) section for further reading. See the[official tinySA resources](https://www.tinysa.org/wiki/) for device features.
106

117
This library covers most documented commands for the tinySA device series, and is planned to include configurable, device-specific commands and memory. The documentation (after the examples) is sorted based on the serial command for the device, with some provided usage examples. While some error checking exists in both the device and the library, it is not exhaustive. It is strongly advised to read the official documentation before attempting to script with your tinySA device. Operating the device experimentally or without referencing the official documents runs the risk of**destroying your device**. See the[tinySA First use page](https://tinysa.org/wiki/pmwiki.php?n=Main.FirstUse) for some setup tips and warnings.
@@ -70,7 +66,10 @@ Improper usage may destroy your device.
7066

7167
##Library Usage
7268

73-
This library is now avilable via PyPI, local install, or just using the class. We reccomend one of the library install options.
69+
This library is now available via PyPI, local install, or just using the class. We recommend one of the library install options.
70+
71+
Several usage examples are provided in the[Example Implementations](#example-implementations) section, including working with the hardware and plotting results with matplotlib.
72+
7473

7574
###PyPI Install
7675

@@ -144,17 +143,9 @@ pip install pyserial numpy pandas matplotlib pillow pyQt5
144143
`pyQt5` is used with`matplotlib` to draw the figures. It needs to be installed on Linux systems to follow the examples included in tinySA_python, but is not needed on all Windows machines.
145144

146145

146+
###Structure
147147

148-
149-
150-
151-
OUT OF DATE - GETTING MAJOR OVERHAUL
152-
153-
This library is currently only available as the tinySA class in 'tinySA_python.py' in this repository. It is very much under development and missing some key error checking and handling. HOWEVER, ‘any’ error checking is currently more than the ‘no’ error checking provided by interfacing directly with the device. The code that is included in this repository has been tested on at least one tinySA device and is relatively stable.
154-
155-
Several usage examples are provided in the[Example Implementations](#example-implementations) section, including working with the hardware and plotting results with matplotlib.
156-
157-
148+
The`tsapython` library, as it is avilable on PyPI is structured as follows:
158149

159150
```python
160151

@@ -175,13 +166,55 @@ tsapython/
175166
├── test_basic.py
176167
├── test_example_workflow.py
177168
└── test_hardware.py
169+
```
170+
171+
A`docs` repository for the library will be added later in development for stable releases.
178172

173+
This library is also part of the`tinySA_python` repository, which includes more extensive documentation and the working development. The GitHub repository is structured as follows:
179174

175+
```python
180176

177+
tinySA_python/
178+
├──README
179+
├── requirements.txt
180+
├── test_requirements.txt
181+
├── media/
182+
│ └──README images, screenshots
183+
└──tsapython/
184+
├── .python-version
185+
├── pyproject.toml
186+
├──README.md
187+
├──LICENSE
188+
├── .gitignore
189+
├── examples/
190+
│ ├──__init__.py
191+
│ ├── identifying_serial_ports.py
192+
│ ├── plotting_scan.py
193+
│ ├── plotting_scanraw.py
194+
│ ├── plotting_waterfall_realtime.py
195+
│ ├── save_scan_csv.py
196+
│ ├── using_autoconnect.py
197+
│ └── using_command_func.py
198+
├── src/
199+
│ └── tsapython/
200+
│ ├──__init__.py
201+
│ ├── core.py
202+
│ └── py.typed
203+
└── tests/
204+
├──__init__.py
205+
├── run_all_tests.py
206+
├── test_basic.py
207+
├── test_example_workflow.py
208+
└── test_hardware.py
181209

182210
```
183211

184-
running tests:
212+
213+
###Running Tests
214+
215+
Tests should be run from the root`tsapython` directory.
216+
217+
```python
185218
# Run individual test files
186219
uv run python tests/test_basic.py
187220
uv run python tests/test_hardware.py
@@ -193,51 +226,8 @@ uv run python tests/run_all_tests.py
193226
# Or run directly if you have Python in PATH
194227
python tests/test_basic.py
195228
python tests/run_all_tests.py
196-
197-
198-
199-
200-
201-
202-
##Requirements
203-
204-
OUT OF DATE - GETTING MAJOR OVERHAUL
205-
206-
This project requires numpy, pandas and pyserial.
207-
208-
Use 'pip install -r requirements.txt' to install the following dependencies:
209-
210-
```python
211-
pyserial
212-
numpy
213-
pandas
214-
215-
```
216-
217-
The above dependencies are only for the API interfacing of the tinySA_python library. Additional dependencies should be installed if you are following the examples in this README. These can be installed with 'pip install -r test_requirements.txt':
218-
219-
```python
220-
pyserial
221-
numpy
222-
pandas
223-
matplotlib
224-
pillow
225-
pyQt5
226-
```
227-
228-
For anyone unfamiliar with using requirements files, or having issues with the libraries, these can also be installed manually in the terminal (we recommend a Python virtual environment) with:
229-
230-
```python
231-
pip install pyserial numpy pandas matplotlib pillow pyQt5
232229
```
233230

234-
`pyQt5` is used with`matplotlib` to draw the figures. It needs to be installed on Linux systems to follow the examples included in tinySA_python, but is not needed on all Windows machines.
235-
236-
237-
238-
239-
240-
241231
##Error Handling
242232

243233
Some error handling has been implemented for the individual functions in this library, but not for the device configuration. Most functions have a list of acceptable formats for input, which is included in the documentation and the`library_help` function. The`tinySA_help` function will get output from the current version of firmware running on the connected tinySA device.
@@ -258,6 +248,7 @@ Some error checking includes:
258248

259249
This library was developed on Windows and has been lightly tested on Linux. The main difference (so far) has been in the permissions for first access of the serial port, but there may be smaller bugs in format that have not been detected yet.
260250

251+
261252
###Finding the Serial Port
262253

263254
To start, a serial connection between the tinySA and user PC device must be created. There are several ways to list available serial ports. The library supports some rudimentary autodetection, but if that does not work instructions in this section also support manual detection.
@@ -271,9 +262,8 @@ The tinySA_python currently has some autodetection capabilities, but these are n
271262

272263
```python
273264

274-
# import tinySA library
275-
# (NOTE: check library path relative to script path)
276-
from src.tinySA_pythonimport tinySA
265+
# import tinySA_python (tsapython) package
266+
from tsapythonimport tinySA
277267

278268
# create a new tinySA object
279269
tsa= tinySA()
@@ -388,9 +378,8 @@ bytearray(b'deviceid 0\r')
388378

389379
```python
390380

391-
# import the library class for the tinySA
392-
# (NOTE: check library path relative to script path)
393-
from src.tinySA_pythonimport tinySA
381+
# import tinySA_python (tsapython) package
382+
from tsapythonimport tinySA
394383

395384
# create a new tinySA object
396385
tsa= tinySA()
@@ -481,9 +470,8 @@ This example shows several types of common data requests:
481470

482471
```python
483472

484-
# import the library class for the tinySA
485-
# (NOTE: check library path relative to script path)
486-
from src.tinySA_pythonimport tinySA
473+
# import tinySA_python (tsapython) package
474+
from tsapythonimport tinySA
487475

488476
# create a new tinySA object
489477
tsa= tinySA()
@@ -542,9 +530,9 @@ else:
542530

543531
```python
544532

545-
# importthe library class for the tinySA
546-
# (NOTE: check library path relative to script path)
547-
from src.tinySA_pythonimport tinySA
533+
# importtinySA_python (tsapython) package
534+
from tsapythonimport tinySA
535+
548536

549537
# imports FOR THE EXAMPLE
550538
import numpyas np
@@ -641,9 +629,9 @@ This example works because `data()` returns a trace, which is going to be the sa
641629

642630
```python
643631

644-
# importtinySA library
645-
# (NOTE: check library path relative to script path)
646-
from src.tinySA_pythonimport tinySA
632+
# importtinySA_python (tsapython) package
633+
from tsapythonimport tinySA
634+
647635

648636
# import matplotlib FOR THE EXAMPLE
649637
import matplotlib.pyplotas plt
@@ -715,9 +703,8 @@ This example uses `scan()` to take a data measurement of data that DOES NOT need
715703

716704
```python
717705

718-
# import tinySA library
719-
# (NOTE: check library path relative to script path)
720-
from src.tinySA_pythonimport tinySA
706+
# import tinySA_python (tsapython) package
707+
from tsapythonimport tinySA
721708

722709

723710
# imports FOR THE EXAMPLE
@@ -815,9 +802,8 @@ NOTE FOR LINUX USERS: the serial read with SCANRAW is finicky. It's also ONLY wi
815802

816803

817804
```python
818-
# import tinySA library
819-
# (NOTE: check library path relative to script path)
820-
from src.tinySA_pythonimport tinySA
805+
# import tinySA_python (tsapython) package
806+
from tsapythonimport tinySA
821807

822808

823809
# imports FOR THE EXAMPLE
@@ -960,9 +946,9 @@ The first part of this example is a static report of the measurements taken over
960946

961947

962948
```python
963-
# importtinySA library
964-
# (NOTE: check library path relative to script path)
965-
from src.tinySA_pythonimport tinySA
949+
# importtinySA_python (tsapython) package
950+
from tsapythonimport tinySA
951+
966952

967953
# imports FOR THE EXAMPLE
968954
import csv
@@ -1138,9 +1124,9 @@ else: # if port found and connected, then complete task(s) and disconnect
11381124
The second part of the example is a realtime waterfall plot with peak tracking and a sample of the last reading.
11391125

11401126
```python
1141-
# importtinySA library
1142-
# (NOTE: check library path relative to script path)
1143-
from src.tinySA_pythonimport tinySA
1127+
# importtinySA_python (tsapython) package
1128+
from tsapythonimport tinySA
1129+
11441130

11451131
# imports FOR THE EXAMPLE
11461132
import numpyas np
@@ -1434,9 +1420,8 @@ if __name__ == "__main__":
14341420

14351421
```python
14361422

1437-
# import tinySA library
1438-
# (NOTE: check library path relative to script path)
1439-
from src.tinySA_pythonimport tinySA
1423+
# import tinySA_python (tsapython) package
1424+
from tsapythonimport tinySA
14401425

14411426

14421427
# imports FOR THE EXAMPLE
@@ -1532,9 +1517,8 @@ else: # if port found and connected, then complete task(s) and disconnect
15321517
In some cases, this library may not cover all possible command versions, or new features might not be included yet. The tinySA can be accessed directly using the`command()` function. There is NO ERROR CHECKING on this function. It takes the full argument, just as if arguments were entered on the command line.
15331518

15341519
```python
1535-
# import tinySA library
1536-
# (NOTE: check library path relative to script path)
1537-
from src.tinySA_pythonimport tinySA
1520+
# import tinySA_python (tsapython) package
1521+
from tsapythonimport tinySA
15381522

15391523

15401524
# create a new tinySA object
@@ -1656,7 +1640,7 @@ Quick Link Table:
16561640
*`get_bulk_data()`
16571641
***CLI Wrapper Usage:**
16581642
***Notes:**
1659-
All numbers are binary coded 2 bytes little endian. The pixel data is encoded as 2 bytes per pixel. This is data returned by the device when in AUTO REFRESH mode. NOTE: may need to be paired with acontinious buffer read and dump, which will be tested in the next update
1643+
All numbers are binary coded 2 bytes little endian. The pixel data is encoded as 2 bytes per pixel. This is data returned by the device when in AUTO REFRESH mode. NOTE: may need to be paired with acontinuous buffer read and dump, which will be tested in the next update
16601644

16611645

16621646
###**calc**
@@ -1806,7 +1790,7 @@ Quick Link Table:
18061790
***CLI Wrapper Usage:**
18071791
***Notes:**
18081792
* NOTE: no frequency checking is done for this function yet.
1809-
* might be tinySA Ultraannd newer only.
1793+
* might be tinySA Ultraand newer only.
18101794
* Related to NORMAL, DIRECT, ADF, and MIXER
18111795
*[https://tinysa.org/wiki/pmwiki.php?n=TinySA4.OutputCurveEdit](https://tinysa.org/wiki/pmwiki.php?n=TinySA4.OutputCurveEdit)
18121796

@@ -2488,7 +2472,7 @@ Marker levels will use the selected unit Marker peak will activate the marker (i
24882472
* None, see direct library function calls
24892473
* it is also suggested to use the`command()` function to preform more complex actions because this is a complicated command structure
24902474
***CLI Wrapper Usage:**
2491-
***Notes:** For readability, this command was split into multiple functionsintitially rather than using complex alias functions. There is a mismatch of information of commands between versions, so this library uses the documentation returned by the device.
2475+
***Notes:** For readability, this command was split into multiple functionsinitially rather than using complex alias functions. There is a mismatch of information of commands between versions, so this library uses the documentation returned by the device.
24922476
*`select_trace()`: tinySA Ultra has 4 traces to choose from. Other devices may have other numbers of traces.
24932477
*`trace_reflevel(...)` : adjusts the reference level of a trace. Levels are specified in dB(m) and can be specified using a floating point notation. E.g. 10 or 2.5[https://tinysa.org/wiki/pmwiki.php?n=Main.USBInterface](https://tinysa.org/wiki/pmwiki.php?n=Main.USBInterface)
24942478

@@ -2766,6 +2750,13 @@ This library is updated in spurts. June-August are going to be the most active d
27662750

27672751
* Python Packaging and Library Setup:
27682752
*[https://packaging.python.org/en/latest/tutorials/packaging-projects/](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
2753+
*[https://www.sarahglasmacher.com/how-to-build-python-package-uv/](https://www.sarahglasmacher.com/how-to-build-python-package-uv/)
2754+
2755+
2756+
##Acknowledgments and Contributions
2757+
2758+
2759+
27692760

27702761

27712762
##Licensing

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp