Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
ada780f0
There was a problem fetching the pipeline summary.
Commit
ada780f0
authored
Feb 19, 2017
by
Theo Steininger
Browse files
Options
Downloads
Patches
Plain Diff
Added missing weight method to DomainObject and FieldType.
parent
b54a15f4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
nifty/domain_object.py
+5
-0
5 additions, 0 deletions
nifty/domain_object.py
nifty/field_types/field_type.py
+7
-0
7 additions, 0 deletions
nifty/field_types/field_type.py
nifty/spaces/space/space.py
+0
-20
0 additions, 20 deletions
nifty/spaces/space/space.py
with
12 additions
and
20 deletions
nifty/domain_object.py
+
5
−
0
View file @
ada780f0
...
...
@@ -48,6 +48,11 @@ class DomainObject(Versionable, Loggable, object):
raise
NotImplementedError
(
"
There is no generic dim for DomainObject.
"
)
@abc.abstractmethod
def
weight
(
self
,
x
,
power
=
1
,
axes
=
None
,
inplace
=
False
):
raise
NotImplementedError
(
"
There is no generic weight-method for DomainObject.
"
)
def
pre_cast
(
self
,
x
,
axes
=
None
):
return
x
...
...
...
...
This diff is collapsed.
Click to expand it.
nifty/field_types/field_type.py
+
7
−
0
View file @
ada780f0
...
...
@@ -5,6 +5,13 @@ from nifty.domain_object import DomainObject
class
FieldType
(
DomainObject
):
def
weight
(
self
,
x
,
power
=
1
,
axes
=
None
,
inplace
=
False
):
if
inplace
:
result
=
x
else
:
result
=
x
.
copy
()
return
result
def
process
(
self
,
method_name
,
array
,
inplace
=
True
,
**
kwargs
):
try
:
result_array
=
self
.
__getattr__
(
method_name
)(
array
,
...
...
...
...
This diff is collapsed.
Click to expand it.
nifty/spaces/space/space.py
+
0
−
20
View file @
ada780f0
...
...
@@ -221,26 +221,6 @@ class Space(DomainObject):
def
copy
(
self
):
return
self
.
__class__
(
dtype
=
self
.
dtype
)
@abc.abstractmethod
def
weight
(
self
,
x
,
power
=
1
,
axes
=
None
,
inplace
=
False
):
"""
Weights a given array of field values with the pixel volumes (not
the meta volumes) to a given power.
Parameters
----------
x : numpy.ndarray
Array to be weighted.
power : float, *optional*
Power of the pixel volumes to be used (default: 1).
Returns
-------
y : numpy.ndarray
Weighted array.
"""
raise
NotImplementedError
def
get_distance_array
(
self
,
distribution_strategy
):
raise
NotImplementedError
(
"
There is no generic distance structure for Space base class.
"
)
...
...
...
...
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
sign in
to comment