epicsdev 3.3.0__tar.gz → 3.3.1__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.1/LICENSE +28 -0
- epicsdev-3.3.1/PKG-INFO +58 -0
- epicsdev-3.3.1/README.md +43 -0
- epicsdev-3.3.0/fallback/multiadc_pp.py → epicsdev-3.3.1/config/epicsdev_pp.py +28 -41
- epicsdev-3.3.0/config/epicsdev_pp.py → epicsdev-3.3.1/config/multiadc_pp.py +27 -32
- {epicsdev-3.3.0 → epicsdev-3.3.1}/epicsdev/epicsdev.py +8 -5
- epicsdev-3.3.1/epicsdev/multiadc.py +152 -0
- {epicsdev-3.3.0/new → epicsdev-3.3.1}/pyproject.toml +6 -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.1/epicsdev}/README.md +0 -0
- {epicsdev-3.3.0 → epicsdev-3.3.1}/epicsdev/__init__.py +0 -0
- {epicsdev-3.3.0 → epicsdev-3.3.1}/epicsdev/imagegen.py +0 -0
- {epicsdev-3.3.0 → epicsdev-3.3.1}/epicsdev/putlog.py +0 -0
epicsdev-3.3.1/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.1/PKG-INFO
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: epicsdev
|
|
3
|
+
Version: 3.3.1
|
|
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
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# epicsdev
|
|
17
|
+
Python framework that dramatically reduces the effort required
|
|
18
|
+
to create EPICS PVAccess servers using p4p library.
|
|
19
|
+
Device PVs are described as a compact list of
|
|
20
|
+
`[name, description, initial_value, attributes]` tuples.
|
|
21
|
+
|
|
22
|
+
The framework handles server creation, periodic updates, autosave/restore,
|
|
23
|
+
IocStats heartbeat, and PV-put logging automatically.
|
|
24
|
+
|
|
25
|
+
Because all device logic lives in a small, well-structured Python file with a
|
|
26
|
+
predictable pattern, large-language-model (LLM) assistants such as GitHub
|
|
27
|
+
Copilot can replicate that pattern for any new instruments given only a
|
|
28
|
+
manufacturer's programming manual.
|
|
29
|
+
|
|
30
|
+
Device support for following instruments have been developed:
|
|
31
|
+
|
|
32
|
+
## Power Supplies
|
|
33
|
+
- [CAEN FAST-PS](https://github.com/eicorg/epicsdev_ps_caen_fastps)
|
|
34
|
+
|
|
35
|
+
## Oscilloscope series
|
|
36
|
+
- [KEYSIGHT (AGILENT) DSO-X](https://github.com/eicorg/epicsdev_osc_keysight_dsox)
|
|
37
|
+
- [RIGOL DHO](https://github.com/eicorg/epicsdev_osc_rigol)
|
|
38
|
+
- [TEKTRONIX MSO](https://github.com/eicorg/epicsdev_osc_tektronix_mso)
|
|
39
|
+
- [LECROY WAVERUNNER](https://github.com/eicorg/epicsdev_osc_lecroy_waverunner)
|
|
40
|
+
|
|
41
|
+
## Signal generators
|
|
42
|
+
- [SIGLENT SDG series](https://github.com/eicorg/epicsdev_siggen_siglent_sdg)
|
|
43
|
+
- [KEYSIGHT 33000 series](https://github.com/eicorg/epicsdev_siggen_keysight_33000)
|
|
44
|
+
|
|
45
|
+
## DAQ
|
|
46
|
+
- [CAEN DT5202](https://github.com/eicorg/epicsdev_daq_caen_dt5202)
|
|
47
|
+
- [Labjack U3](https://github.com/eicorg/epicsdev_daq_labjack_u3)
|
|
48
|
+
|
|
49
|
+
## Magnetometers
|
|
50
|
+
- [LAKESHORE (model 421)](https://github.com/eicorg/epicsdev_magn_lakeshore)
|
|
51
|
+
|
|
52
|
+
## Simulated instruments<br>
|
|
53
|
+
Multi-channel waveform generator:<br>
|
|
54
|
+
Module **epicdev.multiadc** can generate large amount of data for stress-testing
|
|
55
|
+
the EPICS environment. For example the following command will generate 100 of
|
|
56
|
+
1000-pont noisy waveforms and 300 of scalar parameters:
|
|
57
|
+
```python -m epicsdev.multiadc -c100 -n1000```.
|
|
58
|
+
|
epicsdev-3.3.1/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# epicsdev
|
|
2
|
+
Python framework that dramatically reduces the effort required
|
|
3
|
+
to create EPICS PVAccess servers using p4p library.
|
|
4
|
+
Device PVs are described as a compact list of
|
|
5
|
+
`[name, description, initial_value, attributes]` tuples.
|
|
6
|
+
|
|
7
|
+
The framework handles server creation, periodic updates, autosave/restore,
|
|
8
|
+
IocStats heartbeat, and PV-put logging automatically.
|
|
9
|
+
|
|
10
|
+
Because all device logic lives in a small, well-structured Python file with a
|
|
11
|
+
predictable pattern, large-language-model (LLM) assistants such as GitHub
|
|
12
|
+
Copilot can replicate that pattern for any new instruments given only a
|
|
13
|
+
manufacturer's programming manual.
|
|
14
|
+
|
|
15
|
+
Device support for following instruments have been developed:
|
|
16
|
+
|
|
17
|
+
## Power Supplies
|
|
18
|
+
- [CAEN FAST-PS](https://github.com/eicorg/epicsdev_ps_caen_fastps)
|
|
19
|
+
|
|
20
|
+
## Oscilloscope series
|
|
21
|
+
- [KEYSIGHT (AGILENT) DSO-X](https://github.com/eicorg/epicsdev_osc_keysight_dsox)
|
|
22
|
+
- [RIGOL DHO](https://github.com/eicorg/epicsdev_osc_rigol)
|
|
23
|
+
- [TEKTRONIX MSO](https://github.com/eicorg/epicsdev_osc_tektronix_mso)
|
|
24
|
+
- [LECROY WAVERUNNER](https://github.com/eicorg/epicsdev_osc_lecroy_waverunner)
|
|
25
|
+
|
|
26
|
+
## Signal generators
|
|
27
|
+
- [SIGLENT SDG series](https://github.com/eicorg/epicsdev_siggen_siglent_sdg)
|
|
28
|
+
- [KEYSIGHT 33000 series](https://github.com/eicorg/epicsdev_siggen_keysight_33000)
|
|
29
|
+
|
|
30
|
+
## DAQ
|
|
31
|
+
- [CAEN DT5202](https://github.com/eicorg/epicsdev_daq_caen_dt5202)
|
|
32
|
+
- [Labjack U3](https://github.com/eicorg/epicsdev_daq_labjack_u3)
|
|
33
|
+
|
|
34
|
+
## Magnetometers
|
|
35
|
+
- [LAKESHORE (model 421)](https://github.com/eicorg/epicsdev_magn_lakeshore)
|
|
36
|
+
|
|
37
|
+
## Simulated instruments<br>
|
|
38
|
+
Multi-channel waveform generator:<br>
|
|
39
|
+
Module **epicdev.multiadc** can generate large amount of data for stress-testing
|
|
40
|
+
the EPICS environment. For example the following command will generate 100 of
|
|
41
|
+
1000-pont noisy waveforms and 300 of scalar parameters:
|
|
42
|
+
```python -m epicsdev.multiadc -c100 -n1000```.
|
|
43
|
+
|
|
@@ -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
|
+
]
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""Helper functions for creating EPICS PVAccess server"""
|
|
2
2
|
# pylint: disable=invalid-name
|
|
3
|
-
__version__= 'v3.3.
|
|
4
|
-
#TODO:
|
|
3
|
+
__version__= 'v3.3.1 26-09-27'# Limits are handled for read-only PVs.
|
|
4
|
+
#TODO: publish with ifChanged=True, does not work for arrays
|
|
5
|
+
#TODO: ifChanged does not work for enums
|
|
5
6
|
|
|
6
7
|
import sys
|
|
7
8
|
import time
|
|
@@ -40,14 +41,14 @@ def _serverStateChanged(newState:str):
|
|
|
40
41
|
return
|
|
41
42
|
|
|
42
43
|
class C_():
|
|
43
|
-
"""
|
|
44
|
+
""" Container for module state variables."""
|
|
44
45
|
prefix = ''
|
|
45
46
|
verbose = 0
|
|
46
47
|
startTime = 0.
|
|
47
48
|
cycle = 0
|
|
48
49
|
serverState = ''
|
|
49
50
|
PVs = {}
|
|
50
|
-
PVDefs = []
|
|
51
|
+
PVDefs = []
|
|
51
52
|
serverStateChanged = _serverStateChanged
|
|
52
53
|
lastCycleTime = timer()
|
|
53
54
|
lastUpdateTime = 0.
|
|
@@ -219,7 +220,9 @@ def create_PVs(pvDefs, pvcache=None):
|
|
|
219
220
|
if field in ['limitLow','limitHigh','format','units']:
|
|
220
221
|
ntNamedTuples[f'display.{field}'] = extra[field]
|
|
221
222
|
if field.startswith('limit'):
|
|
222
|
-
|
|
223
|
+
if f'control.{field}' in ntNamedTuples:
|
|
224
|
+
ntNamedTuples[f'control.{field}'] = extra[field]
|
|
225
|
+
ntNamedTuples[f'display.{field}'] = extra[field]
|
|
223
226
|
if field == 'valueAlarm':
|
|
224
227
|
for key,value in extra[field].items():
|
|
225
228
|
ntNamedTuples[f'valueAlarm.{key}'] = value
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""Simulated multi-channel ADC device server using epicsdev module."""
|
|
2
|
+
# pylint: disable=invalid-name
|
|
3
|
+
__version__= 'v0.0.2 26-01-23'# refactored
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import time
|
|
7
|
+
from time import perf_counter as timer
|
|
8
|
+
from .epicsdev import Server, Context, init_epicsdev, serverState, publish
|
|
9
|
+
from .epicsdev import pvv, printi, printv, SPV, set_server
|
|
10
|
+
|
|
11
|
+
import numpy as np
|
|
12
|
+
import argparse
|
|
13
|
+
|
|
14
|
+
def myPVDefs():
|
|
15
|
+
"""Example of PV definitions"""
|
|
16
|
+
SET,U,LL,LH = 'setter','units','limitLow','limitHigh'
|
|
17
|
+
alarm = {'valueAlarm':{'lowAlarmLimit':-9., 'highAlarmLimit':9.}}
|
|
18
|
+
pvDefs = [ # device-specific PVs
|
|
19
|
+
['externalControl', 'Name of external PV, which controls the server',
|
|
20
|
+
SPV('Start Stop Clear Exit Started Stopped Exited'.split(), 'WE'), {}],
|
|
21
|
+
['noiseLevel', 'Noise amplitude', SPV(1.E-4,'W'), {SET:set_noise, U:'V'}],
|
|
22
|
+
['tAxis', 'Full scale of horizontal axis', SPV([0.]), {U:'S'}],
|
|
23
|
+
['recordLength','Max number of points', SPV(100,'W','u32'),
|
|
24
|
+
{LL:4,LH:1000000, SET:set_recordLength}],
|
|
25
|
+
['alarm', 'PV with alarm', SPV(0,'WA'), {U:'du',**alarm}],
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
# Templates for channel-related PVs. Important: SPV cannot be used in this list!
|
|
29
|
+
ChannelTemplates = [
|
|
30
|
+
['c0$VoltsPerDiv', 'Vertical scale', (1E-3,'W'), {U:'V/du'}],
|
|
31
|
+
#['c0$VoltOffset', 'Vertical offset', (1E-3,), {U:'V/du'}],
|
|
32
|
+
['c0$Waveform', 'Waveform array', ([0.],), {U:'du'}],
|
|
33
|
+
['c0$Mean', 'Mean of the waveform', (0.,'A'), {U:'du'}],
|
|
34
|
+
['c0$Peak2Peak','Peak-to-peak amplitude', (0.,'A'), {U:'du',**alarm}],
|
|
35
|
+
]
|
|
36
|
+
# extend PvDefs with channel-related PVs
|
|
37
|
+
for ch in range(pargs.channels):
|
|
38
|
+
for pvdef in ChannelTemplates:
|
|
39
|
+
newpvdef = pvdef.copy()
|
|
40
|
+
newpvdef[0] = pvdef[0].replace('0$',f'{ch+1:02}')
|
|
41
|
+
newpvdef[2] = SPV(*pvdef[2])
|
|
42
|
+
pvDefs.append(newpvdef)
|
|
43
|
+
return pvDefs
|
|
44
|
+
|
|
45
|
+
nPatterns = 100 # number of waveform patterns.
|
|
46
|
+
pargs = None
|
|
47
|
+
rng = np.random.default_rng(nPatterns)
|
|
48
|
+
nPoints = 100
|
|
49
|
+
verbose = 0
|
|
50
|
+
|
|
51
|
+
def set_recordLength(value):
|
|
52
|
+
"""Record length have changed. The tAxis should be updated accordingly."""
|
|
53
|
+
printi(f'Setting tAxis to {value}')
|
|
54
|
+
publish('tAxis', np.arange(value)*1.E-6)
|
|
55
|
+
publish('recordLength', value)
|
|
56
|
+
set_noise(pvv('noiseLevel')) # Re-initialize noise array, because its size depends on recordLength
|
|
57
|
+
|
|
58
|
+
def set_noise(level):
|
|
59
|
+
"""Noise level have changed. Update noise array."""
|
|
60
|
+
v = float(level)
|
|
61
|
+
recordLength = pvv('recordLength')
|
|
62
|
+
ts = timer()
|
|
63
|
+
|
|
64
|
+
pargs.noise = np.random.normal(scale=0.5*level, size=recordLength+nPatterns)# 45ms/1e6 points
|
|
65
|
+
printi(f'Noise array[{len(pargs.noise)}] updated with level {v:.4g} V. in {timer()-ts:.4g} S.')
|
|
66
|
+
publish('noiseLevel', level)
|
|
67
|
+
|
|
68
|
+
def set_externalControl(value):
|
|
69
|
+
"""External control PV have changed. Control the server accordingly."""
|
|
70
|
+
pvname = str(value)
|
|
71
|
+
if pvname in (None,'0'):
|
|
72
|
+
print('External control is not activated.')
|
|
73
|
+
return
|
|
74
|
+
printi(f'External control PV: {pvname}')
|
|
75
|
+
ctxt = Context('pva')
|
|
76
|
+
try:
|
|
77
|
+
r = ctxt.get(pvname, timeout=0.5)
|
|
78
|
+
except TimeoutError:
|
|
79
|
+
printi(f'Cannot connect to external control PV {pvname}.')
|
|
80
|
+
sys.exit(1)
|
|
81
|
+
|
|
82
|
+
def init(recordLength):
|
|
83
|
+
"""Testing function. Do not use in production code."""
|
|
84
|
+
set_recordLength(recordLength)
|
|
85
|
+
#set_externalControl(pargs.prefix + pargs.external)
|
|
86
|
+
|
|
87
|
+
def poll():
|
|
88
|
+
"""Example of polling function"""
|
|
89
|
+
#pattern = C_.cycle % nPatterns# produces sliding
|
|
90
|
+
cycle = pvv('cycle')
|
|
91
|
+
printv(f'cycle {repr(cycle)}')
|
|
92
|
+
publish('cycle', cycle + 1)
|
|
93
|
+
for ch in range(pargs.channels):
|
|
94
|
+
pattern = rng.integers(0, nPatterns)
|
|
95
|
+
chstr = f'c{ch+1:02}'
|
|
96
|
+
wf = pargs.noise[pattern:pattern+pvv('recordLength')].copy()
|
|
97
|
+
#print(f'ch{ch}, {pattern}: {wf[0], wf.sum(), wf.mean(), np.mean(wf)}')
|
|
98
|
+
wf /= pvv(f'{chstr}VoltsPerDiv')
|
|
99
|
+
#wf += pvv(f'{chstr}Offset')
|
|
100
|
+
wf += ch
|
|
101
|
+
publish(f'{chstr}Waveform', list(wf))
|
|
102
|
+
publish(f'{chstr}Peak2Peak', np.ptp(wf))
|
|
103
|
+
publish(f'{chstr}Mean', np.mean(wf))
|
|
104
|
+
|
|
105
|
+
# Argument parsing
|
|
106
|
+
parser = argparse.ArgumentParser(description = __doc__,
|
|
107
|
+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
108
|
+
epilog=f'{__version__}')
|
|
109
|
+
parser.add_argument('-c', '--channels', type=int, default=6, help=
|
|
110
|
+
'Number of channels per device')
|
|
111
|
+
parser.add_argument('-e', '--external', help=
|
|
112
|
+
'Name of external PV, which controls the server, if 0 then it will be <device>0:')
|
|
113
|
+
parser.add_argument('-l', '--list', default=None, nargs='?', help=
|
|
114
|
+
'Directory to save list of all generated PVs, if None, then </tmp/pvlist/><prefix> is assumed.')
|
|
115
|
+
parser.add_argument('-d', '--device', default='multiadc', help=
|
|
116
|
+
'Device name, the PV name will be <device><index>:')
|
|
117
|
+
parser.add_argument('-i', '--index', default='0', help=
|
|
118
|
+
'Device index, the PV name will be <device><index>:')
|
|
119
|
+
# The rest of arguments are not essential, they can be changed at runtime using PVs.
|
|
120
|
+
parser.add_argument('-n', '--npoints', type=int, default=nPoints, help=
|
|
121
|
+
'Number of points in the waveform')
|
|
122
|
+
parser.add_argument('-v', '--verbose', action='count', default=verbose, help=
|
|
123
|
+
'Show more log messages (-vv: show even more)')
|
|
124
|
+
pargs = parser.parse_args()
|
|
125
|
+
print(f'pargs: {pargs}')
|
|
126
|
+
|
|
127
|
+
# Initialize epicsdev and PVs
|
|
128
|
+
pargs.prefix = f'{pargs.device}{pargs.index}:'
|
|
129
|
+
PVs = init_epicsdev(pargs.prefix, myPVDefs(), pargs.list, pargs.verbose)
|
|
130
|
+
# if pargs.list != '':
|
|
131
|
+
# print('List of PVs:')
|
|
132
|
+
# for _pvname in PVs:
|
|
133
|
+
# print(_pvname)
|
|
134
|
+
printi(f'Hosting {len(PVs)} PVs')
|
|
135
|
+
|
|
136
|
+
# Initialize the device, using pargs if needed. That can be used to set the number of points in the waveform, for example.
|
|
137
|
+
init(pargs.npoints)
|
|
138
|
+
|
|
139
|
+
# Start the Server. Use your set_server, if needed.
|
|
140
|
+
set_server('Start')
|
|
141
|
+
|
|
142
|
+
# Main loop
|
|
143
|
+
server = Server(providers=[PVs])
|
|
144
|
+
printi(f'Server started with polling interval {repr(pvv("polling"))} S.')
|
|
145
|
+
while True:
|
|
146
|
+
state = serverState()
|
|
147
|
+
if state.startswith('Exit'):
|
|
148
|
+
break
|
|
149
|
+
if not state.startswith('Stop'):
|
|
150
|
+
poll()
|
|
151
|
+
time.sleep(pvv("polling"))
|
|
152
|
+
printi('Server is exited')
|
|
@@ -4,22 +4,21 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "epicsdev"
|
|
7
|
-
version = "3.1
|
|
7
|
+
version = "3.3.1"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Andrey Sukhanov", email="sukhanov@bnl.gov" },
|
|
10
10
|
]
|
|
11
11
|
description = "Helper module for creating EPICS PVAccess servers using p4p"
|
|
12
12
|
readme = "README.md"
|
|
13
|
-
requires-python = ">=3.
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Programming Language :: Python :: 3",
|
|
16
|
-
"License :: OSI Approved ::
|
|
16
|
+
"License :: OSI Approved :: BSD License",
|
|
17
17
|
"Operating System :: OS Independent",
|
|
18
18
|
]
|
|
19
19
|
dependencies = [
|
|
20
|
-
|
|
21
|
-
"psutil",
|
|
20
|
+
"p4p>=4.2.2",
|
|
22
21
|
]
|
|
23
22
|
[project.urls]
|
|
24
|
-
"Homepage" = "https://github.com/
|
|
25
|
-
"Bug Tracker" = "https://github.com/
|
|
23
|
+
"Homepage" = "https://github.com/eicorg/epicsdev"
|
|
24
|
+
"Bug Tracker" = "https://github.com/eicorg/epicsdev"
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Copilot instructions for epicsdev
|
|
2
|
-
|
|
3
|
-
## Big picture
|
|
4
|
-
- Core EPICS PVAccess helpers live in [epicsdev/epicsdev.py](epicsdev/epicsdev.py). Module state is held in `C_` (prefix, PV map, verbosity, server state), and public helpers include `SPV()`, `publish()`, `pvv()`, `serverState()`, `sleep()`.
|
|
5
|
-
- Startup flow: `init_epicsdev(prefix, pvDefs, verbose=0, serverStateChanged=None, listDir=None)` checks for an existing server (via `host` PV), creates PVs, and optionally writes a PV list under `/tmp/pvlist/<prefix>.txt`. Then `Server(providers=[PVs])` runs a polling loop that checks `serverState()`; see [epicsdev/epicsdev.py](epicsdev/epicsdev.py) and the concrete device in [epicsdev/multiadc.py](epicsdev/multiadc.py).
|
|
6
|
-
- `create_PVs()` always prepends mandatory PVs (`host`, `version`, `status`, `server`, `verbose`, `sleep`, `cycle`, `cycleTime`) before app PVs; `sleep()` updates `cycle`/`cycleTime` every `PeriodicUpdateInterval` and uses the `sleep` PV as throttle.
|
|
7
|
-
- GUI pages for pypeto are defined in [config/epicsdev_pp.py](config/epicsdev_pp.py), [config/multiadc_pp.py](config/multiadc_pp.py), and [config/epicsSimscope_pp.py](config/epicsSimscope_pp.py); their PV names/prefixes must match the servers.
|
|
8
|
-
|
|
9
|
-
## Project-specific patterns & conventions
|
|
10
|
-
- PV definitions are `[name, description, SPV, extra]` and passed to `create_PVs()`; examples: `myPVDefs()` in [epicsdev/epicsdev.py](epicsdev/epicsdev.py) and [epicsdev/multiadc.py](epicsdev/multiadc.py).
|
|
11
|
-
- `SPV(initial, meta, vtype)` uses compact `meta`: `W` (writable), `R` (readable), `A` (alarm), `D` (discrete enum). `D` creates an `NTEnum` with `{choices,index}`.
|
|
12
|
-
- Writable PVs set `control.limitLow/High` to `0` as a PVAccess writability workaround (see `_create_PVs()` in [epicsdev/epicsdev.py](epicsdev/epicsdev.py)).
|
|
13
|
-
- `extra` dict keys commonly used: `setter`, `units`, `limitLow`, `limitHigh`, `format`, `valueAlarm`. `setter` receives `(value, spv)`.
|
|
14
|
-
- Prefer `publish()`/`pvv()` instead of direct `SharedPV` access; logging uses `printi/printw/printe`, which also updates the `status` PV.
|
|
15
|
-
- In multi-channel templates, don’t pre-create `SPV` objects; use tuples and convert per-channel (see `ChannelTemplates` in [epicsdev/multiadc.py](epicsdev/multiadc.py)).
|
|
16
|
-
|
|
17
|
-
## External deps & integration points
|
|
18
|
-
- Build system is hatchling; package requires Python >=3.7 and `p4p` (see [pyproject.toml](pyproject.toml)). Optional runtime tools: `pypeto`, `pvplot` for GUI/plotting (see [README.md](README.md)).
|
|
19
|
-
|
|
20
|
-
## Common workflows (from README)
|
|
21
|
-
- Run demo server: `python -m epicsdev.epicsdev`
|
|
22
|
-
- Control/plot demo (requires `pypeto`, `pvplot`): `python -m pypeto -c config -f epicsdev`
|
|
23
|
-
- Run multi-channel waveform generator: `python -m epicsdev.multiadc -c100 -n1000`
|
|
24
|
-
- Launch multiadc GUI: `python -m pypeto -c config -f multiadc`
|
epicsdev-3.3.0/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Andrey Sukhanov
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|