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
9bbb954e
Commit
9bbb954e
authored
10 years ago
by
Jörn Ungermann
Browse files
Options
Downloads
Patches
Plain Diff
fixed some of the testcases.
parent
f49e5089
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_analytic.py
+4
-4
4 additions, 4 deletions
tests/test_analytic.py
tests/test_magcreator.py
+22
-22
22 additions, 22 deletions
tests/test_magcreator.py
with
26 additions
and
26 deletions
tests/test_analytic.py
+
4
−
4
View file @
9bbb954e
...
...
@@ -34,7 +34,7 @@ class TestCaseAnalytic(unittest.TestCase):
width
=
(
self
.
dim
[
0
]
/
2
,
self
.
dim
[
1
]
/
2
,
self
.
dim
[
2
]
/
2
)
phase
=
an
.
phase_mag_slab
(
self
.
dim
,
self
.
res
,
self
.
phi
,
self
.
center
,
width
)
reference
=
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_phase_slab.npy
'
))
np
.
testing
.
assert_equal
(
phase
,
reference
,
'
Unexpected behavior in phase_mag_slab()
'
)
np
.
testing
.
assert_
almost_
equal
(
phase
,
reference
,
err_msg
=
'
Unexpected behavior in phase_mag_slab()
'
)
def
test_phase_mag_disc
(
self
):
'''
Test of the phase_mag_disc method.
'''
...
...
@@ -42,14 +42,14 @@ class TestCaseAnalytic(unittest.TestCase):
height
=
self
.
dim
[
2
]
/
2
phase
=
an
.
phase_mag_disc
(
self
.
dim
,
self
.
res
,
self
.
phi
,
self
.
center
,
radius
,
height
)
reference
=
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_phase_disc.npy
'
))
np
.
testing
.
assert_equal
(
phase
,
reference
,
'
Unexpected behavior in phase_mag_disc()
'
)
np
.
testing
.
assert_
almost_
equal
(
phase
,
reference
,
err_msg
=
'
Unexpected behavior in phase_mag_disc()
'
)
def
test_phase_mag_sphere
(
self
):
'''
Test of the phase_mag_sphere method.
'''
radius
=
self
.
dim
[
2
]
/
4
phase
=
an
.
phase_mag_sphere
(
self
.
dim
,
self
.
res
,
self
.
phi
,
self
.
center
,
radius
)
reference
=
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_phase_sphere.npy
'
))
np
.
testing
.
assert_equal
(
phase
,
reference
,
'
Unexpected behavior in phase_mag_sphere()
'
)
np
.
testing
.
assert_
almost_
equal
(
phase
,
reference
,
err_msg
=
'
Unexpected behavior in phase_mag_sphere()
'
)
def
test_phase_mag_vortex
(
self
):
'''
Test of the phase_mag_vortex method.
'''
...
...
@@ -57,7 +57,7 @@ class TestCaseAnalytic(unittest.TestCase):
height
=
self
.
dim
[
2
]
/
2
phase
=
an
.
phase_mag_vortex
(
self
.
dim
,
self
.
res
,
self
.
center
,
radius
,
height
)
reference
=
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_phase_vort.npy
'
))
np
.
testing
.
assert_equal
(
phase
,
reference
,
'
Unexpected behavior in phase_mag_vortex()
'
)
np
.
testing
.
assert_
almost_
equal
(
phase
,
reference
,
err_msg
=
'
Unexpected behavior in phase_mag_vortex()
'
)
if
__name__
==
'
__main__
'
:
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
TestCaseAnalytic
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_magcreator.py
+
22
−
22
View file @
9bbb954e
...
...
@@ -20,52 +20,52 @@ class TestCaseMagCreator(unittest.TestCase):
def
test_shape_slab
(
self
):
test_slab
=
mc
.
Shapes
.
slab
((
5
,
6
,
7
),
(
2
,
3
,
4
),
(
1
,
3
,
5
))
np
.
testing
.
assert_equal
(
test_slab
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_slab.npy
'
)),
'
Created slab does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_slab
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_slab.npy
'
)),
err_msg
=
'
Created slab does not match expectation!
'
)
def
test_shape_disc
(
self
):
test_disc_z
=
mc
.
Shapes
.
disc
((
5
,
6
,
7
),
(
2
,
3
,
4
),
2
,
3
,
'
z
'
)
test_disc_y
=
mc
.
Shapes
.
disc
((
5
,
6
,
7
),
(
2
,
3
,
4
),
2
,
3
,
'
y
'
)
test_disc_x
=
mc
.
Shapes
.
disc
((
5
,
6
,
7
),
(
2
,
3
,
4
),
2
,
3
,
'
x
'
)
np
.
testing
.
assert_equal
(
test_disc_z
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_disc_z.npy
'
)),
'
Created disc in z-direction does not match expectation!
'
)
np
.
testing
.
assert_equal
(
test_disc_y
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_disc_y.npy
'
)),
'
Created disc in y-direction does not match expectation!
'
)
np
.
testing
.
assert_equal
(
test_disc_x
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_disc_x.npy
'
)),
'
Created disc in x-direction does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_disc_z
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_disc_z.npy
'
)),
err_msg
=
'
Created disc in z-direction does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_disc_y
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_disc_y.npy
'
)),
err_msg
=
'
Created disc in y-direction does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_disc_x
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_disc_x.npy
'
)),
err_msg
=
'
Created disc in x-direction does not match expectation!
'
)
def
test_shape_sphere
(
self
):
test_sphere
=
mc
.
Shapes
.
sphere
((
5
,
6
,
7
),
(
2
,
3
,
4
),
2
)
np
.
testing
.
assert_equal
(
test_sphere
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_sphere.npy
'
)),
'
Created sphere does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_sphere
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_sphere.npy
'
)),
err_msg
=
'
Created sphere does not match expectation!
'
)
def
test_shape_filament
(
self
):
test_filament_z
=
mc
.
Shapes
.
filament
((
5
,
6
,
7
),
(
2
,
3
),
'
z
'
)
test_filament_y
=
mc
.
Shapes
.
filament
((
5
,
6
,
7
),
(
2
,
3
),
'
y
'
)
test_filament_x
=
mc
.
Shapes
.
filament
((
5
,
6
,
7
),
(
2
,
3
),
'
x
'
)
np
.
testing
.
assert_equal
(
test_filament_z
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_fil_z.npy
'
)),
'
Created filament in z-direction does not match expectation!
'
)
np
.
testing
.
assert_equal
(
test_filament_y
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_fil_y.npy
'
)),
'
Created filament in y-direction does not match expectation!
'
)
np
.
testing
.
assert_equal
(
test_filament_x
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_fil_x.npy
'
)),
'
Created filament in x-direction does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_filament_z
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_fil_z.npy
'
)),
err_msg
=
'
Created filament in z-direction does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_filament_y
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_fil_y.npy
'
)),
err_msg
=
'
Created filament in y-direction does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_filament_x
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_fil_x.npy
'
)),
err_msg
=
'
Created filament in x-direction does not match expectation!
'
)
def
test_shape_pixel
(
self
):
test_pixel
=
mc
.
Shapes
.
pixel
((
5
,
6
,
7
),
(
2
,
3
,
4
))
np
.
testing
.
assert_equal
(
test_pixel
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_pixel.npy
'
)),
'
Created pixel does not match expectation!
'
)
np
.
testing
.
assert_
almost_
equal
(
test_pixel
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_pixel.npy
'
)),
err_msg
=
'
Created pixel does not match expectation!
'
)
def
test_create_mag_dist_homog
(
self
):
mag_shape
=
mc
.
Shapes
.
disc
((
1
,
10
,
10
),
(
0
,
4.5
,
4.5
),
3
,
1
)
magnitude
=
mc
.
create_mag_dist_homog
(
mag_shape
,
pi
/
4
)
np
.
testing
.
assert_equal
(
magnitude
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_mag_disc.npy
'
)),
'
Created homog. magnetic distribution does not match expectation
'
)
np
.
testing
.
assert_
almost_
equal
(
magnitude
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_mag_disc.npy
'
)),
err_msg
=
'
Created homog. magnetic distribution does not match expectation
'
)
def
test_create_mag_dist_vortex
(
self
):
mag_shape
=
mc
.
Shapes
.
disc
((
1
,
10
,
10
),
(
0
,
4.5
,
4.5
),
3
,
1
)
magnitude
=
mc
.
create_mag_dist_vortex
(
mag_shape
)
np
.
testing
.
assert_equal
(
magnitude
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_mag_vort.npy
'
)),
'
Created vortex magnetic distribution does not match expectation
'
)
np
.
testing
.
assert_
almost_
equal
(
magnitude
,
np
.
load
(
os
.
path
.
join
(
self
.
path
,
'
ref_mag_vort.npy
'
)),
err_msg
=
'
Created vortex magnetic distribution does not match expectation
'
)
if
__name__
==
'
__main__
'
:
...
...
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