epicsdev 3.3.0__tar.gz → 3.3.3__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.
- epicsdev-3.3.3/LICENSE +28 -0
- epicsdev-3.3.3/PKG-INFO +87 -0
- epicsdev-3.3.3/README.md +71 -0
- epicsdev-3.3.0/fallback/multiadc_pp.py → epicsdev-3.3.3/config/epicsdev_pp.py +28 -41
- epicsdev-3.3.0/config/epicsdev_pp.py → epicsdev-3.3.3/config/multiadc_pp.py +27 -32
- epicsdev-3.3.3/docs/generate_opi.md +15 -0
- epicsdev-3.3.3/docs/generate_opi.py +76 -0
- epicsdev-3.3.3/docs/generate_server.md +43 -0
- epicsdev-3.3.3/docs/template.py +117 -0
- {epicsdev-3.3.0 → epicsdev-3.3.3}/epicsdev/epicsdev.py +19 -13
- {epicsdev-3.3.0 → epicsdev-3.3.3}/epicsdev/imagegen.py +4 -3
- epicsdev-3.3.3/epicsdev/multiadc.py +177 -0
- {epicsdev-3.3.0/new → epicsdev-3.3.3}/pyproject.toml +7 -7
- epicsdev-3.3.0/.github/copilot-instructions.md +0 -24
- epicsdev-3.3.0/LICENSE +0 -21
- epicsdev-3.3.0/PKG-INFO +0 -267
- epicsdev-3.3.0/config/epicsSimscope_pp.py +0 -112
- epicsdev-3.3.0/config/epicsdev.bob +0 -267
- epicsdev-3.3.0/docs/epicsdev_pvplot.jpg +0 -0
- epicsdev-3.3.0/docs/epicsdev_pypet.png +0 -0
- epicsdev-3.3.0/docs/imagegen.jpg +0 -0
- epicsdev-3.3.0/docs/modules.md +0 -57
- epicsdev-3.3.0/docs/phoebus_epicsdev.jpg +0 -0
- epicsdev-3.3.0/docs/using_imagegen.md +0 -50
- epicsdev-3.3.0/examples/ai_imagegen.py +0 -205
- epicsdev-3.3.0/examples/mini_beamline_caproto.py +0 -286
- epicsdev-3.3.0/examples/ndarray_server.py +0 -27
- epicsdev-3.3.0/examples/ntndarray_server.py +0 -19
- epicsdev-3.3.0/examples/process_external_waveform.py +0 -21
- epicsdev-3.3.0/fallback/epicsdev-300.py +0 -498
- epicsdev-3.3.0/fallback/multiadc-v311.py +0 -183
- epicsdev-3.3.0/fallback/multiadc.py +0 -151
- epicsdev-3.3.0/fallback/multiadc1_pp.py +0 -6
- epicsdev-3.3.0/new/README.md +0 -133
- epicsdev-3.3.0/new/epicsdev.py +0 -638
- epicsdev-3.3.0/new/multiadc.py +0 -183
- epicsdev-3.3.0/prompts/image_initial +0 -12
- epicsdev-3.3.0/prompts/prompt_epics_development_with_python +0 -9
- epicsdev-3.3.0/pyproject.toml +0 -25
- {epicsdev-3.3.0 → epicsdev-3.3.3/epicsdev}/README.md +0 -0
- {epicsdev-3.3.0 → epicsdev-3.3.3}/epicsdev/__init__.py +0 -0
- {epicsdev-3.3.0 → epicsdev-3.3.3}/epicsdev/putlog.py +0 -0
epicsdev-3.3.3/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Electron-Ion Collider
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
epicsdev-3.3.3/PKG-INFO
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: epicsdev
|
|
3
|
+
Version: 3.3.3
|
|
4
|
+
Summary: Helper module for creating EPICS PVAccess servers using p4p
|
|
5
|
+
Project-URL: Homepage, https://github.com/eicorg/epicsdev
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/eicorg/epicsdev
|
|
7
|
+
Author-email: Andrey Sukhanov <sukhanov@bnl.gov>
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Requires-Dist: p4p>=4.2.2
|
|
14
|
+
Requires-Dist: psutil
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# epicsdev
|
|
18
|
+
|
|
19
|
+
`epicsdev` is a Python framework designed for rapidly developing EPICS PVAccess servers utilizing the [p4p](https://github.com/epics-base/p4p) library.
|
|
20
|
+
|
|
21
|
+
Device Process Variables (PVs) are defined using a highly compact format:
|
|
22
|
+
```python
|
|
23
|
+
[name, description, initial_value, attributes]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Device-specific logic resides within a small, well-structured Python file following a predictable pattern. Given an instrument programming manual, an LLM assistant (such as GitHub Copilot) can easily leverage this pattern to spin up initial support for new hardware in under an hour.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Key Features
|
|
31
|
+
|
|
32
|
+
* **Built-in Services:** Out-of-the-box support for autosave/restore, IocStats, heartbeat monitoring, and PV-put logging.
|
|
33
|
+
* **Rapid Prototyping:** Simple, declarative tuple structure for PV definitions.
|
|
34
|
+
* **LLM-Friendly:** Highly predictable boilerplate that allows AI code assistants to write drivers effortlessly.
|
|
35
|
+
* **OPI Integration:** Automated operator interface generation for Phoebus.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Getting Started
|
|
40
|
+
|
|
41
|
+
### 1. Generate a PVAccess Server
|
|
42
|
+
Follow the [Detailed Server Generation Guide](docs/generate_server.md) to bootstrap a functional PVAccess server supporting your instrument's core functions.
|
|
43
|
+
|
|
44
|
+
### 2. Generate an OPI Display
|
|
45
|
+
You can automatically create an Operator Interface (OPI) layout using [phoebusgen](https://als-epics.github.io/phoebusgen/). See the [OPI Generation Instructions](docs/generate_opi.md) for details.
|
|
46
|
+
|
|
47
|
+
### 3. Quick Test (Simulation Mode)
|
|
48
|
+
To see the framework in action without physical hardware, you can launch a simulated multi-channel waveform generator, which can be useful for stress-testing of EPICS installations. The following command generates 100 noisy waveforms (1,000 points each) alongside 300 scalar parameters:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m epicsdev.multiadc -C 100 -n 1000
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Other examples to run: single waveform generator and multi-peak image generator
|
|
55
|
+
```bash
|
|
56
|
+
python -m epicsdev.epicsdev
|
|
57
|
+
python -m epicsdev.imagegen
|
|
58
|
+
```
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## List of fully functional PVAccess servers, developed using epicsdev
|
|
62
|
+
|
|
63
|
+
Power Supplies
|
|
64
|
+
* [CAEN FAST-PS](https://github.com/eicorg/epicsdev_ps_caen_fastps)
|
|
65
|
+
* [CAEN EASY-DRIVER](https://github.com/eicorg/epicsdev_ps_caen_easydriver)
|
|
66
|
+
|
|
67
|
+
Oscilloscopes
|
|
68
|
+
* [Keysight (Agilent) DSO-X series](https://github.com/eicorg/epicsdev_osc_keysight_dsox)
|
|
69
|
+
* [Rigol DHO series](https://github.com/eicorg/epicsdev_osc_rigol)
|
|
70
|
+
* [Tektronix MSO and DPO series](https://github.com/eicorg/epicsdev_osc_tektronix_mso)
|
|
71
|
+
* [LeCroy WaveRunner series](https://github.com/eicorg/epicsdev_osc_lecroy_waverunner)
|
|
72
|
+
|
|
73
|
+
Signal Generators
|
|
74
|
+
* [Siglent SDG series](https://github.com/eicorg/epicsdev_siggen_siglent_sdg)
|
|
75
|
+
* [Keysight 33000 series](https://github.com/eicorg/epicsdev_siggen_keysight_33000)
|
|
76
|
+
|
|
77
|
+
Data Acquisition instruments
|
|
78
|
+
* [CAEN DT5202](https://github.com/eicorg/epicsdev_daq_caen_dt5202)
|
|
79
|
+
* [LabJack U3](https://github.com/eicorg/epicsdev_daq_labjack_u3)
|
|
80
|
+
|
|
81
|
+
Magnetometers
|
|
82
|
+
* [Lake Shore Model 421](https://github.com/eicorg/epicsdev_magn_lakeshore)
|
|
83
|
+
* [Caylar NMR20](https://github.com/eicorg/epicsdev_magn_caylar_nmr)
|
|
84
|
+
|
|
85
|
+
Simulation Utilities
|
|
86
|
+
* [Multi-channel Waveform Generator](https://github.com/eicorg/epicsdev/blob/main/epicsdev/multiadc.py)
|
|
87
|
+
* [Multi-peak Image Generator](https://github.com/eicorg/epicsdev/blob/main/epicsdev/imagegen.py)
|
epicsdev-3.3.3/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# epicsdev
|
|
2
|
+
|
|
3
|
+
`epicsdev` is a Python framework designed for rapidly developing EPICS PVAccess servers utilizing the [p4p](https://github.com/epics-base/p4p) library.
|
|
4
|
+
|
|
5
|
+
Device Process Variables (PVs) are defined using a highly compact format:
|
|
6
|
+
```python
|
|
7
|
+
[name, description, initial_value, attributes]
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Device-specific logic resides within a small, well-structured Python file following a predictable pattern. Given an instrument programming manual, an LLM assistant (such as GitHub Copilot) can easily leverage this pattern to spin up initial support for new hardware in under an hour.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Key Features
|
|
15
|
+
|
|
16
|
+
* **Built-in Services:** Out-of-the-box support for autosave/restore, IocStats, heartbeat monitoring, and PV-put logging.
|
|
17
|
+
* **Rapid Prototyping:** Simple, declarative tuple structure for PV definitions.
|
|
18
|
+
* **LLM-Friendly:** Highly predictable boilerplate that allows AI code assistants to write drivers effortlessly.
|
|
19
|
+
* **OPI Integration:** Automated operator interface generation for Phoebus.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Getting Started
|
|
24
|
+
|
|
25
|
+
### 1. Generate a PVAccess Server
|
|
26
|
+
Follow the [Detailed Server Generation Guide](docs/generate_server.md) to bootstrap a functional PVAccess server supporting your instrument's core functions.
|
|
27
|
+
|
|
28
|
+
### 2. Generate an OPI Display
|
|
29
|
+
You can automatically create an Operator Interface (OPI) layout using [phoebusgen](https://als-epics.github.io/phoebusgen/). See the [OPI Generation Instructions](docs/generate_opi.md) for details.
|
|
30
|
+
|
|
31
|
+
### 3. Quick Test (Simulation Mode)
|
|
32
|
+
To see the framework in action without physical hardware, you can launch a simulated multi-channel waveform generator, which can be useful for stress-testing of EPICS installations. The following command generates 100 noisy waveforms (1,000 points each) alongside 300 scalar parameters:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python -m epicsdev.multiadc -C 100 -n 1000
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Other examples to run: single waveform generator and multi-peak image generator
|
|
39
|
+
```bash
|
|
40
|
+
python -m epicsdev.epicsdev
|
|
41
|
+
python -m epicsdev.imagegen
|
|
42
|
+
```
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## List of fully functional PVAccess servers, developed using epicsdev
|
|
46
|
+
|
|
47
|
+
Power Supplies
|
|
48
|
+
* [CAEN FAST-PS](https://github.com/eicorg/epicsdev_ps_caen_fastps)
|
|
49
|
+
* [CAEN EASY-DRIVER](https://github.com/eicorg/epicsdev_ps_caen_easydriver)
|
|
50
|
+
|
|
51
|
+
Oscilloscopes
|
|
52
|
+
* [Keysight (Agilent) DSO-X series](https://github.com/eicorg/epicsdev_osc_keysight_dsox)
|
|
53
|
+
* [Rigol DHO series](https://github.com/eicorg/epicsdev_osc_rigol)
|
|
54
|
+
* [Tektronix MSO and DPO series](https://github.com/eicorg/epicsdev_osc_tektronix_mso)
|
|
55
|
+
* [LeCroy WaveRunner series](https://github.com/eicorg/epicsdev_osc_lecroy_waverunner)
|
|
56
|
+
|
|
57
|
+
Signal Generators
|
|
58
|
+
* [Siglent SDG series](https://github.com/eicorg/epicsdev_siggen_siglent_sdg)
|
|
59
|
+
* [Keysight 33000 series](https://github.com/eicorg/epicsdev_siggen_keysight_33000)
|
|
60
|
+
|
|
61
|
+
Data Acquisition instruments
|
|
62
|
+
* [CAEN DT5202](https://github.com/eicorg/epicsdev_daq_caen_dt5202)
|
|
63
|
+
* [LabJack U3](https://github.com/eicorg/epicsdev_daq_labjack_u3)
|
|
64
|
+
|
|
65
|
+
Magnetometers
|
|
66
|
+
* [Lake Shore Model 421](https://github.com/eicorg/epicsdev_magn_lakeshore)
|
|
67
|
+
* [Caylar NMR20](https://github.com/eicorg/epicsdev_magn_caylar_nmr)
|
|
68
|
+
|
|
69
|
+
Simulation Utilities
|
|
70
|
+
* [Multi-channel Waveform Generator](https://github.com/eicorg/epicsdev/blob/main/epicsdev/multiadc.py)
|
|
71
|
+
* [Multi-peak Image Generator](https://github.com/eicorg/epicsdev/blob/main/epicsdev/imagegen.py)
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"""Pypet page for epicdev.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
__version__ = 'v0.1.0 2026-01-31'#
|
|
6
|
-
|
|
7
|
-
import os
|
|
1
|
+
"""Pypet page for epicdev.epicsdev module"""
|
|
2
|
+
# format: pypeto 1.2+
|
|
3
|
+
__version__ = 'v0.0.1 2026-01-16'#
|
|
4
|
+
print(f'epicsScope {__version__}')
|
|
8
5
|
|
|
9
6
|
#``````````````````Definitions````````````````````````````````````````````````
|
|
10
7
|
# python expressions and functions, used in the spreadsheet
|
|
@@ -18,30 +15,31 @@ def slider(minValue,maxValue):
|
|
|
18
15
|
return {'widget':'hslider','opLimits':[minValue,maxValue],'span':[2,1]}
|
|
19
16
|
|
|
20
17
|
LargeFont = {'color':'light gray', **font(18), 'fgColor':'dark green'}
|
|
21
|
-
ButtonFont = {'font':['Open Sans
|
|
18
|
+
ButtonFont = {'font':['Open Sans Extrabold',14]}# Comic Sans MS
|
|
22
19
|
LYRow = {'ATTRIBUTES':{'color':'light yellow'}}
|
|
23
20
|
lColor = color('lightGreen')
|
|
24
|
-
PyPath = 'python -m'
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
# definition for plotting cell
|
|
23
|
+
PyPath = 'python -m'
|
|
24
|
+
PaneP2P = ' '.join([f'ch{i+1:01d}Mean ch{i+1:01d}Peak2Peak' for i in range(1)])
|
|
25
|
+
PaneWF = ' '.join([f'ch{i+1:01d}Waveform' for i in range(1)])
|
|
26
|
+
#PaneT = 'timing[1] timing[3]'
|
|
27
|
+
Plot = {'Plot':{'launch':
|
|
28
|
+
f'{PyPath} pvplot Y-5:5 -aV:epicsDev0: -#0"{PaneP2P}" -#1"{PaneWF}"',# -#2"{PaneT}"',
|
|
29
|
+
**lColor, **ButtonFont}}
|
|
30
|
+
print(f'Plot command: {Plot}')
|
|
31
|
+
#``````````````````PyPage Object``````````````````````````````````````````````
|
|
32
32
|
class PyPage():
|
|
33
|
-
def __init__(self, instance=
|
|
34
|
-
title=
|
|
33
|
+
def __init__(self, instance='epicsDev0:',
|
|
34
|
+
title="Simulated oscilloscope", channels=1):
|
|
35
35
|
"""instance: unique name of the page.
|
|
36
36
|
For EPICS it is usually device prefix
|
|
37
37
|
"""
|
|
38
|
-
if instance is None:
|
|
39
|
-
instance = Instance
|
|
40
38
|
print(f'Instantiating Page {instance,title} with {channels} channels')
|
|
41
39
|
|
|
42
40
|
#``````````Mandatory class members starts here````````````````````````
|
|
43
41
|
self.namespace = 'PVA'
|
|
44
|
-
self.title = title
|
|
42
|
+
self.title = title
|
|
45
43
|
|
|
46
44
|
#``````````Page attributes, optional`````````````````````````
|
|
47
45
|
self.page = {**color(240,240,240)}
|
|
@@ -51,9 +49,9 @@ class PyPage():
|
|
|
51
49
|
self.columns = {
|
|
52
50
|
1: {'width': 120, 'justify': 'right'},
|
|
53
51
|
2: {'width': 80},
|
|
54
|
-
3: {'width': 80
|
|
52
|
+
3: {'width': 80},
|
|
55
53
|
4: {'width': 80},
|
|
56
|
-
5: {'width': 80
|
|
54
|
+
5: {'width': 80},
|
|
57
55
|
6: {'width': 80},
|
|
58
56
|
7: {'width': 80},
|
|
59
57
|
8: {'width': 80},
|
|
@@ -71,29 +69,18 @@ string or device:parameter and the value is dictionary of the features.
|
|
|
71
69
|
|
|
72
70
|
#``````````Abbreviations, used in cell definitions
|
|
73
71
|
def ChLine(suffix):
|
|
74
|
-
return [f'{D}
|
|
75
|
-
|
|
76
|
-
PaneWF = ' '.join([f'c{i+1:02d}Waveform' for i in range(channels)])
|
|
77
|
-
#PaneT = 'timing[1] timing[3]'
|
|
78
|
-
Plot = {'Plot Channels':{'launch':
|
|
79
|
-
f'{PyPath} pvplot Y-5:5 -aV:{instance} -#0"{PaneP2P}" -#1"{PaneWF}"',# -#2"{PaneT}"',
|
|
80
|
-
**lColor, **ButtonFont}}
|
|
81
|
-
print(f'Plot button: {Plot}')
|
|
82
|
-
Timing = {'Plot':{'launch':f'{PyPath} pvplot -aV:{instance}timing "[0] [1] [2]"', **lColor}}
|
|
83
|
-
print(f'Timing button: {Timing}')
|
|
72
|
+
return [f'{D}ch{ch+1:01d}{suffix}' for ch in range(channels)]
|
|
73
|
+
#FOption = ' -file '+logreqMap.get(D,'')
|
|
84
74
|
#``````````mandatory member```````````````````````````````````````````
|
|
85
75
|
self.rows = [
|
|
86
|
-
['Device:',
|
|
76
|
+
['Device:', D, {D+'version':span(2,1)},_,_,_,_],
|
|
77
|
+
['State:', D+'server','cycle:',D+'cycle',_,_,Plot], # 'Recall:', D+'setup',],
|
|
87
78
|
['Status:', {D+'status': span(8,1)}],
|
|
88
|
-
['
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Plot,'CH1','CH2','CH3','CH4','CH5','CH6'],
|
|
79
|
+
['Polling Interval:', D+'polling','nPoints:',D+'recordLength',
|
|
80
|
+
'Noise:',D+'noiseLevel',_],
|
|
81
|
+
[{'ATTRIBUTES':color('lightCyan')},
|
|
82
|
+
'Channels:','CH1','CH2','CH3','CH4','CH5','CH6'],
|
|
93
83
|
['V/div:']+ChLine('VoltsPerDiv'),
|
|
94
|
-
['VoltOffset:']+ChLine('VoltOffset'),
|
|
95
84
|
['Mean:']+ChLine('Mean'),
|
|
96
85
|
['Peak2Peak:']+ChLine('Peak2Peak'),
|
|
97
|
-
#['Waveform:']+ChLine('Waveform'),
|
|
98
|
-
['Timing:',{D+'timing':span(3,1)}],
|
|
99
86
|
]
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
"""Pypet page for epicdev.epicsdev
|
|
2
|
-
"""
|
|
1
|
+
"""Pypet page for epicdev.epicsdev module"""
|
|
3
2
|
# pylint: disable=invalid-name
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
# format: pypeto 1.2+
|
|
4
|
+
__version__ = 'v0.0.2 2026-01-28'# corrected the Plot action
|
|
5
|
+
print(f'multiadc {__version__}')
|
|
7
6
|
|
|
8
7
|
#``````````````````Definitions````````````````````````````````````````````````
|
|
9
8
|
# python expressions and functions, used in the spreadsheet
|
|
@@ -20,27 +19,28 @@ LargeFont = {'color':'light gray', **font(18), 'fgColor':'dark green'}
|
|
|
20
19
|
ButtonFont = {'font':['Open Sans Extrabold',14]}# Comic Sans MS
|
|
21
20
|
LYRow = {'ATTRIBUTES':{'color':'light yellow'}}
|
|
22
21
|
lColor = color('lightGreen')
|
|
23
|
-
PyPath = 'python -m'
|
|
24
|
-
|
|
25
|
-
try:
|
|
26
|
-
Instance = f"epicsDev{os.environ['EPICSDEV']}:"
|
|
27
|
-
except KeyError:
|
|
28
|
-
Instance = 'epicsDev0:'
|
|
29
22
|
|
|
23
|
+
# definition for plotting cell
|
|
24
|
+
PyPath = 'python -m'
|
|
25
|
+
PaneP2P = ' '.join([f'c{i+1:02d}Mean c{i+1:02d}Peak2Peak' for i in range(1)])
|
|
26
|
+
PaneWF = ' '.join([f'c{i+1:02d}Waveform' for i in range(1)])
|
|
27
|
+
#PaneT = 'timing[1] timing[3]'
|
|
28
|
+
Plot = {'Plot':{'launch':
|
|
29
|
+
f'{PyPath} pvplot Y-5:5 -aV:multiadc0: -#0"{PaneP2P}" -#1"{PaneWF}"',# -#2"{PaneT}"',
|
|
30
|
+
**lColor, **ButtonFont}}
|
|
31
|
+
print(f'Plot command: {Plot}')
|
|
30
32
|
#``````````````````PyPage Object``````````````````````````````````````````````
|
|
31
33
|
class PyPage():
|
|
32
|
-
def __init__(self, instance=
|
|
33
|
-
title="
|
|
34
|
+
def __init__(self, instance='multiadc0:',
|
|
35
|
+
title="Simulated oscilloscope", channels=6):
|
|
34
36
|
"""instance: unique name of the page.
|
|
35
37
|
For EPICS it is usually device prefix
|
|
36
38
|
"""
|
|
37
|
-
if instance is None:
|
|
38
|
-
instance = Instance
|
|
39
39
|
print(f'Instantiating Page {instance,title} with {channels} channels')
|
|
40
40
|
|
|
41
41
|
#``````````Mandatory class members starts here````````````````````````
|
|
42
42
|
self.namespace = 'PVA'
|
|
43
|
-
self.title =
|
|
43
|
+
self.title = title
|
|
44
44
|
|
|
45
45
|
#``````````Page attributes, optional`````````````````````````
|
|
46
46
|
self.page = {**color(240,240,240)}
|
|
@@ -50,9 +50,9 @@ class PyPage():
|
|
|
50
50
|
self.columns = {
|
|
51
51
|
1: {'width': 120, 'justify': 'right'},
|
|
52
52
|
2: {'width': 80},
|
|
53
|
-
3: {'width': 80
|
|
53
|
+
3: {'width': 80},
|
|
54
54
|
4: {'width': 80},
|
|
55
|
-
5: {'width': 80
|
|
55
|
+
5: {'width': 80},
|
|
56
56
|
6: {'width': 80},
|
|
57
57
|
7: {'width': 80},
|
|
58
58
|
8: {'width': 80},
|
|
@@ -71,23 +71,18 @@ string or device:parameter and the value is dictionary of the features.
|
|
|
71
71
|
#``````````Abbreviations, used in cell definitions
|
|
72
72
|
def ChLine(suffix):
|
|
73
73
|
return [f'{D}c{ch+1:02d}{suffix}' for ch in range(channels)]
|
|
74
|
-
|
|
75
|
-
PaneWF = ' '.join([f'c{i+1:02d}Waveform' for i in range(channels)])
|
|
76
|
-
#PaneT = 'timing[1] timing[3]'
|
|
77
|
-
Plot = {'Plot':{'launch':
|
|
78
|
-
f'{PyPath} pvplot Y-5:5 -aV:{instance} -#0"{PaneP2P}" -#1"{PaneWF}"',# -#2"{PaneT}"',
|
|
79
|
-
**lColor, **ButtonFont}}
|
|
80
|
-
print(f'Plot command: {Plot}')
|
|
74
|
+
#FOption = ' -file '+logreqMap.get(D,'')
|
|
81
75
|
#``````````mandatory member```````````````````````````````````````````
|
|
82
76
|
self.rows = [
|
|
83
|
-
['Device:',
|
|
77
|
+
['Device:', D, {D+'version':span(2,1)},_,_,_,_],
|
|
78
|
+
['State:', D+'server','cycle:',D+'cycle',_,_,Plot], # 'Recall:', D+'setup',],
|
|
84
79
|
['Status:', {D+'status': span(8,1)}],
|
|
85
|
-
['
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
'Channels:', 'CH1', 'CH2', 'CH3', 'CH4', 'CH5', 'CH6'],
|
|
80
|
+
['Polling Interval:', D+'polling','nPoints:',D+'recordLength',
|
|
81
|
+
'Noise:',D+'noiseLevel',_],
|
|
82
|
+
[{'ATTRIBUTES':color('lightCyan')},
|
|
83
|
+
'Channels:','CH1','CH2','CH3','CH4','CH5','CH6'],
|
|
90
84
|
['V/div:']+ChLine('VoltsPerDiv'),
|
|
91
85
|
['Mean:']+ChLine('Mean'),
|
|
92
86
|
['Peak2Peak:']+ChLine('Peak2Peak'),
|
|
93
|
-
|
|
87
|
+
['Waveform:']+ChLine('Waveform'),
|
|
88
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## Generate the Operator Interface (OPI)
|
|
2
|
+
|
|
3
|
+
Copy this [OPI generator template](https://github.com/eicorg/epicsdev/blob/main/docs/generate_opi.py) to:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
opi/generate_opi.py
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Then prompt an AI agent such as GitHub Copilot:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Modify opi/generate_opi.py to generate an OPI for the PVs defined in my_server/__main__.py.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Include any display-specific requirements in the prompt, such as the desired layout, grouping of controls and readbacks, plots, alarms, or status indicators.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Operator interface generator for template"""
|
|
2
|
+
__version__ = 'v0.0.1 2026-10-01'
|
|
3
|
+
# pylint: disable=invalid-name,broad-exception-caught
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import phoebusgen.screen
|
|
9
|
+
import phoebusgen.widget
|
|
10
|
+
|
|
11
|
+
DEVICE = "template"
|
|
12
|
+
INSTANCE = "0"
|
|
13
|
+
TITLE = DEVICE+INSTANCE
|
|
14
|
+
PREFIX = f'pva://{DEVICE}:{INSTANCE}:'
|
|
15
|
+
|
|
16
|
+
def _parse_args() -> argparse.Namespace:
|
|
17
|
+
parser = argparse.ArgumentParser(
|
|
18
|
+
description=__doc__,
|
|
19
|
+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
20
|
+
epilog=__version__,
|
|
21
|
+
)
|
|
22
|
+
parser.add_argument("-t", "--title", default=TITLE, help="Screen title")
|
|
23
|
+
parser.add_argument("prefix", nargs="?", default=PREFIX,
|
|
24
|
+
help=(
|
|
25
|
+
"PV prefix used for all widget PV names. "
|
|
26
|
+
),
|
|
27
|
+
)
|
|
28
|
+
return parser.parse_args()
|
|
29
|
+
|
|
30
|
+
def _add_items(widget, values: str) -> None:
|
|
31
|
+
for item in values.split(", "):
|
|
32
|
+
widget.item(item)
|
|
33
|
+
|
|
34
|
+
def main() -> None:
|
|
35
|
+
pargs = _parse_args()
|
|
36
|
+
prefix = pargs.prefix
|
|
37
|
+
|
|
38
|
+
screen = phoebusgen.screen.Screen(pargs.title, f"{TITLE}.bob")
|
|
39
|
+
screen.width(1080)
|
|
40
|
+
screen.height(660)
|
|
41
|
+
|
|
42
|
+
w = phoebusgen.widget
|
|
43
|
+
widgets = {
|
|
44
|
+
"title": w.Label("title", TITLE, 20, 10, 170, 30),
|
|
45
|
+
"Model_lbl": w.Label("Model_lbl", "Model:", 200, 14, 40, 20),
|
|
46
|
+
"Model": w.TextUpdate("Model", f"{prefix}Model", 245, 14, 80, 20),
|
|
47
|
+
"Version_lbl": w.Label("Version_lbl", "FW:", 340, 14, 25, 20),
|
|
48
|
+
"Version": w.TextUpdate("Version", f"{prefix}Version", 365, 14, 40, 20),
|
|
49
|
+
"dateTime": w.TextUpdate("dateTime", f"{prefix}dateTime", 420, 14, 70, 20),
|
|
50
|
+
}
|
|
51
|
+
y = 45
|
|
52
|
+
widgets.update({
|
|
53
|
+
"srvStatus_lbl": w.Label("srvStatus_lbl", "Server:", 20, y, 100, 20),
|
|
54
|
+
"srvStatus": w.TextUpdate("srvStatus", f"{prefix}status", 70, y, 790, 20),
|
|
55
|
+
})
|
|
56
|
+
y += 40
|
|
57
|
+
widgets.update({
|
|
58
|
+
"state_lbl": w.Label("state_lbl", "Run/Stop:", 20, y, 65, 20),
|
|
59
|
+
"server": w.ComboBox("server", f"{prefix}server", 90, y, 110, 20),
|
|
60
|
+
"sleep_lbl": w.Label("sleep_lbl", "Sleep:", 410, y, 40, 20),
|
|
61
|
+
"sleep": w.TextEntry("sleep", f"{prefix}sleep", 450, y, 50, 20),
|
|
62
|
+
"cycleTime_lbl": w.Label("cycleTime_lbl", "Period:", 510, y, 50, 20),
|
|
63
|
+
"cycleTime": w.TextUpdate("cycleTime", f"{prefix}cycleTime", 560, y, 60, 20),
|
|
64
|
+
"hb_lbl": w.Label("hb_lbl", "HB:", 640, y, 30, 20),
|
|
65
|
+
"HEARTBEAT": w.TextUpdate("HEARTBEAT", f"{prefix}HEARTBEAT", 670, y, 70, 20),
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
# TODO: add device widgets
|
|
69
|
+
|
|
70
|
+
screen.add_widget(list(widgets.values()))
|
|
71
|
+
|
|
72
|
+
out = Path(__file__).with_name(f"{TITLE}.bob")
|
|
73
|
+
screen.write_screen(str(out))
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
main()
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
## Automatically generate a PVAccess server for an instrument
|
|
2
|
+
|
|
3
|
+
### Initialize the project
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
mkdir my_server
|
|
7
|
+
cd my_server
|
|
8
|
+
|
|
9
|
+
mkdir my_server opi docs misc
|
|
10
|
+
touch my_server/__init__.py
|
|
11
|
+
|
|
12
|
+
uv init
|
|
13
|
+
uv add epicsdev
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Copy the instrument programming manual to: ```misc/programming_manual.pdf```
|
|
17
|
+
|
|
18
|
+
Copy the [server template](https://github.com/eicorg/epicsdev/blob/main/docs/template.py) to: ```my_server/__main__.py ```
|
|
19
|
+
|
|
20
|
+
### Use an AI agent
|
|
21
|
+
|
|
22
|
+
From the project directory, prompt an AI agent such as GitHub Copilot:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
Modify my_server/__main__.py to provide EPICS PVAccess support for <instrument name and model>.
|
|
26
|
+
Use the programming manual in misc/programming_manual.pdf as the primary reference.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Add relevant details to the prompt to obtain a better targeted result, for example:
|
|
30
|
+
|
|
31
|
+
- Connection type and address: TCP/IP, USB, serial, or GPIB
|
|
32
|
+
- Required instrument functions and parameters
|
|
33
|
+
- Preferred EPICS PV naming convention
|
|
34
|
+
- Polling rate and performance requirements
|
|
35
|
+
- Required OPI screens or example configuration
|
|
36
|
+
|
|
37
|
+
Review the agent’s recommendations, test the server with the real instrument, and refine error handling and recovery behavior as needed.
|
|
38
|
+
|
|
39
|
+
### Test run
|
|
40
|
+
```
|
|
41
|
+
uv run python -m my_server
|
|
42
|
+
```
|
|
43
|
+
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""EPICS PVAccess server for template."""
|
|
2
|
+
# pylint: disable=invalid-name,broad-exception-caught
|
|
3
|
+
__version__ = 'v0.0.2 2026-10-01'# --index replaced with --instance. This is more generic.
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
from epicsdev import epicsdev as edev
|
|
9
|
+
|
|
10
|
+
DEVICE = 'template:'
|
|
11
|
+
|
|
12
|
+
#````````````````````````````````````````````````````````````````````````````
|
|
13
|
+
# Definitions of PVs, their types, units, limits, and setter functions are
|
|
14
|
+
# defined in the myPVDefs() function below.
|
|
15
|
+
def myPVDefs():
|
|
16
|
+
"""Return list of PV definitions"""
|
|
17
|
+
# abbreviations for PV definition dictionary keys
|
|
18
|
+
F, T, U, LL, LH = 'features', 'type', 'units', 'limitLow', 'limitHigh'
|
|
19
|
+
SET = 'setter'
|
|
20
|
+
|
|
21
|
+
pv_defs = [
|
|
22
|
+
['dateTime', 'Server local date/time', 'N/A'],
|
|
23
|
+
# TODO: add your PV definitions here
|
|
24
|
+
]
|
|
25
|
+
return pv_defs
|
|
26
|
+
#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
27
|
+
|
|
28
|
+
@dataclass(slots=True)
|
|
29
|
+
class C_:
|
|
30
|
+
"""Container for module state variables."""
|
|
31
|
+
pargs = None #
|
|
32
|
+
|
|
33
|
+
def poll():
|
|
34
|
+
"""Poll for updates from the hardware or other sources."""
|
|
35
|
+
# TODO: implement polling logic
|
|
36
|
+
|
|
37
|
+
def periodic_update():
|
|
38
|
+
"""Perform periodic updates."""
|
|
39
|
+
# TODO: implement periodic update logic
|
|
40
|
+
|
|
41
|
+
def serverStateChanged(newState: str):
|
|
42
|
+
"""Callback for server state transitions."""
|
|
43
|
+
if newState == 'Start':
|
|
44
|
+
edev.printi('Start requested')
|
|
45
|
+
elif newState == 'Stop':
|
|
46
|
+
edev.printi('Stop requested')
|
|
47
|
+
elif newState == 'Exit':
|
|
48
|
+
edev.printi('Exit requested')
|
|
49
|
+
|
|
50
|
+
if __name__ == '__main__':
|
|
51
|
+
parser = argparse.ArgumentParser(
|
|
52
|
+
description=__doc__,
|
|
53
|
+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
54
|
+
epilog=f'{__version__}, epicsdev:{edev.__version__}',
|
|
55
|
+
)
|
|
56
|
+
# commonly used options
|
|
57
|
+
parser.add_argument('-a', '--autosave', nargs='?', default='', help=
|
|
58
|
+
'Autosave control. If omitted, autosave is enabled with default directory.')
|
|
59
|
+
parser.add_argument('-c', '--recall', action='store_false', help=
|
|
60
|
+
'If given: do not restore initial PV values from autosave cache.')
|
|
61
|
+
parser.add_argument('-i', '--instance', default='0', help=
|
|
62
|
+
'Device instance.')
|
|
63
|
+
parser.add_argument('-p', '--putlogPV', nargs='?', default='', help=
|
|
64
|
+
'PV name for logging put operations. Empty means default putlog:dump.')
|
|
65
|
+
parser.add_argument('-v', '--verbose', action='count', default=0, help=
|
|
66
|
+
'Increase verbosity (-vv for more).')
|
|
67
|
+
parser.add_argument('device', nargs='?', default=DEVICE, help=
|
|
68
|
+
'Device name, the prefix for all generated PVs <prefix><instance>:')
|
|
69
|
+
|
|
70
|
+
# TODO: add your options here
|
|
71
|
+
|
|
72
|
+
# Parse command-line arguments and store them in the module state container.
|
|
73
|
+
C_.pargs = parser.parse_args()
|
|
74
|
+
if C_.pargs.putlogPV == '':
|
|
75
|
+
C_.pargs.putlogPV = 'putlog:dump'
|
|
76
|
+
C_.pargs.prefix = f'{C_.pargs.device}{C_.pargs.instance}:'
|
|
77
|
+
|
|
78
|
+
# Initialize PV definitions.
|
|
79
|
+
C_.PvDefs = myPVDefs()
|
|
80
|
+
|
|
81
|
+
# Initialize the EPICS PVAccess server with the defined PVs.
|
|
82
|
+
PVs = edev.init_epicsdev(
|
|
83
|
+
C_.pargs.prefix,
|
|
84
|
+
C_.PvDefs,
|
|
85
|
+
C_.pargs.verbose,
|
|
86
|
+
serverStateChanged,
|
|
87
|
+
'',
|
|
88
|
+
C_.pargs.autosave,
|
|
89
|
+
C_.pargs.recall,
|
|
90
|
+
C_.pargs.putlogPV,
|
|
91
|
+
)
|
|
92
|
+
print(f'Using PV prefix: {C_.pargs.prefix}')
|
|
93
|
+
|
|
94
|
+
# Start the server and print initial status.
|
|
95
|
+
edev.publish('VERSION', __version__)
|
|
96
|
+
edev.set_server('Start')
|
|
97
|
+
server = edev.Server(providers=[PVs])
|
|
98
|
+
edev.printi((f'Server for {C_.pargs.prefix} started. Sleeping per cycle: '
|
|
99
|
+
f'{repr(edev.pvv("sleep"))} S.'))
|
|
100
|
+
|
|
101
|
+
# Main server loop. Polls for updates and handles server state transitions.
|
|
102
|
+
try:
|
|
103
|
+
while True:
|
|
104
|
+
state = edev.serverState()
|
|
105
|
+
if state.startswith('Exit'):
|
|
106
|
+
break
|
|
107
|
+
if not state.startswith('Stop'):
|
|
108
|
+
poll()
|
|
109
|
+
if not edev.sleep():
|
|
110
|
+
periodic_update()
|
|
111
|
+
except KeyboardInterrupt:
|
|
112
|
+
edev.printi('Keyboard interrupt received, exiting main loop...')
|
|
113
|
+
edev.set_server('Exit')
|
|
114
|
+
except OSError:
|
|
115
|
+
pass
|
|
116
|
+
|
|
117
|
+
edev.printi('Server is exited')
|