Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
empyre
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Teresa Weßels
empyre
Commits
c3f95b80
Commit
c3f95b80
authored
7 years ago
by
Fengshan Zheng
Browse files
Options
Downloads
Patches
Plain Diff
PM updated
parent
9e8beb54
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyramid/kernel.py
+1
-1
1 addition, 1 deletion
pyramid/kernel.py
pyramid/utils/pm.py
+3
-103
3 additions, 103 deletions
pyramid/utils/pm.py
with
4 additions
and
104 deletions
pyramid/kernel.py
+
1
−
1
View file @
c3f95b80
...
...
@@ -183,7 +183,7 @@ class KernelCharge(object):
v_acc : float, optional
The acceleration voltage of the electron microscope in V. The default is 300000.
electrode_vec : tuple of float (N=2)
The norm vector of the counter electrode, (elec_a,elec_b), and the distance to the origin is
The norm vector of the counter electrode
in pixels
, (elec_a,elec_b), and the distance to the origin is
the norm of (elec_a,elec_b).
dim_uv : tuple of int (N=2), optional
Dimensions of the 2-dimensional electrostatic charge grid from which the phase should
...
...
This diff is collapsed.
Click to expand it.
pyramid/utils/pm.py
+
3
−
103
View file @
c3f95b80
...
...
@@ -15,8 +15,9 @@ _log = logging.getLogger(__name__)
# TODO: rename magdata to vecdata everywhere!
def
pm
(
fielddata
,
mode
=
'
z
'
,
b_0
=
1
,
electrode_vec
=
(
1E6
,
1E6
),
mapper
=
'
RDFC
'
,
**
kwargs
):
"""
Convenience function for fast magnetic phase mapping.
"""
Convenience function for fast
electric charge and
magnetic phase mapping.
Parameters
----------
...
...
@@ -64,7 +65,7 @@ def pm(fielddata, mode='z', b_0=1, electrode_vec=(1E6, 1E6), mapper='RDFC', **kw
elif
mapper
==
'
FDFC
'
:
phasemapper
=
PhaseMapperFDFC
(
fielddata
.
a
,
projector
.
dim_uv
,
b_0
=
b_0
,
padding
=
padding
)
# Set up phasemapper and map phase:
if
mapper
==
'
Charge
'
:
el
if
mapper
==
'
Charge
'
:
phasemapper
=
PhaseMapperCharge
(
KernelCharge
(
fielddata
.
a
,
projector
.
dim_uv
,
electrode_vec
=
electrode_vec
))
else
:
raise
ValueError
(
"
Invalid mapper (use
'
RDFC
'
,
'
FDFC
'
or
'
Charge
'"
)
...
...
@@ -73,104 +74,3 @@ def pm(fielddata, mode='z', b_0=1, electrode_vec=(1E6, 1E6), mapper='RDFC', **kw
phasemap
.
mask
=
field_proj
.
get_mask
()[
0
,
...]
# Return phase:
return
phasemap
def
pm2
(
magdata
,
mode
=
'
z
'
,
b_0
=
1
,
mapper
=
'
RDFC
'
,
**
kwargs
):
"""
Convenience function for fast magnetic phase mapping.
Parameters
----------
magdata : :class:`~.VectorData`
A :class:`~.VectorData` object, from which the projected phase map should be calculated.
mode: {
'
z
'
,
'
y
'
,
'
x
'
,
'
x-tilt
'
,
'
y-tilt
'
,
'
rot-tilt
'
}, optional
Projection mode which determines the :class:`~.pyramid.projector.Projector` subclass, which
is used for the projection. Default is a simple projection along the `z`-direction.
b_0 : float, optional
Saturation magnetization in Tesla, which is used for the phase calculation. Default is 1.
**kwargs : additional arguments
Additional arguments like `dim_uv`,
'
tilt
'
or
'
rotation
'
, which are passed to the
projector-constructor, defined by the `mode`.
Returns
-------
phasemap : :class:`~pyramid.phasemap.PhaseMap`
The calculated phase map as a :class:`~.PhaseMap` object.
"""
_log
.
debug
(
'
Calling pm2
'
)
# In case of FDFC:
padding
=
kwargs
.
pop
(
'
padding
'
,
0
)
# Determine projection mode:
if
mode
==
'
rot-tilt
'
:
projector
=
RotTiltProjector
(
magdata
.
dim
,
**
kwargs
)
elif
mode
==
'
x-tilt
'
:
projector
=
XTiltProjector
(
magdata
.
dim
,
**
kwargs
)
elif
mode
==
'
y-tilt
'
:
projector
=
YTiltProjector
(
magdata
.
dim
,
**
kwargs
)
elif
mode
in
[
'
x
'
,
'
y
'
,
'
z
'
]:
projector
=
SimpleProjector
(
magdata
.
dim
,
axis
=
mode
,
**
kwargs
)
else
:
raise
ValueError
(
"
Invalid mode (use
'
x
'
,
'
y
'
,
'
z
'
,
'
x-tilt
'
,
'
y-tilt
'
or
'
rot-tilt
'
)
"
)
# Project:
mag_proj
=
projector
(
magdata
)
# Set up phasemapper and map phase:
if
mapper
==
'
RDFC
'
:
phasemapper
=
PhaseMapperRDFC
(
Kernel
(
magdata
.
a
,
projector
.
dim_uv
,
b_0
=
b_0
))
elif
mapper
==
'
FDFC
'
:
phasemapper
=
PhaseMapperFDFC
(
magdata
.
a
,
projector
.
dim_uv
,
b_0
=
b_0
,
padding
=
padding
)
else
:
raise
ValueError
(
"
Invalid mapper (use
'
RDFC
'
or
'
FDFC
'"
)
phasemap
=
phasemapper
(
mag_proj
)
# Get mask from magdata:
phasemap
.
mask
=
mag_proj
.
get_mask
()[
0
,
...]
# Return phase:
return
phasemap
def
pm3
(
elecdata
,
mode
=
'
z
'
,
electrode_vec
=
(
1E6
,
1E6
),
mapper
=
'
Charge
'
,
**
kwargs
):
"""
Convenience function for fast electric phase mapping.
Parameters
----------
elecdata : :class:`~.ScalarData`
A :class:`~.ScalarData` object, from which the projected phase map should be calculated.
mode: {
'
z
'
,
'
y
'
,
'
x
'
,
'
x-tilt
'
,
'
y-tilt
'
,
'
rot-tilt
'
}, optional
Projection mode which determines the :class:`~.pyramid.projector.Projector` subclass, which
is used for the projection. Default is a simple projection along the `z`-direction.
electrode_vec : tuple of float (N=2)
The norm vector of the counter electrode, (elec_a,elec_b), and the distance to the origin is
the norm of (elec_a,elec_b).
**kwargs : additional arguments
Additional arguments like `dim_uv`,
'
tilt
'
or
'
rotation
'
, which are passed to the
projector-constructor, defined by the `mode`.
Returns
-------
phasemap : :class:`~pyramid.phasemap.PhaseMap`
The calculated phase map as a :class:`~.PhaseMap` object.
"""
_log
.
debug
(
'
Calling pm3
'
)
# Determine projection mode:
if
mode
==
'
rot-tilt
'
:
projector
=
RotTiltProjector
(
elecdata
.
dim
,
**
kwargs
)
elif
mode
==
'
x-tilt
'
:
projector
=
XTiltProjector
(
elecdata
.
dim
,
**
kwargs
)
elif
mode
==
'
y-tilt
'
:
projector
=
YTiltProjector
(
elecdata
.
dim
,
**
kwargs
)
elif
mode
in
[
'
x
'
,
'
y
'
,
'
z
'
]:
projector
=
SimpleProjector
(
elecdata
.
dim
,
axis
=
mode
,
**
kwargs
)
else
:
raise
ValueError
(
"
Invalid mode (use
'
x
'
,
'
y
'
,
'
z
'
,
'
x-tilt
'
,
'
y-tilt
'
or
'
rot-tilt
'
)
"
)
# Project:
charge_proj
=
projector
(
elecdata
)
# Set up phasemapper and map phase:
if
mapper
==
'
Charge
'
:
phasemapper
=
PhaseMapperCharge
(
KernelCharge
(
elecdata
.
a
,
projector
.
dim_uv
,
electrode_vec
=
electrode_vec
))
else
:
raise
ValueError
(
"
Invalid mapper (use
'
Charge
'"
)
phasemap
=
phasemapper
(
charge_proj
)
# Get mask from elecdata:
phasemap
.
mask
=
charge_proj
.
get_mask
()[
0
,
...]
# Return phase:
return
phasemap
\ No newline at end of file
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