Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
66c00558
Commit
66c00558
authored
Aug 31, 2017
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
9d6729d2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
6 additions
and
147 deletions
+6
-147
nifty/domain_object.py
nifty/domain_object.py
+2
-13
nifty/field.py
nifty/field.py
+2
-44
nifty/field_types/field_array.py
nifty/field_types/field_array.py
+0
-11
nifty/operators/linear_operator/linear_operator.py
nifty/operators/linear_operator/linear_operator.py
+2
-3
nifty/spaces/gl_space/gl_space.py
nifty/spaces/gl_space/gl_space.py
+0
-17
nifty/spaces/hp_space/hp_space.py
nifty/spaces/hp_space/hp_space.py
+0
-13
nifty/spaces/lm_space/lm_space.py
nifty/spaces/lm_space/lm_space.py
+0
-13
nifty/spaces/power_space/power_space.py
nifty/spaces/power_space/power_space.py
+0
-15
nifty/spaces/rg_space/rg_space.py
nifty/spaces/rg_space/rg_space.py
+0
-18
No files found.
nifty/domain_object.py
View file @
66c00558
...
...
@@ -20,13 +20,12 @@ from __future__ import division
import
abc
from
.nifty_meta
import
NiftyMeta
from
keepers
import
Loggable
,
\
Versionable
from
keepers
import
Loggable
from
future.utils
import
with_metaclass
class
DomainObject
(
with_metaclass
(
NiftyMeta
,
type
(
'NewBase'
,
(
Versionable
,
Loggable
,
object
),
{}))):
NiftyMeta
,
type
(
'NewBase'
,
(
Loggable
,
object
),
{}))):
"""The abstract class that can be used as a domain for a field.
This holds all the information and functionality a field needs to know
...
...
@@ -224,13 +223,3 @@ class DomainObject(with_metaclass(
"""
return
x
# ---Serialization---
def
_to_hdf5
(
self
,
hdf5_group
):
return
None
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
repository
):
result
=
cls
()
return
result
nifty/field.py
View file @
66c00558
...
...
@@ -23,8 +23,7 @@ from builtins import range
import
ast
import
numpy
as
np
from
keepers
import
Versionable
,
\
Loggable
from
keepers
import
Loggable
from
.domain_object
import
DomainObject
...
...
@@ -35,7 +34,7 @@ from .random import Random
from
functools
import
reduce
class
Field
(
Loggable
,
Versionable
,
object
):
class
Field
(
Loggable
,
object
):
""" The discrete representation of a continuous field over multiple spaces.
In NIFTY, Fields are used to store data arrays and carry all the needed
...
...
@@ -1444,47 +1443,6 @@ class Field(Loggable, Versionable, object):
"
\n
- min.,max. = "
+
str
(
minmax
)
+
\
"
\n
- mean = "
+
str
(
mean
)
# ---Serialization---
def
_to_hdf5
(
self
,
hdf5_group
):
hdf5_group
.
attrs
[
'dtype'
]
=
self
.
dtype
.
name
hdf5_group
.
attrs
[
'domain_axes'
]
=
str
(
self
.
domain_axes
)
hdf5_group
[
'num_domain'
]
=
len
(
self
.
domain
)
if
self
.
_val
is
None
:
ret_dict
=
{}
else
:
ret_dict
=
{
'val'
:
self
.
val
}
for
i
in
range
(
len
(
self
.
domain
)):
ret_dict
[
's_'
+
str
(
i
)]
=
self
.
domain
[
i
]
return
ret_dict
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
repository
):
# create empty field
new_field
=
EmptyField
()
# reset class
new_field
.
__class__
=
cls
# set values
temp_domain
=
[]
for
i
in
range
(
hdf5_group
[
'num_domain'
][()]):
temp_domain
.
append
(
repository
.
get
(
's_'
+
str
(
i
),
hdf5_group
))
new_field
.
domain
=
tuple
(
temp_domain
)
new_field
.
domain_axes
=
ast
.
literal_eval
(
hdf5_group
.
attrs
[
'domain_axes'
])
try
:
new_field
.
_val
=
repository
.
get
(
'val'
,
hdf5_group
)
except
(
KeyError
):
new_field
.
_val
=
None
new_field
.
dtype
=
np
.
dtype
(
hdf5_group
.
attrs
[
'dtype'
])
return
new_field
class
EmptyField
(
Field
):
def
__init__
(
self
):
...
...
nifty/field_types/field_array.py
View file @
66c00558
...
...
@@ -39,14 +39,3 @@ class FieldArray(FieldType):
@
property
def
dim
(
self
):
return
reduce
(
lambda
x
,
y
:
x
*
y
,
self
.
shape
)
# ---Serialization---
def
_to_hdf5
(
self
,
hdf5_group
):
hdf5_group
[
'shape'
]
=
self
.
shape
return
None
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
loopback_get
):
result
=
cls
(
shape
=
hdf5_group
[
'shape'
][:])
return
result
nifty/operators/linear_operator/linear_operator.py
View file @
66c00558
...
...
@@ -20,15 +20,14 @@ from builtins import str
import
abc
from
...nifty_meta
import
NiftyMeta
from
keepers
import
Loggable
,
\
Versionable
from
keepers
import
Loggable
from
...field
import
Field
from
...
import
nifty_utilities
as
utilities
from
future.utils
import
with_metaclass
class
LinearOperator
(
with_metaclass
(
NiftyMeta
,
type
(
'NewBase'
,
(
Versionable
,
Loggable
,
object
),
{}))):
NiftyMeta
,
type
(
'NewBase'
,
(
Loggable
,
object
),
{}))):
"""NIFTY base class for linear operators.
The base NIFTY operator class is an abstract class from which
...
...
nifty/spaces/gl_space/gl_space.py
View file @
66c00558
...
...
@@ -180,20 +180,3 @@ class GLSpace(Space):
if
nlon
<
1
:
raise
ValueError
(
"nlon must be a positive number."
)
return
nlon
# ---Serialization---
def
_to_hdf5
(
self
,
hdf5_group
):
hdf5_group
[
'nlat'
]
=
self
.
nlat
hdf5_group
[
'nlon'
]
=
self
.
nlon
return
None
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
repository
):
result
=
cls
(
nlat
=
hdf5_group
[
'nlat'
][()],
nlon
=
hdf5_group
[
'nlon'
][()],
)
return
result
nifty/spaces/hp_space/hp_space.py
View file @
66c00558
...
...
@@ -139,16 +139,3 @@ class HPSpace(Space):
if
nside
<
1
:
raise
ValueError
(
"nside must be >=1."
)
return
nside
# ---Serialization---
def
_to_hdf5
(
self
,
hdf5_group
):
hdf5_group
[
'nside'
]
=
self
.
nside
return
None
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
repository
):
result
=
cls
(
nside
=
hdf5_group
[
'nside'
][()],
)
return
result
nifty/spaces/lm_space/lm_space.py
View file @
66c00558
...
...
@@ -187,16 +187,3 @@ class LMSpace(Space):
if
lmax
<
0
:
raise
ValueError
(
"lmax must be >=0."
)
return
lmax
# ---Serialization---
def
_to_hdf5
(
self
,
hdf5_group
):
hdf5_group
[
'lmax'
]
=
self
.
lmax
return
None
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
repository
):
result
=
cls
(
lmax
=
hdf5_group
[
'lmax'
][()],
)
return
result
nifty/spaces/power_space/power_space.py
View file @
66c00558
...
...
@@ -277,18 +277,3 @@ class PowerSpace(Space):
"""Degeneracy factor of the individual k-vectors.
"""
return
self
.
_rho
# ---Serialization---
def
_to_hdf5
(
self
,
hdf5_group
):
hdf5_group
.
attrs
[
'binbounds'
]
=
str
(
self
.
_binbounds
)
return
{
'harmonic_partner'
:
self
.
harmonic_partner
,
}
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
repository
):
hp
=
repository
.
get
(
'harmonic_partner'
,
hdf5_group
)
bb
=
ast
.
literal_eval
(
hdf5_group
.
attrs
[
'binbounds'
])
return
PowerSpace
(
hp
,
binbounds
=
bb
)
nifty/spaces/rg_space/rg_space.py
View file @
66c00558
...
...
@@ -252,21 +252,3 @@ class RGSpace(Space):
temp
=
np
.
empty
(
len
(
self
.
shape
),
dtype
=
np
.
float64
)
temp
[:]
=
distances
return
tuple
(
temp
)
# ---Serialization---
def
_to_hdf5
(
self
,
hdf5_group
):
hdf5_group
[
'shape'
]
=
self
.
shape
hdf5_group
[
'distances'
]
=
self
.
distances
hdf5_group
[
'harmonic'
]
=
self
.
harmonic
return
None
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
repository
):
result
=
cls
(
shape
=
hdf5_group
[
'shape'
][:],
distances
=
hdf5_group
[
'distances'
][:],
harmonic
=
hdf5_group
[
'harmonic'
][()],
)
return
result
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment