added note on OO interface
This commit is contained in:
24
README.md
24
README.md
@ -15,7 +15,7 @@ A manager/runner of scripts:
|
|||||||
|
|
||||||
A trivially easy to use softIOC:
|
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:
|
- `serve` (output) PVs and `host` (input) PVs:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@ -40,4 +40,24 @@ with MorIOC("mtest") as mor:
|
|||||||
```
|
```
|
||||||
|
|
||||||
- PV's data type is inferred from the value.
|
- 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.
|
- 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)
|
||||||
|
```
|
Reference in New Issue
Block a user