Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion siriuspy/siriuspy/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.97.1
2.97.2
4 changes: 2 additions & 2 deletions siriuspy/siriuspy/clientconfigdb/types/bo_ramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from copy import deepcopy as _dcopy
from siriuspy.pwrsupply.csdev import \
DEF_WFMSIZE_FBP as _DEF_WFMSIZE_FBP, \
DEF_WFMSIZE_OTHERS as _DEF_WFMSIZE_OTHERS
DEF_WFMSIZE as _DEF_WFMSIZE

from siriuspy.ramp import util as _util

Expand All @@ -25,7 +25,7 @@ def get_dict():

_ps_ramp = {
# number of points in power supply waveforms
'wfm_nrpoints_fams': _DEF_WFMSIZE_OTHERS,
'wfm_nrpoints_fams': _DEF_WFMSIZE,
'wfm_nrpoints_corrs': _DEF_WFMSIZE_FBP,
# ramp total duration [ms]
'duration': _util.DEFAULT_PS_RAMP_DURATION,
Expand Down
14 changes: 7 additions & 7 deletions siriuspy/siriuspy/clientconfigdb/types/global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from siriuspy.pwrsupply.csdev import \
DEFAULT_WFM_FBP as _DEFAULT_WFM_FBP, \
MAX_WFMSIZE_FBP as _MAX_WFMSIZE_FBP, \
DEFAULT_WFM_OTHERS as _DEFAULT_WFM_OTHERS
DEFAULT_WFM as _DEFAULT_WFM

from siriuspy.clientconfigdb.types.as_diagnostics import _bpms

Expand Down Expand Up @@ -1167,12 +1167,12 @@ def get_dict():


_pvs_bo_ps = [
['BO-Fam:PS-B-1:Wfm-SP', _DEFAULT_WFM_OTHERS, 0.0], # [A]
['BO-Fam:PS-B-2:Wfm-SP', _DEFAULT_WFM_OTHERS, 0.0], # [A]
['BO-Fam:PS-QD:Wfm-SP', _DEFAULT_WFM_OTHERS, 0.0], # [A]
['BO-Fam:PS-QF:Wfm-SP', _DEFAULT_WFM_OTHERS, 0.0], # [A]
['BO-Fam:PS-SD:Wfm-SP', _DEFAULT_WFM_OTHERS, 0.0], # [A]
['BO-Fam:PS-SF:Wfm-SP', _DEFAULT_WFM_OTHERS, 0.0], # [A]
['BO-Fam:PS-B-1:Wfm-SP', _DEFAULT_WFM, 0.0], # [A]
['BO-Fam:PS-B-2:Wfm-SP', _DEFAULT_WFM, 0.0], # [A]
['BO-Fam:PS-QD:Wfm-SP', _DEFAULT_WFM, 0.0], # [A]
['BO-Fam:PS-QF:Wfm-SP', _DEFAULT_WFM, 0.0], # [A]
['BO-Fam:PS-SD:Wfm-SP', _DEFAULT_WFM, 0.0], # [A]
['BO-Fam:PS-SF:Wfm-SP', _DEFAULT_WFM, 0.0], # [A]
['BO-02D:PS-QS:Wfm-SP', _DEFAULT_WFM_FBP, 0.0], # [A]
['BO-01U:PS-CH:Wfm-SP', _DEFAULT_WFM_FBP, 0.0], # [A]
['BO-03U:PS-CH:Wfm-SP', _DEFAULT_WFM_FBP, 0.0], # [A]
Expand Down
4 changes: 2 additions & 2 deletions siriuspy/siriuspy/cycle/bo_cycle_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as _np
from ..pwrsupply.csdev import \
DEF_WFMSIZE_FBP as _DEF_WFMSIZE_FBP, \
DEF_WFMSIZE_OTHERS as _DEF_WFMSIZE_OTHERS
DEF_WFMSIZE as _DEF_WFMSIZE
from siriuspy.search import PSSearch as _PSSearch

# Constants
Expand Down Expand Up @@ -2099,7 +2099,7 @@ def bo_get_default_waveform(psname, nrpoints=None, duration=None,
if 'CH' in psname or 'CV' in psname or 'QS' in psname:
nrpoints = _DEF_WFMSIZE_FBP
else:
nrpoints = _DEF_WFMSIZE_OTHERS
nrpoints = _DEF_WFMSIZE
wfm = bo_generate_base_waveform(nrpoints, duration)
if psname in DEFAULT_RAMP_AMPLITUDE:
# bypass upper_limit if psname in dictionary
Expand Down
4 changes: 2 additions & 2 deletions siriuspy/siriuspy/devices/pwrsupply.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ..search import PSSearch as _PSSearch
from ..pwrsupply.csdev import Const as _Const, \
MAX_WFMSIZE_FBP as _MAX_WFMSIZE_FBP, \
MAX_WFMSIZE_OTHERS as _MAX_WFMSIZE_OTHERS
MAX_WFMSIZE as _MAX_WFMSIZE
from ..pwrsupply.psctrl.pscstatus import PSCStatus as _PSCStatus
from ..magnet.factory import NormalizerFactory as _NormFactory

Expand Down Expand Up @@ -567,7 +567,7 @@ def wfm(self):
def wfm(self, value):
"""."""
value = _np.array(value).ravel()
max_size = _MAX_WFMSIZE_OTHERS
max_size = _MAX_WFMSIZE
if self.psmodel == 'FBP':
max_size = _MAX_WFMSIZE_FBP
self['Wfm-SP'] = value[:max_size]
Expand Down
20 changes: 9 additions & 11 deletions siriuspy/siriuspy/pwrsupply/csdev.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
# from pcaspy import Severity as _Severity
from .. import csdev as _csdev
from ..search import PSSearch as _PSSearch
from .bsmp.constants import ConstPSBSMP as _ConstPSBSMP, \
UDC_MAX_NR_DEV as _UDC_MAX_NR_DEV
from .bsmp.constants import ConstPSBSMP as _ConstPSBSMP
from .siggen import DEFAULT_SIGGEN_CONFIG as _DEF_SIGG_CONF

# --- Wfm ---
Expand All @@ -15,16 +14,15 @@
# _SIZE = 4096
MAX_WFMSIZE_FBP = 1024
DEF_WFMSIZE_FBP = 980
DEFAULT_WFM_FBP = _np.zeros(DEF_WFMSIZE_FBP, dtype=float)
MAX_WFMSIZE_OTHERS = 4096
DEF_WFMSIZE_OTHERS = 3920
DEFAULT_WFM_OTHERS = _np.zeros(DEF_WFMSIZE_OTHERS, dtype=float)
MAX_WFMSIZE = 4096
DEF_WFMSIZE = 3920
DEFAULT_WFM_SELECTED = 0
DEFAULT_WFM_FREQUENCY = 2000.0 # [Hz]
DEFAULT_WFM_GAIN = 1.0
DEFAULT_WFM_OFFSET = 0.0 # [A/V]

DEFAULT_WFM = _np.zeros(DEF_WFMSIZE_OTHERS)
DEFAULT_WFM = _np.zeros(DEF_WFMSIZE, dtype=float)
DEFAULT_WFM_FBP = _np.zeros(DEF_WFMSIZE_FBP, dtype=float)

# --- SOFBCurrent ---
PSSOFB_MAX_NR_UDC = 2
Expand Down Expand Up @@ -1306,16 +1304,16 @@ def _get_ps_basic_propty_database():
'value': DEFAULT_SIGGEN_CONFIG[5:9]},
'CycleIndex-Mon': {'type': 'int', 'value': 0, 'unit': 'count'},
# Wfm - UDC
'Wfm-SP': {'type': 'float', 'count': len(DEFAULT_WFM),
'Wfm-SP': {'type': 'float', 'count': MAX_WFMSIZE,
'value': list(DEFAULT_WFM), 'unit': 'A',
'prec': PS_CURRENT_PRECISION},
'Wfm-RB': {'type': 'float', 'count': len(DEFAULT_WFM),
'Wfm-RB': {'type': 'float', 'count': MAX_WFMSIZE,
'value': list(DEFAULT_WFM), 'unit': 'A',
'prec': PS_CURRENT_PRECISION},
'WfmRef-Mon': {'type': 'float', 'count': len(DEFAULT_WFM),
'WfmRef-Mon': {'type': 'float', 'count': MAX_WFMSIZE,
'value': list(DEFAULT_WFM), 'unit': 'A',
'prec': PS_CURRENT_PRECISION},
'Wfm-Mon': {'type': 'float', 'count': len(DEFAULT_WFM),
'Wfm-Mon': {'type': 'float', 'count': MAX_WFMSIZE,
'value': list(DEFAULT_WFM), 'unit': 'A/V/p.u.',
'prec': PS_CURRENT_PRECISION},
# 'WfmMonAcq-Sel': {'type': 'enum', 'enums': _et.DSBL_ENBL,
Expand Down
6 changes: 3 additions & 3 deletions siriuspy/siriuspy/ramp/ramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import numpy as _np

from ..pwrsupply.csdev import MAX_WFMSIZE_FBP as _MAX_WFMSIZE_FBP
from ..pwrsupply.csdev import MAX_WFMSIZE_OTHERS as \
_MAX_WFMSIZE_OTHERS
from ..pwrsupply.csdev import MAX_WFMSIZE as \
_MAX_WFMSIZE

from ..search import PSSearch as _PSSearch
from ..namesys import SiriusPVName
Expand Down Expand Up @@ -277,7 +277,7 @@ def ps_ramp_wfm_nrpoints_fams(self, value):
value = int(value)
rdip = self._value['ps_ramp']
if value != rdip['wfm_nrpoints_fams']:
if not 1 <= value <= _MAX_WFMSIZE_OTHERS:
if not 1 <= value <= _MAX_WFMSIZE:
raise _RampInvalidDipoleWfmParms(
'Invalid number of points for waveforms.')
rdip['wfm_nrpoints_fams'] = value
Expand Down
10 changes: 5 additions & 5 deletions siriuspy/siriuspy/ramp/waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from mathphys import constants as _c
from mathphys import units as _mu

from ..pwrsupply.csdev import DEF_WFMSIZE_OTHERS as \
_DEF_WFMSIZE_OTHERS
from ..pwrsupply.csdev import DEF_WFMSIZE as \
_DEF_WFMSIZE
from ..search import MASearch as _MASearch

from . import util as _ru
Expand Down Expand Up @@ -379,7 +379,7 @@ def _func_polynom(self, region_idx, time):
class _WaveformMagnet:
"""Base class of magnet waveforms."""

def __init__(self, psname, wfm_nrpoints=_DEF_WFMSIZE_OTHERS):
def __init__(self, psname, wfm_nrpoints=_DEF_WFMSIZE):
maname = _MASearch.conv_psname_2_psmaname(psname)
self._magnet = _get_magnet(maname)
self._psname = psname
Expand Down Expand Up @@ -453,7 +453,7 @@ class WaveformDipole(_WaveformMagnet, WaveformParam):
_E0 = _c.electron_rest_energy * _mu.joule_2_GeV

def __init__(
self, psname='BO-Fam:PS-B-1', wfm_nrpoints=_DEF_WFMSIZE_OTHERS,
self, psname='BO-Fam:PS-B-1', wfm_nrpoints=_DEF_WFMSIZE,
duration=_ru.DEFAULT_PS_RAMP_DURATION,
start_energy=_ru.DEFAULT_PS_RAMP_START_ENERGY,
rampup1_start_time=_ru.DEFAULT_PS_RAMP_RAMPUP1_START_TIME,
Expand Down Expand Up @@ -702,7 +702,7 @@ class Waveform(_WaveformMagnet):
"""Waveform class for general magnets."""

def __init__(self, psname, dipole=None, family=None, strengths=None,
currents=None, wfm_nrpoints=_DEF_WFMSIZE_OTHERS):
currents=None, wfm_nrpoints=_DEF_WFMSIZE):
"""Constructor."""
if dipole is None:
raise ValueError('{} waveform needs an associated '
Expand Down
23 changes: 11 additions & 12 deletions siriuspy/tests/pwrsupply/test_csdev.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
'MAX_WFMSIZE_FBP',
'DEF_WFMSIZE_FBP',
'DEFAULT_WFM_FBP',
'MAX_WFMSIZE_OTHERS',
'DEF_WFMSIZE_OTHERS',
'DEFAULT_WFM_OTHERS',
'MAX_WFMSIZE',
'DEF_WFMSIZE',
'DEFAULT_WFM_SELECTED',
'DEFAULT_WFM_FREQUENCY',
'DEFAULT_WFM_GAIN',
Expand Down Expand Up @@ -126,17 +125,17 @@ def test_DEF_WFMSIZE_FBP(self):
self.assertTrue(csdev.DEF_WFMSIZE_FBP > 0)
self.assertTrue(csdev.DEF_WFMSIZE_FBP <= csdev.MAX_WFMSIZE_FBP)

def test_MAX_WFMSIZE_OTHERS(self):
"""Test MAX_WFMSIZE_OTHERS."""
self.assertIsInstance(csdev.MAX_WFMSIZE_OTHERS, int)
self.assertTrue(csdev.MAX_WFMSIZE_OTHERS > 0)
def test_MAX_WFMSIZE(self):
"""Test MAX_WFMSIZE."""
self.assertIsInstance(csdev.MAX_WFMSIZE, int)
self.assertTrue(csdev.MAX_WFMSIZE > 0)

def test_DEF_WFMSIZE_OTHERS(self):
"""Test DEF_WFMSIZE_OTHERS."""
self.assertIsInstance(csdev.DEF_WFMSIZE_OTHERS, int)
self.assertTrue(csdev.DEF_WFMSIZE_OTHERS > 0)
def test_DEF_WFMSIZE(self):
"""Test DEF_WFMSIZE."""
self.assertIsInstance(csdev.DEF_WFMSIZE, int)
self.assertTrue(csdev.DEF_WFMSIZE > 0)
self.assertTrue(
csdev.DEF_WFMSIZE_OTHERS <= csdev.MAX_WFMSIZE_OTHERS)
csdev.DEF_WFMSIZE <= csdev.MAX_WFMSIZE)

def test_DEFAULT_SIGGEN_CONFIG(self):
"""Test DEFAULT_SIGGEN_CONFIG."""
Expand Down
8 changes: 4 additions & 4 deletions siriuspy/tests/ramp/test_waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import numpy

from siriuspy import util
from siriuspy.pwrsupply.csdev import DEF_WFMSIZE_OTHERS as \
_DEF_WFMSIZE_OTHERS
from siriuspy.pwrsupply.csdev import DEF_WFMSIZE as \
_DEF_WFMSIZE
from siriuspy.ramp import waveform
from siriuspy.ramp.waveform import WaveformParam
from siriuspy.ramp.waveform import WaveformDipole
Expand Down Expand Up @@ -201,10 +201,10 @@ def _test_constructor(self):
wfm = WaveformDipole()
curr = wfm.currents
self.assertIsInstance(curr, numpy.ndarray)
self.assertEqual(len(curr), _DEF_WFMSIZE_OTHERS)
self.assertEqual(len(curr), _DEF_WFMSIZE)
stren = wfm.strengths
self.assertIsInstance(stren, list)
self.assertEqual(len(stren), _DEF_WFMSIZE_OTHERS)
self.assertEqual(len(stren), _DEF_WFMSIZE)

def test_waveform(self):
"""Test waveform."""
Expand Down