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
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
empyre
empyre
Commits
faa17f80
Commit
faa17f80
authored
7 years ago
by
Fengshan Zheng
Browse files
Options
Downloads
Patches
Plain Diff
All tests passed in ForwardModelCharge
parent
9c6a7b23
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!11
ForwardModelCharge updated
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyramid/fielddata.py
+25
-20
25 additions, 20 deletions
pyramid/fielddata.py
with
25 additions
and
20 deletions
pyramid/fielddata.py
+
25
−
20
View file @
faa17f80
...
@@ -4,23 +4,17 @@
...
@@ -4,23 +4,17 @@
#
#
"""
This module provides classes for storing vector and scalar 3D-field.
"""
"""
This module provides classes for storing vector and scalar 3D-field.
"""
import
abc
import
logging
import
logging
import
os
import
os
import
tempfile
import
tempfile
import
abc
from
numbers
import
Number
from
numbers
import
Number
import
numpy
as
np
import
numpy
as
np
from
PIL
import
Image
from
matplotlib
import
patheffects
from
matplotlib
import
pyplot
as
plt
from
matplotlib
import
pyplot
as
plt
from
matplotlib.colors
import
ListedColormap
from
matplotlib.colors
import
ListedColormap
from
matplotlib
import
patheffects
from
PIL
import
Image
from
scipy.ndimage.interpolation
import
zoom
from
scipy.ndimage.interpolation
import
zoom
from
.
import
colors
from
.
import
colors
...
@@ -94,17 +88,6 @@ class FieldData(object, metaclass=abc.ABCMeta):
...
@@ -94,17 +88,6 @@ class FieldData(object, metaclass=abc.ABCMeta):
else
:
else
:
return
self
.
field
return
self
.
field
@property
def
field_vec
(
self
):
"""
Vector containing the vector field distribution.
"""
return
np
.
reshape
(
self
.
field
,
-
1
)
@field_vec.setter
def
field_vec
(
self
,
mag_vec
):
assert
np
.
size
(
mag_vec
)
==
np
.
prod
(
self
.
shape
),
\
'
Vector has to match field shape! {} {}
'
.
format
(
mag_vec
.
shape
,
np
.
prod
(
self
.
shape
))
self
.
field
=
mag_vec
.
reshape
((
3
,)
+
self
.
dim
)
def
__init__
(
self
,
a
,
field
):
def
__init__
(
self
,
a
,
field
):
self
.
_log
.
debug
(
'
Calling __init__
'
)
self
.
_log
.
debug
(
'
Calling __init__
'
)
self
.
a
=
a
self
.
a
=
a
...
@@ -1323,6 +1306,17 @@ class VectorData(FieldData):
...
@@ -1323,6 +1306,17 @@ class VectorData(FieldData):
kwargs
.
setdefault
(
'
hideaxes
'
,
True
)
kwargs
.
setdefault
(
'
hideaxes
'
,
True
)
return
plottools
.
format_axis
(
axis
,
hideaxes
=
True
,
scalebar
=
False
)
return
plottools
.
format_axis
(
axis
,
hideaxes
=
True
,
scalebar
=
False
)
@property
def
field_vec
(
self
):
"""
Vector containing the vector field distribution.
"""
return
np
.
reshape
(
self
.
field
,
-
1
)
@field_vec.setter
def
field_vec
(
self
,
mag_vec
):
assert
np
.
size
(
mag_vec
)
==
np
.
prod
(
self
.
shape
),
\
'
Vector has to match field shape! {} {}
'
.
format
(
mag_vec
.
shape
,
np
.
prod
(
self
.
shape
))
self
.
field
=
mag_vec
.
reshape
((
3
,)
+
self
.
dim
)
class
ScalarData
(
FieldData
):
class
ScalarData
(
FieldData
):
"""
Class for storing scalar field data.
"""
Class for storing scalar field data.
...
@@ -1519,4 +1513,15 @@ class ScalarData(FieldData):
...
@@ -1519,4 +1513,15 @@ class ScalarData(FieldData):
from
.file_io.io_scalardata
import
save_scalardata
from
.file_io.io_scalardata
import
save_scalardata
save_scalardata
(
self
,
filename
,
**
kwargs
)
save_scalardata
(
self
,
filename
,
**
kwargs
)
@property
def
field_vec
(
self
):
"""
Vector containing the scalar field distribution.
"""
return
np
.
reshape
(
self
.
field
,
-
1
)
@field_vec.setter
def
field_vec
(
self
,
c_vec
):
assert
np
.
size
(
c_vec
)
==
np
.
prod
(
self
.
shape
),
\
'
Vector has to match field shape! {} {}
'
.
format
(
c_vec
.
shape
,
np
.
prod
(
self
.
shape
))
self
.
field
=
c_vec
.
reshape
(
self
.
dim
)
# TODO: Histogram plots for magnetisation (see thesis!)
# TODO: Histogram plots for magnetisation (see thesis!)
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