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
Container Registry
Model registry
Operate
Environments
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
Dieter Weber
empyre
Commits
056b131f
Commit
056b131f
authored
10 years ago
by
Jan Caron
Browse files
Options
Downloads
Patches
Plain Diff
Minor formatting
parent
09c9f502
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/reconstruction.py
+9
-8
9 additions, 8 deletions
pyramid/reconstruction.py
scripts/collaborations/example_joern.py
+7
-4
7 additions, 4 deletions
scripts/collaborations/example_joern.py
with
16 additions
and
12 deletions
pyramid/reconstruction.py
+
9
−
8
View file @
056b131f
...
...
@@ -117,7 +117,7 @@ def optimize_linear(data, regularisator=None, maxiter=1000, verbosity=0):
# Set up necessary objects:
cost
=
Costfunction
(
data
,
regularisator
)
print
cost
(
np
.
zeros
(
cost
.
n
))
x_opt
=
jutil
.
cg
.
conj_grad_minimize
(
cost
,
max_iter
=
20
)
x_opt
=
cg
.
conj_grad_minimize
(
cost
,
max_iter
=
20
)
print
cost
(
x_opt
)
# Create and return fitting MagData object:
mag_opt
=
MagData
(
data
.
a
,
np
.
zeros
((
3
,)
+
data
.
dim
))
...
...
@@ -164,18 +164,19 @@ def optimize_nonlin(data, first_guess=None, regularisator=None):
# print jac1, jac2.T, abs(jac1-jac2.T).sum()
# print jac1.shape, jac2.shape
# jac1 = np.array([fwd_model.jac_dot(x_0, np.eye(fwd_model.m)[:, i]) for i in range(fwd_model.m)])
# jac2 = np.array([fwd_model.jac_T_dot(x_0, np.eye(fwd_model.n)[:, i]) for i in range(fwd_model.n)])
# print proj_jac1.dot(pm_jac1)
# print (pm_jac2.dot(proj_jac2)).T
# print jac1
# jac1 = np.array([fwd_model.jac_dot(x_0, np.eye(fwd_model.m)[:, i])
# for i in range(fwd_model.m)])
# jac2 = np.array([fwd_model.jac_T_dot(x_0, np.eye(fwd_model.n)[:, i])
# for i in range(fwd_model.n)])
# print proj_jac1.dot(pm_jac1)
# print (pm_jac2.dot(proj_jac2)).T
# print jac1
# print jac2.T
# print abs(jac1-jac2.T).sum()
# print jac1.shape, jac2.shape
assert
len
(
x_0
)
==
cost
.
n
,
(
len
(
x_0
),
cost
.
m
,
cost
.
n
)
result
=
jutil
.
minimizer
.
minimize
(
cost
,
x_0
,
options
=
{
"
conv_rel
"
:
1e-2
},
tol
=
{
"
max_iteration
"
:
4
})
result
=
minimizer
.
minimize
(
cost
,
x_0
,
options
=
{
"
conv_rel
"
:
1e-2
},
tol
=
{
"
max_iteration
"
:
4
})
x_opt
=
result
.
x
print
cost
(
x_opt
)
mag_opt
=
MagData
(
data
.
a
,
np
.
zeros
((
3
,)
+
data
.
dim
))
...
...
This diff is collapsed.
Click to expand it.
scripts/collaborations/example_joern.py
+
7
−
4
View file @
056b131f
...
...
@@ -38,7 +38,7 @@ inter = 'none'
dim
=
(
1
,)
+
(
64
,
64
)
dim_small
=
(
64
,
64
)
smoothed_pictures
=
True
lam
=
1E-
4
lam
=
1E-
6
order
=
1
log
=
True
PATH
=
'
../../output/joern/
'
...
...
@@ -65,7 +65,8 @@ mag_data_rec = rc.optimize_linear(data_set, regularisator=regularisator)
print
'
reconstruction time:
'
,
clock
()
-
tic
# Display the reconstructed phase map and holography image:
phase_map_rec
=
pm
(
mag_data_rec
)
phase_map_rec
.
display_combined
(
'
Reconstr. Distribution
'
,
gain
=
gain
,
interpolation
=
inter
,
show
=
False
)
phase_map_rec
.
display_combined
(
'
Reconstr. Distribution
'
,
gain
=
gain
,
interpolation
=
inter
,
show
=
False
)
plt
.
savefig
(
dirname
+
"
/reconstr.png
"
)
# Plot the magnetization:
...
...
@@ -82,14 +83,16 @@ plt.savefig(dirname + "/difference.png")
# Get the average difference from the experimental results:
print
'
Average difference:
'
,
np
.
average
(
phase_diff
.
phase
)
# Plot holographic contour maps with overlayed magnetic distributions:
axis
=
phase_map_rec
.
display_holo
(
'
Magnetization Overlay
'
,
gain
=
0.1
,
interpolation
=
inter
,
show
=
False
)
axis
=
phase_map_rec
.
display_holo
(
'
Magnetization Overlay
'
,
gain
=
0.1
,
interpolation
=
inter
,
show
=
False
)
mag_data_rec
.
quiver_plot
(
axis
=
axis
,
show
=
False
)
axis
=
plt
.
gca
()
axis
.
set_xlim
(
20
,
45
)
axis
.
set_ylim
(
20
,
45
)
plt
.
savefig
(
dirname
+
"
/overlay_normal.png
"
)
axis
=
phase_map_rec
.
display_holo
(
'
Magnetization Overlay
'
,
gain
=
0.1
,
interpolation
=
inter
,
show
=
False
)
axis
=
phase_map_rec
.
display_holo
(
'
Magnetization Overlay
'
,
gain
=
0.1
,
interpolation
=
inter
,
show
=
False
)
mag_data_rec
.
quiver_plot
(
axis
=
axis
,
log
=
log
,
show
=
False
)
axis
=
plt
.
gca
()
axis
.
set_xlim
(
20
,
45
)
...
...
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