Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mbtrack2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PA
Collective Effects
mbtrack2
Commits
d4b1c2cc
Commit
d4b1c2cc
authored
May 2, 2023
by
Vadim Gubaidulin
Browse files
Options
Downloads
Patches
Plain Diff
changed plot appearance for plot_area()
parent
61370bd3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mbtrack2/impedance/impedance_model.py
+13
-11
13 additions, 11 deletions
mbtrack2/impedance/impedance_model.py
with
13 additions
and
11 deletions
mbtrack2/impedance/impedance_model.py
+
13
−
11
View file @
d4b1c2cc
...
...
@@ -5,6 +5,7 @@ Module where the ImpedanceModel class is defined.
import
pandas
as
pd
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
matplotlib
import
colormaps
import
pickle
from
copy
import
deepcopy
from
scipy.integrate
import
trapz
...
...
@@ -249,11 +250,11 @@ class ImpedanceModel():
# manage legend
Ztype_dict
=
{
"
Zlong
"
:
0
,
"
Zxdip
"
:
1
,
"
Zydip
"
:
2
,
"
Zxquad
"
:
3
,
"
Zyquad
"
:
4
}
scale
=
[
1e-3
,
1e-6
,
1e-6
,
1e-6
,
1e-6
]
label_list
=
[
r
"
$Z_{long} \;
[k
\Omega
]
$
"
,
r
"
$\frac{1}{\beta_0} \sum_{j} \beta_{x,j} Z_{x,j}^{Dip} \;
[M\Omega/m]
$
"
,
r
"
$\frac{1}{\beta_0} \sum_{j} \beta_{y,j} Z_{y,j}^{Dip} \;
[M\Omega/m]
$
"
,
r
"
$\frac{1}{\beta_0} \sum_{j} \beta_{x,j} Z_{x,j}^{Quad} \;
[M\Omega/m]
$
"
,
r
"
$\frac{1}{\beta_0} \sum_{j} \beta_{y,j} Z_{y,j}^{Quad} \;
[M\Omega/m]
$
"
]
label_list
=
[
r
"
$Z_
\mathrm
{long} \;
(\mathrm{k}
\Omega
)
$
"
,
r
"
$\frac{1}{\beta_0} \sum_{j} \beta_{x,j} Z_{x,j}^
\mathrm
{Dip} \;
(\mathrm{M}\Omega/\mathrm{m})
$
"
,
r
"
$\frac{1}{\beta_0} \sum_{j} \beta_{y,j} Z_{y,j}^
\mathrm
{Dip} \;
(\mathrm{M}\Omega/\mathrm{m})
$
"
,
r
"
$\frac{1}{\beta_0} \sum_{j} \beta_{x,j} Z_{x,j}^
\mathrm
{Quad} \;
(\mathrm{M}\Omega/\mathrm{m})
$
"
,
r
"
$\frac{1}{\beta_0} \sum_{j} \beta_{y,j} Z_{y,j}^
\mathrm
{Quad} \;
(\mathrm{M}\Omega/\mathrm{m})
$
"
]
leg
=
Ztype_dict
[
Z_type
]
# sort plot by decresing area size
...
...
@@ -277,13 +278,14 @@ class ImpedanceModel():
legend
.
append
(
"
Spectral density for sigma =
"
+
str
(
sigma
)
+
"
s
"
)
# Main plot
colorblind
=
colormaps
[
'
tab10
'
].
colors
for
index
in
sorted_index
:
attr
=
attr_list
[
index
]
# Set all impedances with common indexes using + zero_impedance
try
:
sum_imp
=
getattr
(
getattr
(
self
,
attr
),
Z_type
)
+
zero_impedance
ax
.
fill_between
(
sum_imp
.
data
.
index
*
1e-9
,
total_imp
,
total_imp
+
sum_imp
.
data
[
component
]
*
scale
[
leg
])
total_imp
+
sum_imp
.
data
[
component
]
*
scale
[
leg
]
,
edgecolor
=
colorblind
[
index
%
10
],
color
=
colorblind
[
index
%
10
]
)
total_imp
+=
sum_imp
.
data
[
component
]
*
scale
[
leg
]
if
attr
[:
4
]
==
"
sum_
"
:
legend
.
append
(
attr
[
4
:])
...
...
@@ -297,8 +299,8 @@ class ImpedanceModel():
spect
=
spect
/
spect
.
max
()
*
total_imp
.
max
()
ax
.
plot
(
sum_imp
.
data
.
index
*
1e-9
,
spect
,
'
r
'
,
linewidth
=
2.5
)
ax
.
legend
(
legend
,
loc
=
"
upper left
"
,
ncol
=
3
)
ax
.
set_xlabel
(
"
Frequency
[
GHz
]
"
)
ax
.
legend
(
legend
,
loc
=
"
upper left
"
,
ncol
=
2
)
ax
.
set_xlabel
(
"
Frequency
(
GHz
)
"
)
ax
.
set_ylabel
(
label_list
[
leg
]
+
"
-
"
+
component
+
"
part
"
)
ax
.
set_title
(
label_list
[
leg
]
+
"
-
"
+
component
+
"
part
"
)
...
...
@@ -315,13 +317,13 @@ class ImpedanceModel():
try
:
sum_imp
=
getattr
(
getattr
(
self
,
attr
),
Z_type
)
+
zero_impedance
in_ax
.
fill_between
(
sum_imp
.
data
.
index
*
1e-3
,
total_imp
,
total_imp
+
sum_imp
.
data
[
component
]
*
1e-9
)
total_imp
+
sum_imp
.
data
[
component
]
*
1e-9
,
edgecolor
=
colorblind
[
index
%
10
],
color
=
colorblind
[
index
%
10
]
)
total_imp
+=
sum_imp
.
data
[
component
]
*
1e-9
except
AttributeError
:
pass
in_ax
.
set_xlim
([
0
,
200
])
in_ax
.
set_xlabel
(
"
Frequency
[
kHz
]
"
)
in_ax
.
set_ylabel
(
r
"
$[
G
\Omega]$
"
)
in_ax
.
set_xlabel
(
"
Frequency
(
kHz
)
"
)
in_ax
.
set_ylabel
(
r
"
$[
\mathrm{G}
\Omega]$
"
)
return
fig
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment