Skip to content

Commit 38dfeda

Browse files
committed
MAINT: no warning issued for evaluation above the Nyquist frequency
1 parent 48015d5 commit 38dfeda

3 files changed

Lines changed: 10 additions & 39 deletions

File tree

control/freqplot.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,9 +1148,6 @@ def singular_values_plot(syslist, omega=None,
11481148
# limit up to and including nyquist frequency
11491149
omega_sys = np.hstack((
11501150
omega_sys[omega_sys < nyquistfrq], nyquistfrq))
1151-
else:
1152-
if np.max(omega_sys) > nyquistfrq:
1153-
warnings.warn("evaluation above Nyquist frequency")
11541151

11551152
omega_complex = np.exp(1j * omega_sys * sys.dt)
11561153
else:

control/tests/freqresp_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def test_bode_basic(ss_siso):
7070
assert len(bode_plot(tf_siso, plot=False, omega=np.logspace(-1,1,10))[0])\
7171
== 10
7272

73+
7374
def test_nyquist_basic(ss_siso):
7475
"""Test nyquist plot call (Very basic)"""
7576
# TODO: proper test
@@ -367,7 +368,6 @@ def test_initial_phase(TF, initial_phase, default_phase, expected_phase):
367368
pytest.param(ctrl.tf([1], [1, 0, 0, 0, 0, 0]),
368369
-270, -3*math.pi/2, math.pi/2, id="order5, -270"),
369370
])
370-
371371
def test_phase_wrap(TF, wrap_phase, min_phase, max_phase):
372372
mag, phase, omega = ctrl.bode(TF, wrap_phase=wrap_phase)
373373
assert(min(phase) >= min_phase)
@@ -638,8 +638,7 @@ def test_singular_values_plot_mpl_superimpose_nyq(ss_mimo_ct, ss_mimo_dt):
638638
omega_all = np.logspace(-3, 2, 1000)
639639
plt.figure()
640640
singular_values_plot(sys_ct, omega_all, plot=True)
641-
with pytest.warns(UserWarning):
642-
singular_values_plot(sys_dt, omega_all, plot=True)
641+
singular_values_plot(sys_dt, omega_all, plot=True)
643642
fig = plt.gcf()
644643
allaxes = fig.get_axes()
645644
assert(len(allaxes) == 1)

examples/singular-values-plot.ipynb

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,14 +2112,6 @@
21122112
},
21132113
"metadata": {},
21142114
"output_type": "display_data"
2115-
},
2116-
{
2117-
"name": "stderr",
2118-
"output_type": "stream",
2119-
"text": [
2120-
"/home/marco/PycharmProjects/python-control/control/freqplot.py:1149: UserWarning: evaluation above Nyquist frequency\n",
2121-
" warnings.warn(\"evaluation above Nyquist frequency\")\n"
2122-
]
21232115
}
21242116
],
21252117
"source": [
@@ -3110,14 +3102,6 @@
31103102
},
31113103
"metadata": {},
31123104
"output_type": "display_data"
3113-
},
3114-
{
3115-
"name": "stderr",
3116-
"output_type": "stream",
3117-
"text": [
3118-
"/home/marco/PycharmProjects/python-control/control/freqplot.py:1149: UserWarning: evaluation above Nyquist frequency\n",
3119-
" warnings.warn(\"evaluation above Nyquist frequency\")\n"
3120-
]
31213105
}
31223106
],
31233107
"source": [
@@ -3135,7 +3119,7 @@
31353119
},
31363120
{
31373121
"cell_type": "code",
3138-
"execution_count": 15,
3122+
"execution_count": 9,
31393123
"id": "trying-breeding",
31403124
"metadata": {},
31413125
"outputs": [
@@ -4117,19 +4101,10 @@
41174101
},
41184102
{
41194103
"cell_type": "code",
4120-
"execution_count": 16,
4104+
"execution_count": 10,
41214105
"id": "fresh-paragraph",
41224106
"metadata": {},
4123-
"outputs": [
4124-
{
4125-
"name": "stderr",
4126-
"output_type": "stream",
4127-
"text": [
4128-
"/home/marco/PycharmProjects/python-control/control/freqplot.py:1149: UserWarning: evaluation above Nyquist frequency\n",
4129-
" warnings.warn(\"evaluation above Nyquist frequency\")\n"
4130-
]
4131-
}
4132-
],
4107+
"outputs": [],
41334108
"source": [
41344109
"ct.freqplot.singular_values_plot(Gd, omega);"
41354110
]
@@ -4144,7 +4119,7 @@
41444119
},
41454120
{
41464121
"cell_type": "code",
4147-
"execution_count": 10,
4122+
"execution_count": 11,
41484123
"id": "alike-holocaust",
41494124
"metadata": {},
41504125
"outputs": [],
@@ -4155,7 +4130,7 @@
41554130
},
41564131
{
41574132
"cell_type": "code",
4158-
"execution_count": 11,
4133+
"execution_count": 12,
41594134
"id": "behind-idaho",
41604135
"metadata": {},
41614136
"outputs": [],
@@ -4165,7 +4140,7 @@
41654140
},
41664141
{
41674142
"cell_type": "code",
4168-
"execution_count": 12,
4143+
"execution_count": 13,
41694144
"id": "danish-detroit",
41704145
"metadata": {
41714146
"scrolled": true
@@ -4177,7 +4152,7 @@
41774152
"(array([197.20868123, 1.39141948]), array([197.20313497, 1.39138034]))"
41784153
]
41794154
},
4180-
"execution_count": 12,
4155+
"execution_count": 13,
41814156
"metadata": {},
41824157
"output_type": "execute_result"
41834158
}
@@ -4208,4 +4183,4 @@
42084183
},
42094184
"nbformat": 4,
42104185
"nbformat_minor": 5
4211-
}
4186+
}

0 commit comments

Comments
 (0)