Skip to content
Snippets Groups Projects
Commit f62f0ab4 authored by Jan Caron's avatar Jan Caron
Browse files

Completed the restructuring of the package

scripts: changed scripts to work with the new syntax of the package
PhaseMag and MagData: added load and save options for NetCDF files
MagData: changed 3D-plotting to use mayavi (faster and better looking)
test: added more TestCases for various modules
phasemapper: added computation method to use mx and my (now standard)
compare_method_errors: first draft of script to compare the different errors
parent 9d34cde6
No related branches found
No related tags found
No related merge requests found
Showing
with 271 additions and 171 deletions
......@@ -3,38 +3,22 @@
import numpy as np
import matplotlib.pyplot as plt
from numpy import pi
PHI_0 = 2067.83 # magnetic flux in T*nm²
def plot_phase(phase, res, name):
fig = plt.figure()
ax = fig.add_subplot(111, aspect='equal')
plt.pcolormesh(phase, cmap='gray')
ticks = ax.get_xticks() * res
ax.set_xticklabels(ticks.astype(int))
ticks = ax.get_yticks() * res
ax.set_yticklabels(ticks.astype(int))
ax.set_title('Analytical Solution' + name)
ax.set_xlabel('x-axis [nm]')
ax.set_ylabel('y-axis [nm]')
plt.colorbar()
plt.show()
def phasemap_slab(dim, res, beta, center, width, b_0):
def phase_mag_slab(dim, res, beta, center, width, b_0):
'''INPUT VARIABLES'''
z_dim, y_dim, x_dim = dim
# y0, x0 have to be in the center of a pixel, hence: cellindex + 0.5
y0 = res * (center[0] + 0.5)
x0 = res * (center[1] + 0.5)
y0 = res * (center[1] + 0.5)
x0 = res * (center[2] + 0.5)
# Ly, Lx have to be odd, because the slab borders should not lie in the
# center of a pixel (so L/2 can't be an integer)
Ly = res * ( width[0] + (width[0]+1)%2)
Lx = res * ( width[1] + (width[1]+1)%2)
Ly = res * ( width[1] + (width[1]+1)%2)
Lx = res * ( width[2] + (width[2]+1)%2)
'''COMPUTATION MAGNETIC PHASE SHIFT (REAL SPACE) SLAB'''
......@@ -63,12 +47,12 @@ def phasemap_slab(dim, res, beta, center, width, b_0):
return phiMag(xx, yy)
def phasemap_disc(dim, res, beta, center, radius, b_0):
def phase_mag_disc(dim, res, beta, center, radius, b_0):
'''INPUT VARIABLES'''
y_dim, x_dim = dim
z_dim, y_dim, x_dim = dim
# y0, x0 have to be in the center of a pixel, hence: cellindex + 0.5
y0 = res * (center[0] + 0.5)
x0 = res * (center[1] + 0.5)
y0 = res * (center[1] + 0.5)
x0 = res * (center[2] + 0.5)
# TODO: Explanation
# Ly, Lx have to be odd, because the slab borders should not lie in the
# center of a pixel (so L/2 can't be an integer)
......@@ -82,7 +66,7 @@ def phasemap_disc(dim, res, beta, center, radius, b_0):
def phiMag(x,y):
r = np.hypot(x-x0, y-y0)
r[center[0], center[1]] = 1E-18
r[center[1], center[2]] = 1E-30
result = coeff * ((y-y0) * np.cos(beta) - (x-x0) * np.sin(beta))
in_or_out = 1 * (r < R) + (R / r) ** 2 * (r > R)
# import pdb; pdb.set_trace()
......@@ -97,7 +81,7 @@ def phasemap_disc(dim, res, beta, center, radius, b_0):
return phiMag(xx, yy)
def phasemap_sphere(dim, res, beta, center, radius, b_0):
def phase_mag_sphere(dim, res, beta, center, radius, b_0):
# TODO: Sphere is equivalent to disc, if only one pixel in z is used!
......
......@@ -118,7 +118,7 @@ class Shapes:
return mag_shape
@classmethod
def single_pixel(cls, dim, pixel):
def pixel(cls, dim, pixel):
'''Get the magnetic shape of a single magnetized pixel.
Arguments:
dim - the dimensions of the grid, shape(z, y, x)
......@@ -146,9 +146,9 @@ def create_mag_dist(mag_shape, beta, magnitude=1):
'''
dim = np.shape(mag_shape)
assert len(dim) == 3, 'Magnetic shapes must describe 3-dimensional distributions!'
z_mag = np.array(np.zeros(dim)) # TODO: Implement another angle!
y_mag = np.array(np.ones(dim)) * np.sin(beta) * mag_shape * magnitude
x_mag = np.array(np.ones(dim)) * np.cos(beta) * mag_shape * magnitude
z_mag = np.zeros(dim) # TODO: Implement another angle!
y_mag = np.ones(dim) * np.sin(beta) * mag_shape * magnitude
x_mag = np.ones(dim) * np.cos(beta) * mag_shape * magnitude
return z_mag, y_mag, x_mag
......
......@@ -3,9 +3,9 @@
import numpy as np
import tables.netcdf3 as nc
import matplotlib.pyplot as plt
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.mplot3d import proj3d
from mayavi import mlab
class MagData:
......@@ -74,10 +74,50 @@ class MagData:
# Save data to file:
data = np.array([xx, yy, zz, x_mag, y_mag, z_mag]).T
with open(filename,'w') as mag_file:
mag_file.write('LLGFileCreator2D: %s\n' % filename.replace('.txt', ''))
mag_file.write('LLGFileCreator: %s\n' % filename.replace('.txt', ''))
mag_file.write(' %d %d %d\n' % (dim[2], dim[1], dim[0]))
mag_file.writelines('\n'.join(' '.join('{:7.6e}'.format(cell)
for cell in row) for row in data) )
@classmethod
def load_from_netcdf(cls, filename):
'''Construct MagData object from a NetCDF-file (classmethod).
Arguments:
filename - name of the file from which to load the data
Returns:
PhaseMap object
'''
f = nc.NetCDFFile(filename, 'r')
res = getattr(f, 'res')
z_mag = f.variables['z_mag'].getValue()
y_mag = f.variables['y_mag'].getValue()
x_mag = f.variables['x_mag'].getValue()
f.close()
return MagData(res, (z_mag, y_mag, x_mag))
def save_to_netcdf(self, filename='..\output\magdata_output.nc'):
'''Save magnetization data in a file with NetCDF-format.
Arguments:
filename - the name of the file in which to store the phase map data
(default: 'phasemap_output.txt')
Returns:
None
'''
f = nc.NetCDFFile(filename, 'w')
setattr(f, 'res', self.res)
f.createDimension('z_dim', self.dim[0])
f.createDimension('y_dim', self.dim[1])
f.createDimension('x_dim', self.dim[2])
z_mag = f.createVariable('z_mag', 'f', ('z_dim', 'y_dim', 'x_dim'))
y_mag = f.createVariable('y_mag', 'f', ('z_dim', 'y_dim', 'x_dim'))
x_mag = f.createVariable('x_mag', 'f', ('z_dim', 'y_dim', 'x_dim'))
z_mag[:] = self.magnitude[0]
y_mag[:] = self.magnitude[1]
x_mag[:] = self.magnitude[2]
print f
f.close()
def quiver_plot(self, axis='z', ax_slice=0):
'''Plot a slice of the magnetization as a quiver plot.
......@@ -111,23 +151,10 @@ class MagData:
Returns:
None
'''
class Arrow3D(FancyArrowPatch):
'''Class representing one magnetization vector.'''
def __init__(self, xs, ys, zs, *args, **kwargs):
FancyArrowPatch.__init__(self, (0, 0), (0, 0), *args, **kwargs)
self._verts3d = xs, ys, zs
def draw(self, renderer):
xs3d, ys3d, zs3d = self._verts3d
xs, ys = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)[:-1]
self.set_positions((xs[0], ys[0]), (xs[1], ys[1]))
FancyArrowPatch.draw(self, renderer)
'''
res = self.res
dim = self.dim
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.set_aspect("equal")
# Create 3D meshgrid and reshape it and the magnetization into a list where x varies first:
# Create points and vector components as lists:
zz, yy, xx = np.mgrid[res/2 : (dim[0]*res-res/2) : dim[0]*1j,
res/2 : (dim[1]*res-res/2) : dim[1]*1j,
res/2 : (dim[2]*res-res/2) : dim[2]*1j]
......@@ -137,15 +164,8 @@ class MagData:
x_mag = np.reshape(self.magnitude[2], (-1))
y_mag = np.reshape(self.magnitude[1], (-1))
z_mag = np.reshape(self.magnitude[0], (-1))
# Add every individual magnetization vector:
for i in range(np.size(xx)):
xs = [xx[i] - x_mag[i]*res/2, xx[i] + x_mag[i]*res/2]
ys = [yy[i] - y_mag[i]*res/2, yy[i] + y_mag[i]*res/2]
zs = [zz[i] - z_mag[i]*res/2, zz[i] + z_mag[i]*res/2]
a = Arrow3D(xs, ys, zs, mutation_scale=10, lw=1, arrowstyle="-|>", color="k")
ax.add_artist(a)
# Rescale the axes and show plot:
ax.set_xlim3d(0, xx[-1]+res/2)
ax.set_ylim3d(0, yy[-1]+res/2)
ax.set_zlim3d(0, zz[-1]+res/2)
plt.show()
\ No newline at end of file
# Plot them as vectors:
plot = mlab.quiver3d(xx, yy, zz, x_mag, y_mag, z_mag, mode='arrow', scale_factor=10.0)
mlab.outline(plot)
mlab.axes(plot)
mlab.colorbar()
\ No newline at end of file
......@@ -4,6 +4,7 @@
import numpy as np
import matplotlib.pyplot as plt
import tables.netcdf3 as nc
class PhaseMap:
......@@ -27,8 +28,8 @@ class PhaseMap:
self.phase = phase
@classmethod
def load_from_file(cls, filename):
'''Construct PhaseMap object from file (classmethod).
def load_from_txt(cls, filename):
'''Construct PhaseMap object from a human readable txt-file (classmethod).
Arguments:
filename - name of the file from which to load the data
Returns.
......@@ -41,8 +42,8 @@ class PhaseMap:
phase = np.loadtxt(filename, delimiter=' ', skiprows=2)
return PhaseMap(res, phase)
def save_to_file(self, filename='phasemap_output.txt'):
'''Save magnetization data in a file with LLG-format.
def save_to_txt(self, filename='..\output\phasemap_output.txt'):
'''Save PhaseMap data in a file with txt-format.
Arguments:
filename - the name of the file in which to store the phase map data
(default: 'phasemap_output.txt')
......@@ -53,7 +54,39 @@ class PhaseMap:
with open(filename, 'w') as f:
f.write('{}\n'.format(filename.replace('.txt', '')))
f.write('resolution = {} nm\n'.format(self.res))
np.savetxt(f, self.phase, fmt='%7.6e', delimiter=' ')
np.savetxt(f, self.phase, fmt='%7.6e', delimiter=' ')
@classmethod
def load_from_netcdf(cls, filename):
'''Construct PhaseMap object from a NetCDF-file (classmethod).
Arguments:
filename - name of the file from which to load the data
Returns:
PhaseMap object
'''
f = nc.NetCDFFile(filename, 'r')
res = getattr(f, 'res')
phase = f.variables['phase'].getValue()
f.close()
return PhaseMap(res, phase)
def save_to_netcdf(self, filename='..\output\phasemap_output.nc'):
'''Save PhaseMap data in a file with NetCDF-format.
Arguments:
filename - the name of the file in which to store the phase map data
(default: 'phasemap_output.txt')
Returns:
None
'''
f = nc.NetCDFFile(filename, 'w')
setattr(f, 'res', self.res)
f.createDimension('v_dim', self.dim[0])
f.createDimension('u_dim', self.dim[1])
phase = f.createVariable('phase', 'f', ('v_dim', 'u_dim'))
phase[:] = self.phase
f.close()
def display(self, title='Phase Map', axis=None, cmap='gray'):
'''Display the phasemap as a colormesh.
......
......@@ -57,13 +57,67 @@ def phase_mag_real(res, projection, method, b_0=1, jacobi=None):
projection - projection of a magnetic distribution (created with pyramid.projector)
method - String, describing the method to use for the pixel field ('slab' or 'disc')
b_0 - magnetic induction corresponding to a magnetization Mo in T (default: 1)
padding - factor for zero padding, the default is 0 (no padding), for a factor of n the
number of pixels is increase by (1+n)**2, padded zeros are cropped at the end
jacobi - matrix in which to save the jacobi matrix (default: None, faster computation)
Returns:
the phasemap as a 2 dimensional array
'''# TODO: Docstring!
def phi_lookup(method, n, m, res, b_0): # TODO: rename
'''
def phi_lookup(method, n, m, res, b_0):
if method == 'slab':
def F_h(n, m):
a = np.log(res**2 * (n**2 + m**2))
b = np.arctan(n / m)
return n*a - 2*n + 2*m*b
return coeff * 0.5 * ( F_h(n-0.5, m-0.5) - F_h(n+0.5, m-0.5)
-F_h(n-0.5, m+0.5) + F_h(n+0.5, m+0.5) )
elif method == 'disc':
in_or_out = np.logical_not(np.logical_and(n == 0, m == 0))
return coeff * m / (n**2 + m**2 + 1E-30) * in_or_out
# def phi_mag(i, j): # TODO: rename
# return (np.cos(beta[j,i])*phi_u[v_dim-1-j:(2*v_dim-1)-j, u_dim-1-i:(2*u_dim-1)-i]
# -np.sin(beta[j,i])*phi_v[v_dim-1-j:(2*v_dim-1)-j, u_dim-1-i:(2*u_dim-1)-i])
#
# def phi_mag_deriv(i, j): # TODO: rename
# return -(np.sin(beta[j,i])*phi_u[v_dim-1-j:(2*v_dim-1)-j, u_dim-1-i:(2*u_dim-1)-i]
# +np.cos(beta[j,i])*phi_v[v_dim-1-j:(2*v_dim-1)-j, u_dim-1-i:(2*u_dim-1)-i])
# Process input parameters:
v_dim, u_dim = np.shape(projection[0])
v_mag, u_mag = projection
coeff = -b_0 * res**2 / ( 2 * PHI_0 )
# Create lookup-tables for the phase of one pixel:
u = np.linspace(-(u_dim-1), u_dim-1, num=2*u_dim-1)
v = np.linspace(-(v_dim-1), v_dim-1, num=2*v_dim-1)
uu, vv = np.meshgrid(u, v)
phi_u = phi_lookup(method, uu, vv, res, b_0)
phi_v = phi_lookup(method, vv, uu, res, b_0)
'''CALCULATE THE PHASE'''
phase = np.zeros((v_dim, u_dim))
for j in range(v_dim): # TODO: only iterate over pixels that have a magn. > threshold (first >0)
for i in range(u_dim):
if (u_mag[j,i] != 0 and v_mag[j,i] != 0) or jacobi is not None: # TODO: same result with or without?
phase_u = phi_u[v_dim-1-j:(2*v_dim-1)-j, u_dim-1-i:(2*u_dim-1)-i]
phase_v = phi_v[v_dim-1-j:(2*v_dim-1)-j, u_dim-1-i:(2*u_dim-1)-i]
phase += u_mag[j,i]*phase_u - v_mag[j,i]*phase_v
if jacobi is not None:
jacobi[:,i+u_dim*j] = phase_u.reshape(-1)
jacobi[:,u_dim*v_dim+i+u_dim*j] = -phase_v.reshape(-1)
return phase
def phase_mag_real_ANGLE(res, projection, method, b_0=1, jacobi=None): # TODO: Modify
'''Calculate phasemap from magnetization data (real space approach).
Arguments:
res - the resolution of the grid (grid spacing) in nm
projection - projection of a magnetic distribution (created with pyramid.projector)
method - String, describing the method to use for the pixel field ('slab' or 'disc')
b_0 - magnetic induction corresponding to a magnetization Mo in T (default: 1)
jacobi - matrix in which to save the jacobi matrix (default: None, faster computation)
Returns:
the phasemap as a 2 dimensional array
'''
def phi_lookup(method, n, m, res, b_0):
if method == 'slab':
def F_h(n, m):
a = np.log(res**2 * (n**2 + m**2))
......
......@@ -18,14 +18,14 @@ def simple_axis_projection(mag_data, axis='z'):
assert isinstance(mag_data, MagData), 'Parameter mag_data has to be a MagData object!'
assert axis == 'z' or axis == 'y' or axis == 'x', 'Axis has to be x, y or z (as String)!'
if axis == 'z':
projection = (mag_data.magnitude[1].mean(0) * mag_data.dim[0], # y_mag -> v_mag
mag_data.magnitude[2].mean(0) * mag_data.dim[0]) # x_mag -> u_mag
projection = (mag_data.magnitude[1].sum(0), # y_mag -> v_mag
mag_data.magnitude[2].sum(0)) # x_mag -> u_mag
elif axis == 'y':
projection = (mag_data.magnitude[0].mean(1) * mag_data.dim[1], # z_mag -> v_mag
mag_data.magnitude[2].mean(1) * mag_data.dim[1]) # x_mag -> u_mag
projection = (mag_data.magnitude[0].sum(1), # z_mag -> v_mag
mag_data.magnitude[2].sum(1)) # x_mag -> u_mag
elif axis == 'x':
projection = (mag_data.magnitude[0].mean(2) * mag_data.dim[2], # y_mag -> v_mag
mag_data.magnitude[1].mean(2) * mag_data.dim[2]) # x_mag -> u_mag
projection = (mag_data.magnitude[0].sum(2), # z_mag -> v_mag
mag_data.magnitude[1].sum(2)) # y_mag -> u_mag
return projection
......
......@@ -4,9 +4,15 @@ Unittests for pyramid.
"""
import unittest
import sys
from test_dataloader import *
from test_compliance import *
from test_compliance import TestCaseCompliance
from test_magcreator import TestCaseMagCreator
from test_magdata import TestCaseMagData
from test_projector import TestCaseProjector
from test_phasemapper import TestCasePhaseMapper
from test_phasemap import TestCasePhaseMap
from test_holoimage import TestCaseHoloImage
from test_analytic import TestCaseAnalytic
from test_reconstructor import TestCaseReconstructor
def run():
......@@ -15,60 +21,17 @@ def run():
loader = unittest.TestLoader()
runner = unittest.TextTestRunner(verbosity=2)
suite.addTest(loader.loadTestsFromTestCase(TestCaseDataloader))
suite.addTest(loader.loadTestsFromTestCase(TestCaseCompliance))
suite.addTest(loader.loadTestsFromTestCase(TestCaseMagCreator))
suite.addTest(loader.loadTestsFromTestCase(TestCaseMagData))
suite.addTest(loader.loadTestsFromTestCase(TestCaseProjector))
suite.addTest(loader.loadTestsFromTestCase(TestCasePhaseMapper))
suite.addTest(loader.loadTestsFromTestCase(TestCasePhaseMap))
suite.addTest(loader.loadTestsFromTestCase(TestCaseHoloImage))
suite.addTest(loader.loadTestsFromTestCase(TestCaseAnalytic))
suite.addTest(loader.loadTestsFromTestCase(TestCaseReconstructor))
runner.run(suite)
#TODO: why that?
# result = runner.run(suite)
# if result.wasSuccessful():
# sys.exit(0)
# else:
# sys.exit(1)
if __name__ == '__main__':
run()
#if __name__ == '__main__':
# suite = unittest.TestLoader().loadTestsFromTestCase(TestSuite)
# unittest.TextTestRunner(verbosity=2).run(suite)
''' GLORIPY VERSION '''
##! /usr/bin/python
#"""
#Unittests for pyjurassic.
#"""
#
#import unittest
#import os
#import sys
#import tests
#
#
#def main():
# all_tests = unittest.TestSuite()
# tl = unittest.defaultTestLoader
# if os.getenv("BOOST_TESTS_TO_RUN") is not None:
# return
# elif os.getenv("PYTHON_TESTS_TO_RUN") is None:
# all_tests.addTest(tl.loadTestsFromName("tests"))
# else:
# all_tests.addTest(tl.loadTestsFromName(os.getenv("PYTHON_TESTS_TO_RUN")))
#
# runner = unittest.TextTestRunner(verbosity=2)
# res = runner.run(all_tests)
# if res.wasSuccessful():
# sys.exit(0)
# else:
# sys.exit(1)
#
#
#if __name__ == '__main__':
# main()
\ No newline at end of file
run()
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 24 07:10:28 2013
"""Testcase for the analytic module."""
@author: Jan
"""
# py.test
import unittest
import pyramid.analytic as an
class TestSuite(unittest.TestCase):
class TestCaseAnalytic(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test(self):
self.assertTrue(True)
def test_almost(self):
self.assertAlmostEqual(0, 0.01, places=1)
def test_template(self):
pass
def test_phase_mag_slab(self):
pass
def test_phase_mag_disc(self):
pass
def test_phase_mag_sphere(self):
pass
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSuite)
suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseAnalytic)
unittest.TextTestRunner(verbosity=2).run(suite)
\ No newline at end of file
# -*- coding: utf-8 -*-
"""Testcase for the magcreator module."""
import os
import unittest
class TestCompliance(unittest.TestCase):
class TestCaseCompliance(unittest.TestCase):
"""
Class for checking compliance of pyjurassic.
"""
......
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 24 07:10:28 2013
"""Testcase for the holoimage module."""
@author: Jan
"""
# py.test
import unittest
import pyramid.holoimage as hi
class TestSuite(unittest.TestCase):
class TestCaseHoloImage(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test(self):
self.assertTrue(True)
def test_almost(self):
self.assertAlmostEqual(0, 0.01, places=1)
def test_holo_image(self):
pass
def test_make_color_wheel(self):
pass
def test_display(self):
pass
def test_display_combined(self):
pass
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSuite)
suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseHoloImage)
unittest.TextTestRunner(verbosity=2).run(suite)
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 24 07:10:28 2013
"""Testcase for the magcreator module."""
@author: Jan
"""
# py.test
import unittest
import numpy as np
import pyramid.magcreator as mc
class TestSuite(unittest.TestCase):
# TODO: Proper messages
class TestCaseMagCreator(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test(self):
self.assertTrue(True)
def test_almost(self):
self.assertAlmostEqual(0, 0.01, places=1)
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('test_magcreator/ref_slab.npy'),
'Testmessage')
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('test_magcreator/ref_disc_z.npy'),
'Testmessage')
np.testing.assert_equal(test_disc_y, np.load('test_magcreator/ref_disc_y.npy'),
'Testmessage')
np.testing.assert_equal(test_disc_x, np.load('test_magcreator/ref_disc_x.npy'),
'Testmessage')
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('test_magcreator/ref_sphere.npy'),
'Testmessage')
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('test_magcreator/ref_filament_z.npy'),
'Testmessage')
np.testing.assert_equal(test_filament_y, np.load('test_magcreator/ref_filament_y.npy'),
'Testmessage')
np.testing.assert_equal(test_filament_x, np.load('test_magcreator/ref_filament_x.npy'),
'Testmessage')
def test_shape_pixel(self):
test_pixel = mc.Shapes.pixel((5,6,7), (2,3,4))
np.testing.assert_equal(test_pixel, np.load('test_magcreator/ref_pixel.npy'),
'Testmessage')
def test_create_mag_dist(self):
pass
def test_create_mag_dist_comb(self):
pass
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSuite)
suite = unittest.TestLoader().loadTestsFromTestCase(TestCaseMagCreator)
unittest.TextTestRunner(verbosity=2).run(suite)
\ No newline at end of file
File added
File added
File added
File added
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment