epicsdev 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.whl

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/epicsdev.py CHANGED
@@ -1,7 +1,8 @@
1
1
  """Skeleton and helper functions for creating EPICS PVAccess server"""
2
2
  # pylint: disable=invalid-name
3
- __version__= 'v1.0.0 26-01-16'# re-factored and simplified, comments added. Main() re-writtedn.
3
+ __version__= 'v1.0.1 26-01-16'# rng range = nPatterns
4
4
  #TODO: NTEnums do not have structure display
5
+ #TODO: Add performance counters to demo.
5
6
 
6
7
  import sys
7
8
  import time
@@ -235,7 +236,7 @@ def init_epicsdev(prefix, pvDefs, verbose=0):
235
236
  pvs = create_PVs(pvDefs)
236
237
  return pvs
237
238
 
238
- #``````````````````Testing stuff``````````````````````````````````````````````
239
+ #``````````````````Demo````````````````````````````````````````````````````````
239
240
  if __name__ == "__main__":
240
241
  import numpy as np
241
242
  import argparse
@@ -257,23 +258,26 @@ if __name__ == "__main__":
257
258
  ['ch1Peak2Peak','Peak-to-peak amplitude', SPV(0.,'A'), {}],
258
259
  ['alarm', 'PV with alarm', SPV(0,'WA'), alarm],
259
260
  ]
260
- nPatterns = 100 # number of patterns in the waveform.
261
+ nPatterns = 100 # number of waveform patterns.
261
262
  pargs = None
262
263
  nDivs = 10 # number of divisions on the oscilloscope screen. That is needed to set tAxis when recordLength is changed.
264
+ rng = np.random.default_rng(nPatterns)
263
265
 
264
266
  def set_recordLength(value):
265
267
  """Record length have changed. The tAxis should be updated accordingly."""
266
268
  printi(f'Setting tAxis to {value}')
267
269
  publish('tAxis', np.arange(value)*pvv('timePerDiv')/nDivs)
268
270
  publish('recordLength', value)
271
+ set_noise(pvv('noiseLevel')) # Re-initialize noise array, because its size depends on recordLength
269
272
 
270
273
  def set_noise(level):
271
274
  """Noise level have changed. Update noise array."""
272
- printi(f'Setting noise level to {level}')
273
- pargs.noise = np.random.normal(scale=0.5*level, size=pargs.npoints+nPatterns)
274
- #printv(f'Noise array updated with level {level}: {pargs.noise}')
275
+ printi(f'Setting noise level to {repr(level)}')
276
+ recordLength = pvv('recordLength')
277
+ pargs.noise = np.random.normal(scale=0.5*level, size=recordLength+nPatterns)
278
+ print(f'Noise array {len(pargs.noise)} updated with level {repr(level)}')
275
279
  publish('noiseLevel', level)
276
-
280
+
277
281
  def init(recordLength):
278
282
  """Testing function. Do not use in production code."""
279
283
  set_recordLength(recordLength)
@@ -281,7 +285,8 @@ if __name__ == "__main__":
281
285
 
282
286
  def poll():
283
287
  """Example of polling function"""
284
- pattern = C_.cycle % nPatterns
288
+ #pattern = C_.cycle % nPatterns# produces sliding
289
+ pattern = rng.integers(0, nPatterns)
285
290
  C_.cycle += 1
286
291
  printv(f'cycle {C_.cycle}')
287
292
  publish('cycle', C_.cycle)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: epicsdev
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Helper module for creating EPICS PVAccess servers using p4p
5
5
  Project-URL: Homepage, https://github.com/ASukhanov/epicsdev
6
6
  Project-URL: Bug Tracker, https://github.com/ASukhanov/epicsdev
@@ -0,0 +1,6 @@
1
+ epicsdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ epicsdev/epicsdev.py,sha256=-mOvv9iGpUqtyX8IsO_dkcY8K52vVlJ_ZR1rMYI7CSY,13545
3
+ epicsdev-1.0.1.dist-info/METADATA,sha256=n4Lz5H4NMJRCDAEFbyj0CHe7K0Cz2ERa5tFJW58F9hI,786
4
+ epicsdev-1.0.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
5
+ epicsdev-1.0.1.dist-info/licenses/LICENSE,sha256=qj3cUKUrX4oXTb0NwuJQ44ThYDEMUfOeIjw9kkT6Qck,1072
6
+ epicsdev-1.0.1.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- epicsdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- epicsdev/epicsdev.py,sha256=iqXkOCwDA91IwIXf3a8ALyMstRLkX_TLTdsHwFS3SrA,13286
3
- epicsdev-1.0.0.dist-info/METADATA,sha256=MiqIHi5DIXESKvq7_4Q1GYmlsyem0BEYnabLrERRTRM,786
4
- epicsdev-1.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
5
- epicsdev-1.0.0.dist-info/licenses/LICENSE,sha256=qj3cUKUrX4oXTb0NwuJQ44ThYDEMUfOeIjw9kkT6Qck,1072
6
- epicsdev-1.0.0.dist-info/RECORD,,