Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
pyMOR
pymor
Commits
0b7d55d4
Commit
0b7d55d4
authored
Jan 16, 2023
by
mohamedadelnaguib
Browse files
refactorizing the code by removing the _cal_plot_dimentsion
parent
6dfdafe8
Changes
2
Hide whitespace changes
Inline
Side-by-side
AUTHORS.md
View file @
0b7d55d4
...
...
@@ -16,7 +16,7 @@
*
Peter Oehme, oehme.pb@gmail.com
*
quadratic functionals and quadratic output keyword for CG discretization
*
Mohamed Adel Naguib Ahmed, mohamedadel1551998@gmail.com
*
Input-output selection in bode_plot function
*
Input-output selection in
`
bode_plot
`
function
*
Mohamed Adel Naguib Ahmed, mohamedadel1551998@gmail.com
*
Input-output selection in
`bode_plot`
function
...
...
src/pymor/models/transfer_function.py
View file @
0b7d55d4
...
...
@@ -323,78 +323,6 @@ class TransferFunction(CacheableObject, ParametricObject):
fig
.
suptitle
(
'Bode plot'
)
return
artists
def
_calc_plot_size_and_input_output_indics
(
self
,
input_indices
=
None
,
output_indices
=
None
):
"""Calculate the figure size in case of selecting a specific inputs/outputs pairs along with
calculating the indices for the desired inputs and outputs
Parameters
----------
input_indices
List of integers,If not None will show the plots for the inputs
associated with the given indices.
output_indices
List of integers,If not None will show the plots for the
outputs associated with the given indices.
Returns
-------
number_rows
Number of rows in the bode plot.
number_columns
Number of columns in the bode plot.
list_input_indices
List of specific input indices.
list_output_indices
LList of specific output indices.
"""
match
(
input_indices
,
output_indices
):
case
(
None
,
None
):
number_rows
=
2
*
self
.
dim_output
number_columns
=
self
.
dim_input
list_input_indices
=
[
*
range
(
self
.
dim_input
)]
list_output_indices
=
[
*
range
(
self
.
dim_output
)]
case
(
None
,
list
()):
assert
all
([
isinstance
(
item
,
int
)
for
item
in
output_indices
])
assert
all
([
output_indices
[
i
]
in
range
(
-
self
.
dim_output
+
1
,
self
.
dim_output
)
for
i
in
range
(
len
(
output_indices
))]),
\
f
'Output indices should be any integer value between
{
-
self
.
dim_output
+
1
}
and
{
self
.
dim_output
-
1
}
'
number_rows
=
2
*
len
(
output_indices
)
number_columns
=
self
.
dim_input
list_input_indices
=
[
*
range
(
self
.
dim_input
)]
list_output_indices
=
output_indices
case
(
list
(),
None
):
assert
all
([
isinstance
(
item
,
int
)
for
item
in
input_indices
])
assert
all
([
input_indices
[
i
]
in
range
(
-
self
.
dim_input
+
1
,
self
.
dim_input
)
for
i
in
range
(
len
(
input_indices
))]),
\
f
'Input indecies should be any integer value between
{
-
self
.
dim_input
+
1
}
and
{
self
.
dim_input
-
1
}
'
number_rows
=
2
*
self
.
dim_output
number_columns
=
len
(
input_indices
)
list_input_indices
=
input_indices
list_output_indices
=
[
*
range
(
self
.
dim_output
)]
case
(
list
(),
list
()):
assert
all
([
isinstance
(
item
,
int
)
for
item
in
output_indices
])
assert
all
([
isinstance
(
item
,
int
)
for
item
in
input_indices
])
assert
all
([
output_indices
[
i
]
in
range
(
-
self
.
dim_output
+
1
,
self
.
dim_output
)
for
i
in
range
(
len
(
output_indices
))]),
\
f
'Output indices should be any integer value between
{
-
self
.
dim_output
+
1
}
and
{
self
.
dim_output
-
1
}
'
assert
all
([
input_indices
[
i
]
in
range
(
-
self
.
dim_input
+
1
,
self
.
dim_input
)
for
i
in
range
(
len
(
input_indices
))]),
\
f
'Input indecies should be any integer value between
{
-
self
.
dim_input
+
1
}
and
{
self
.
dim_input
-
1
}
'
number_rows
=
2
*
len
(
output_indices
)
number_columns
=
len
(
input_indices
)
list_input_indices
=
input_indices
list_output_indices
=
output_indices
return
number_rows
,
number_columns
,
list_input_indices
,
list_output_indices
def
mag_plot
(
self
,
w
,
mu
=
None
,
ax
=
None
,
ord
=
None
,
Hz
=
False
,
dB
=
False
,
adaptive_opts
=
None
,
**
mpl_kwargs
):
"""Draw the magnitude plot.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment