Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TetraX
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Micromagnetic modeling
TetraX
Commits
2118fd1e
Commit
2118fd1e
authored
3 years ago
by
Koerber, Lukas (FWIN-C) - 108045
Browse files
Options
Downloads
Patches
Plain Diff
Change show_Bext() to show() and to some cosmetics.
parent
cd4fa4e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tetrax/core/experimental_setup.py
+26
-18
26 additions, 18 deletions
src/tetrax/core/experimental_setup.py
with
26 additions
and
18 deletions
src/tetrax/core/experimental_setup.py
+
26
−
18
View file @
2118fd1e
...
...
@@ -6,6 +6,7 @@ from ..experiments.calculate_absorption import calculate_absorption
from
..helpers.math
import
h_U
,
h_hom
,
h_CPW
,
h_strip
import
pygmsh
B_ext_color
=
0xED4B42
class
ExperimentalSetup
:
...
...
@@ -33,36 +34,43 @@ class ExperimentalSetup:
print
(
"
You are trying to set an external field which does not match the shape of the mesh.
"
)
def
show_Bext
(
self
,
comp
=
"
vec
"
,
scale
=
5
):
if
np
.
any
(
self
.
_Bext
)
==
0
:
print
(
"
External field is zero.
"
)
else
:
def
show
(
self
,
comp
=
"
vec
"
,
scale
=
5
,
show_antenna
=
True
):
plot
=
k3d
.
plot
()
plt_mesh
=
k3d
.
mesh
(
np
.
float32
(
self
.
sample
.
mesh
.
points
),
np
.
uint32
(
self
.
sample
.
mesh
.
get_cells_type
(
"
triangle
"
)))
plt_mesh
.
wireframe
=
True
plt_mesh
.
color
=
0xaaaaaa
plt_mesh
.
opacity
=
1
plot
+=
plt_mesh
if
np
.
any
(
self
.
_Bext
)
!=
0
:
hx
=
self
.
_Bext
.
T
[
0
]
hy
=
self
.
_Bext
.
T
[
1
]
hz
=
self
.
_Bext
.
T
[
2
]
colors
=
np
.
repeat
(
np
.
array
([(
np
.
uint32
(
B_ext_color
),
np
.
uint32
(
B_ext_color
))]),
self
.
sample
.
nx
)
if
comp
==
"
vec
"
:
m_mesh
=
k3d
.
vectors
(
np
.
float32
(
self
.
sample
.
mesh
.
points
),
np
.
float32
(
scale
*
(
np
.
vstack
([
hx
,
hy
,
hz
]
)).
T
),
head_size
=
2.5
*
scale
,
line_width
=
0.05
*
scale
)
m_mesh
=
k3d
.
vectors
(
np
.
float32
(
self
.
sample
.
mesh
.
points
),
np
.
float32
(
scale
*
(
np
.
vstack
([
hx
,
hy
,
hz
]
)).
T
),
head_size
=
2.5
*
scale
,
line_width
=
0.05
*
scale
,
colors
=
colors
)
else
:
comp_dict
=
{
"
x
"
:
hx
,
"
y
"
:
hy
,
"
z
"
:
hz
,
"
phi
"
:
np
.
arctan2
(
hy
,
hx
),
"
abs
"
:
np
.
sqrt
(
hx
**
2
+
hy
**
2
+
hz
**
2
)}
color_dict
=
{
"
abs
"
:
k3d
.
colormaps
.
matplotlib_color_maps
.
Inferno
,
"
x
"
:
k3d
.
colormaps
.
matplotlib_color_maps
.
RdBu
,
"
y
"
:
k3d
.
colormaps
.
matplotlib_color_maps
.
RdBu
,
"
z
"
:
k3d
.
colormaps
.
matplotlib_color_maps
.
RdBu
,
"
phi
"
:
k3d
.
colormaps
.
matplotlib_color_maps
.
Twilight_shifted
}
# TODO check if comp is valid key
m_mesh
=
k3d
.
mesh
(
np
.
float32
(
self
.
sample
.
mesh
.
points
),
np
.
uint32
(
self
.
sample
.
mesh
.
get_cells_type
(
"
triangle
"
)),
attribute
=
comp_dict
[
comp
],
color_map
=
color_dict
[
comp
],
interpolation
=
False
,
side
=
"
double
"
,
flat_shading
=
True
,
name
=
"
$m_{{}}$
"
.
format
(
comp
))
plot
=
k3d
.
plot
()
plt_mesh
=
k3d
.
mesh
(
np
.
float32
(
self
.
sample
.
mesh
.
points
),
np
.
uint32
(
self
.
sample
.
mesh
.
get_cells_type
(
"
triangle
"
)))
plt_mesh
.
wireframe
=
True
plt_mesh
.
color
=
0xaaaaaa
plt_mesh
.
opacity
=
0.1
plot
+=
m_mesh
plot
+=
plt_mesh
if
self
.
_antenna
is
not
None
:
span
=
np
.
max
(
np
.
abs
(
self
.
sample
.
xyz
.
T
[
0
]))
*
2
antenna_mesh
=
self
.
_antenna
.
get_mesh
(
span
)
plot
+=
k3d
.
mesh
(
np
.
float32
(
antenna_mesh
.
points
),
np
.
uint32
(
antenna_mesh
.
get_cells_type
(
"
triangle
"
)),
color
=
0xFFD700
,
side
=
"
double
"
)
plot
.
display
()
else
:
anchor
=
1.5
*
np
.
max
(
self
.
sample
.
xyz
)
plt_text
=
k3d
.
text2d
(
'
B_{ext} = 0
'
,
position
=
[
0
,
0
],
color
=
B_ext_color
,
size
=
1
)
plot
+=
plt_text
if
self
.
_antenna
is
not
None
and
show_antenna
:
span
=
np
.
max
(
np
.
abs
(
self
.
sample
.
xyz
.
T
[
0
]))
*
2
antenna_mesh
=
self
.
_antenna
.
get_mesh
(
span
)
plot
+=
k3d
.
mesh
(
np
.
float32
(
antenna_mesh
.
points
),
np
.
uint32
(
antenna_mesh
.
get_cells_type
(
"
triangle
"
)),
color
=
0xFFD700
,
side
=
"
double
"
)
plot
.
display
()
def
relax
(
self
,
tol
=
1e-12
):
# TODO check if sample has magnetization
...
...
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