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
66b51804
Commit
66b51804
authored
10 years ago
by
Jörn Ungermann
Browse files
Options
Downloads
Patches
Plain Diff
included a crude way of supproting masks in the ofrwardmodel.
parent
e39061e3
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
pyramid/forwardmodel.py
+17
-2
17 additions, 2 deletions
pyramid/forwardmodel.py
with
17 additions
and
2 deletions
pyramid/forwardmodel.py
+
17
−
2
View file @
66b51804
...
...
@@ -7,7 +7,7 @@ import numpy as np
from
pyramid.kernel
import
Kernel
from
pyramid.projector
import
Projector
from
pyramid.magdata
import
MagData
import
logging
...
...
@@ -40,7 +40,7 @@ class ForwardModel(object):
LOG
=
logging
.
getLogger
(
__name__
+
'
.ForwardModel
'
)
def
__init__
(
self
,
projectors
,
kernel
):
def
__init__
(
self
,
projectors
,
kernel
,
mask
=
None
):
self
.
LOG
.
debug
(
'
Calling __init__
'
)
assert
np
.
all
([
isinstance
(
projector
,
Projector
)
for
projector
in
projectors
]),
\
'
List has to consist of Projector objects!
'
...
...
@@ -53,9 +53,14 @@ class ForwardModel(object):
self
.
dim_uv
=
kernel
.
dim_uv
self
.
size_2d
=
kernel
.
size
self
.
LOG
.
debug
(
'
Creating
'
+
str
(
self
))
self
.
mask
=
mask
def
__call__
(
self
,
x
):
self
.
LOG
.
debug
(
'
Calling __call__
'
)
if
self
.
mask
is
not
None
:
mag_data_rec
=
MagData
(
self
.
a
,
np
.
zeros
((
3
,)
+
self
.
mask
.
shape
))
mag_data_rec
.
set_vector
(
self
.
mask
,
x
)
x
=
mag_data_rec
.
mag_vec
result
=
[
self
.
kernel
(
projector
(
x
))
for
projector
in
self
.
projectors
]
return
np
.
reshape
(
result
,
-
1
)
...
...
@@ -80,6 +85,11 @@ class ForwardModel(object):
'''
self
.
LOG
.
debug
(
'
Calling jac_dot
'
)
if
self
.
mask
is
not
None
:
mag_data_rec
=
MagData
(
self
.
a
,
np
.
zeros
((
3
,)
+
self
.
mask
.
shape
))
mag_data_rec
.
set_vector
(
self
.
mask
,
vector
)
vector
=
mag_data_rec
.
mag_vec
result
=
[
self
.
kernel
.
jac_dot
(
projector
.
jac_dot
(
vector
))
for
projector
in
self
.
projectors
]
result
=
np
.
reshape
(
result
,
-
1
)
return
result
...
...
@@ -109,6 +119,11 @@ class ForwardModel(object):
result
=
np
.
zeros
(
3
*
size_3d
)
for
(
i
,
projector
)
in
enumerate
(
self
.
projectors
):
result
+=
projector
.
jac_T_dot
(
self
.
kernel
.
jac_T_dot
(
vector
[
i
*
size_2d
:(
i
+
1
)
*
size_2d
]))
if
self
.
mask
is
not
None
:
mag_data_rec
=
MagData
(
self
.
a
,
np
.
zeros
((
3
,)
+
self
.
mask
.
shape
))
mag_data_rec
.
magnitude
[:]
=
result
.
reshape
(
mag_data_rec
.
magnitude
.
shape
)
result
=
mag_data_rec
.
get_vector
(
self
.
mask
)
return
np
.
reshape
(
result
,
-
1
)
def
__repr__
(
self
):
...
...
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