added note on OO interface

This commit is contained in:
2021-04-06 18:08:40 +02:00
parent 31691f22c3
commit d7775324f5

View File

@ -15,7 +15,7 @@ A manager/runner of scripts:
A trivially easy to use softIOC:
- Uses `pcaspy` (in a slightly unintended way).
- Uses [`pcaspy`](https://github.com/paulscherrerinstitute/pcaspy/) (in a slightly unintended way).
- `serve` (output) PVs and `host` (input) PVs:
```python
@ -41,3 +41,23 @@ with MorIOC("mtest") as mor:
- PV's data type is inferred from the value.
- Currently supports Python scalars (int, float, str), sequences (lists, tuples, etc.) as well as numpy arrays and scalars.
- Alternatively, an object-oriented interface exists:
```python
with MorIOC("mtest") as mor:
pvo = mor.PV("chan-PV-out") # creates MTEST:CHAN-PV-OUT
pvi = mor.PV("chan-PV-in") # creates MTEST:CHAN-PV-IN
img = mor.Image("chan-Image")
# creates MTEST:CHAN-IMAGE:FPICTURE, :WIDTH, :HEIGHT
while True:
val = random()
pvo.put(val)
val = pvi.get()
print(val)
val = np.random.random(200).reshape(10, 20)
img.put(val)
```