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
fa0ff9d0
Commit
fa0ff9d0
authored
10 years ago
by
Jan Caron
Browse files
Options
Downloads
Patches
Plain Diff
Minor changes to reconstruction and example_joern
parent
fbbbf8d6
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
+7
-11
7 additions, 11 deletions
pyramid/reconstruction.py
scripts/collaborations/example_joern.py
+1
-1
1 addition, 1 deletion
scripts/collaborations/example_joern.py
with
8 additions
and
12 deletions
pyramid/reconstruction.py
+
7
−
11
View file @
fa0ff9d0
...
...
@@ -12,16 +12,16 @@ the distribution.
import
numpy
as
np
from
scipy.sparse.linalg
import
cg
from
scipy.optimize
import
minimize
,
leastsq
from
pyramid.kernel
import
Kernel
from
pyramid.projector
import
SimpleProjector
from
pyramid.phasemapper
import
PhaseMapperRDFC
from
pyramid.forwardmodel
import
ForwardModel
from
pyramid.costfunction
import
Costfunction
,
CFAdapterScipyCG
from
pyramid.costfunction
import
Costfunction
from
pyramid.magdata
import
MagData
from
jutil
import
cg
,
minimizer
from
scipy.optimize
import
leastsq
import
logging
...
...
@@ -113,13 +113,11 @@ def optimize_linear(data, regularisator=None, maxiter=1000, verbosity=0):
The reconstructed magnetic distribution as a :class:`~.MagData` object.
'''
import
jutil
LOG
.
debug
(
'
Calling optimize_sparse_cg
'
)
# Set up necessary objects:
fwd_model
=
ForwardModel
(
data
)
cost
=
Costfunction
(
data
,
regularisator
)
print
cost
(
np
.
zeros
(
cost
.
n
))
x_opt
=
jutil
.
cg
.
conj_grad_minimize
(
cost
)
x_opt
=
cg
.
conj_grad_minimize
(
cost
)
print
cost
(
x_opt
)
# Create and return fitting MagData object:
mag_opt
=
MagData
(
data
.
a
,
np
.
zeros
((
3
,)
+
data
.
dim
))
...
...
@@ -148,15 +146,13 @@ def optimize_nonlin(data, first_guess=None, regularisator=None):
The reconstructed magnetic distribution as a :class:`~.MagData` object.
'''
import
jutil
LOG
.
debug
(
'
Calling optimize_cg
'
)
if
first_guess
is
None
:
first_guess
=
MagData
(
data
.
a
,
np
.
zeros
((
3
,)
+
data
.
dim
))
x_0
=
first_guess
.
mag_vec
fwd_model
=
ForwardModel
(
data
)
cost
=
Costfunction
(
data
,
regularisator
)
assert
len
(
x_0
)
==
cost
.
n
,
(
len
(
x_0
),
cost
.
m
,
cost
.
n
)
result
=
jutil
.
minimizer
.
minimize
(
cost
,
x_0
,
options
=
{
"
conv_rel
"
:
1e-20
},
tol
=
{
"
max_iteration
"
:
1
})
result
=
minimizer
.
minimize
(
cost
,
x_0
,
options
=
{
"
conv_rel
"
:
1e-20
},
tol
=
{
"
max_iteration
"
:
1
})
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
+
1
−
1
View file @
fa0ff9d0
...
...
@@ -41,7 +41,7 @@ smoothed_pictures = True
lam
=
1E-4
order
=
1
log
=
True
PATH
=
'
./
'
PATH
=
'
.
./../output/joern
/
'
dirname
=
PATH
###################################################################################################
# Read in files:
...
...
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