Skip to content

Commit 736b04d

Browse files
authored
README.md: Move example content into examples/README.md (#227)
* README.md: Move example content into examples/README.md Signed-off-by: Brad Keryan <brad.keryan@ni.com> * examples: Add a note about install_examples.py * README.md: Update "note" boxes * README.md: Rewrite static registration section * README.md: Paul's feedback --------- Signed-off-by: Brad Keryan <brad.keryan@ni.com>
1 parent 0ef6f3c commit 736b04d

2 files changed

Lines changed: 66 additions & 49 deletions

File tree

README.md

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
- [Abbreviations](#abbreviations)
66
- [Dependencies](#dependencies)
77
- [Examples](#examples)
8-
- [Setting up the Example Measurements](#setting-up-the-example-measurements)
9-
- [Executing the Example Measurements](#executing-the-example-measurements)
108
- [Developing Measurements: Quick Start](#developing-measurements-quick-start)
119
- [Installation](#installation)
1210
- [Developing a minimal python measurement](#developing-a-minimal-python-measurement)
@@ -55,48 +53,7 @@ There are three ways to do this:
5553

5654
## Examples
5755

58-
The `examples` directory contains the following example projects:
59-
60-
- `sample_measurement`: Performs a loopback measurement with various data types. Provides a Measurement UI and a LabVIEW UI.
61-
- `nidaqmx_analog_input`: Performs a finite analog input measurement with NI-DAQmx.
62-
- `nidcpower_source_dc_voltage`: Sources and measures a DC voltage with an NI SMU. Provides a Measurement UI and a LabVIEW UI.
63-
- `nidmm_measurement`: Performs a measurement using an NI DMM.
64-
- `nifgen_standard_function`: Generates a standard function waveform using an NI waveform generator.
65-
- `niscope_acquire_waveform`: Acquires a waveform using an NI oscilloscope.
66-
- `niswitch_control_relays`: Controls relays using an NI relay driver (e.g. PXI-2567).
67-
- `nivisa_dmm_measurement`: Performs a DMM measurement using NI-VISA and an NI Instrument Simulator v2.0.
68-
69-
For more details about a specific example, see the `README.md` file included with the example.
70-
71-
### Setting up the Example Measurements
72-
73-
The example measurements shared are *poetry-based* projects. Follow the below steps to for setting up the example measurement:
74-
75-
1. Install `poetry`. Refer to <https://python-poetry.org/docs/#installation> for information on installing poetry.
76-
77-
2. Open a command prompt, and change the working directory to the directory of the example measurement you want to work with.
78-
79-
``` cmd
80-
cd <path_of_example_measurement>
81-
REM Example: cd "..\measurementlink-python\examples\dc_measurement"
82-
```
83-
84-
3. Run `poetry install`. This command creates/updates the .venv and installs all the dependencies(including `ni-measurementlink-service` package) needed for the Example into `.venv`
85-
86-
``` cmd
87-
poetry install
88-
```
89-
- If you get a "command not found" error during `poetry install`, make sure that you added the Poetry path to the system path. Refer to [https://python-poetry.org/docs/#installing-with-the-official-installer/Add-poetry-to-your-path](https://python-poetry.org/docs/#installing-with-the-official-installer:~:text=Add%20Poetry%20to%20your%20PATH)
90-
![PoetryInstallFail](PoetryInstallFail.png)
91-
92-
### Executing the Example Measurements
93-
94-
1. Start the discovery service if not already started.
95-
2. Use `poetry run` to run the measurement service:
96-
97-
``` cmd
98-
poetry run python measurement.py
99-
```
56+
The [`examples`](https://github.com/ni/measurementlink-python/tree/main/examples/) directory contains example measurement services. See the [README.md](https://github.com/ni/measurementlink-python/tree/main/examples/README.md) file for more information.
10057

10158
---
10259

@@ -210,11 +167,17 @@ pip install ni-measurementlink-generator
210167

211168
## Static Registration of Python Measurements
212169

213-
Refer to the [Static Registration of measurements section]() for the detailed steps needed to statically register a measurement.
170+
The MeasurementLink discovery service provides a registry of other services, and can discover and activate other services on the system. These features allow the discovery service to distinguish, manage, and describe measurement services on the system.
171+
172+
To statically register a measurement service with the MeasurementLink discovery service, do the following:
173+
174+
1. Create a [startup batch file](#create-a-batch-file-that-runs-a-python-measurement) or [executable](#create-executable-for-python-scripts) for the measurement service.
214175

215-
To Statically register the examples provided, the user can copy the example directory with the service config file with the startup batch file, to the search paths and follow the [Setting up the Example Measurements](#setting-up-the-example-measurements) section to set up the measurements.
176+
2. Edit the measurement service's `.serviceconfig` file and set the `path` value to the filename of the startup batch file or executable.
216177

217-
Note: The startup batch file can be modified accordingly if the user wants to run with a custom python distribution or virtual environment
178+
3. Copy the measurement service's directory (including the `.venv` subdirectory if present, `.serviceconfig` file, and startup batch file) to a subdirectory of `C:\ProgramData\National Instruments\MeasurementLink\Services`.
179+
180+
Once your measurement service is statically registered, the MeasurementLink discovery service makes it visible in supported NI applications.
218181

219182
### Create a batch file that runs a python measurement
220183

@@ -280,8 +243,6 @@ Measurement and its related files can be maintained as a python package. The bas
280243

281244
Python communities have different ways of managing a python package and its dependencies. It is up to the measurement developer, on how they wanted to maintain the package and dependencies. Measurement developers can choose from a few common approaches discussed below based on their requirements.
282245

283-
Note: Once we have the template support for Python measurement, the approach to managing the python measurement package(project) will be streamlined and simplified.
284-
285246
### Create and Manage Python Measurement Package using poetry
286247

287248
1. Setting up Poetry(One-time setup)

examples/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
# Example Measurements
3+
4+
This directory contains the following example projects:
5+
6+
- `sample_measurement`: Performs a loopback measurement with various data types. Provides a Measurement UI and a LabVIEW UI.
7+
- `nidaqmx_analog_input`: Performs a finite analog input measurement with NI-DAQmx.
8+
- `nidcpower_source_dc_voltage`: Sources and measures a DC voltage with an NI SMU. Provides a Measurement UI and a LabVIEW UI.
9+
- `nidmm_measurement`: Performs a measurement using an NI DMM.
10+
- `nifgen_standard_function`: Generates a standard function waveform using an NI waveform generator.
11+
- `niscope_acquire_waveform`: Acquires a waveform using an NI oscilloscope.
12+
- `niswitch_control_relays`: Controls relays using an NI relay driver (e.g. PXI-2567).
13+
- `nivisa_dmm_measurement`: Performs a DMM measurement using NI-VISA and an NI Instrument Simulator v2.0.
14+
15+
For more details about a specific example, see the `README.md` file included with the example.
16+
17+
### Setting up the Example Measurements
18+
19+
The example measurements are *Poetry-based* projects. Follow the steps below to set up an example measurement:
20+
21+
1. Install `poetry`. Refer to <https://python-poetry.org/docs/#installation> for information on installing poetry.
22+
23+
2. Open a command prompt and change the working directory to the directory of the example measurement you want to work with.
24+
25+
``` cmd
26+
cd <path_of_example_measurement>
27+
REM Example: cd "..\measurementlink-python\examples\dc_measurement"
28+
```
29+
30+
3. Run `poetry install`. This command creates/updates the virtual environment (`.venv`) and installs the needed dependencies (including `ni-measurementlink-service` package) into the virtual environment.
31+
32+
``` cmd
33+
poetry install
34+
```
35+
- If you get a "command not found" error during `poetry install`, make sure that you added the Poetry path to the system path. Refer to [https://python-poetry.org/docs/#installing-with-the-official-installer/Add-poetry-to-your-path](https://python-poetry.org/docs/#installing-with-the-official-installer:~:text=Add%20Poetry%20to%20your%20PATH)
36+
![PoetryInstallFail](../PoetryInstallFail.png)
37+
38+
### Executing the Example Measurements
39+
40+
1. Start the discovery service if not already started.
41+
2. Use `poetry run` to run the measurement service:
42+
43+
``` cmd
44+
poetry run python measurement.py
45+
```
46+
47+
### Static Registration of Example Measurements
48+
49+
To statically register an example measurement service with the MeasurementLink discovery service, do the following:
50+
51+
1. Copy the example measurement's directory (including the `.venv` subdirectory, `.serviceconfig` file, and startup batch file) to a subdirectory of `C:\ProgramData\National Instruments\MeasurementLink\Services`.
52+
53+
Once the example measurement service is statically registered, the MeasurementLink discovery service makes it visible in supported NI applications.
54+
55+
> **Note**
56+
> To set up and statically register all of the example measurements, run [`install_examples.py`](../scripts/install_examples.py).

0 commit comments

Comments
 (0)