Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
IMAGINE
Commits
f145f40d
Commit
f145f40d
authored
Jan 21, 2017
by
Theo Steininger
Browse files
Added a factory for a constant magnetic field.
parent
212b66bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
imagine/magnetic_fields/constant_field_factory.py
0 → 100644
View file @
f145f40d
# -*- coding: utf-8 -*-
import
numpy
as
np
from
magnetic_field_factory
import
MagneticFieldFactory
class
ConstantFieldFactory
(
MagneticFieldFactory
):
@
property
def
descriptor
(
self
):
return
'CONSTANT_FIELD'
@
staticmethod
def
_create_array
(
self
):
result_array
=
np
.
empty
(
tuple
(
self
.
resolution
)
+
(
3
,))
result_array
[:,
:,
:]
=
[
self
.
parameters
[
'b_x'
],
self
.
parameters
[
'b_y'
],
self
.
parameters
[
'b_z'
]]
return
result_array
def
_initialize_parameter_defaults
(
self
):
self
.
_parameter_defaults
=
{
'b_x'
:
0
,
'b_y'
:
0
,
'b_z'
:
0
}
def
_initialize_variable_to_parameter_mappings
(
self
):
self
.
_variable_to_parameter_mappings
=
{
'b_x'
:
[
-
np
.
inf
,
0
,
np
.
inf
],
'b_y'
:
[
-
np
.
inf
,
0
,
np
.
inf
],
'b_z'
:
[
-
np
.
inf
,
0
,
np
.
inf
]}
imagine/observers/hammurapy/__init__.py
0 → 100644
View file @
f145f40d
# -*- coding: utf-8 -*-
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