def test_adapt(): import os import sys dirname = os.path.dirname(os.path.abspath(__file__)) main_dir = os.path.join(dirname, os.path.pardir, os.path.pardir) code_dir = os.path.join(main_dir, "code") sys.path.insert(0, code_dir) import numpy as np import surface srf = surface.load(os.path.join(dirname, 'cosine.srf_save')) x = np.array(srf.x) y = np.array(srf.y) x_dist = x[1:] - x[:-1] y_dist = y[1:] - y[:-1] dist = np.abs(np.sqrt(x_dist**2 + y_dist**2)) assert np.all(dist <= 2.01) normals_x, normals_y = np.array(srf.normal()) angles = np.angle(normals_x + 1j * normals_y, deg=True) angles_diff = angles[1:] - angles[:-1] assert np.all(angles_diff <= 10.)
def test_erf(): import os import sys dirname = os.path.dirname(os.path.abspath(__file__)) main_dir = os.path.join(dirname, os.path.pardir, os.path.pardir) code_dir = os.path.join(main_dir, "code") sys.path.insert(0, code_dir) import plot_beam import surface as surf import parameters as par config_file = os.path.join(dirname, 'erf.cfg') par.set_parameters(config_file) # cfg overwrites par.INITIAL_SURFACE_TYPE = 'Flat' par.TOTAL_TIME = 1 # par.BEAM_CURRENT = 1e-12 par.XMAX = 500 par.XMIN = -500 filename, surface = plot_beam.simulate(config_file, False) if os.path.isfile(filename + '_save'): surface_save = surf.load(filename + '_save') else: raise FileNotFoundError(filename + '_save not found') distance = surface.distance(surface_save) assert distance < 0.00292933136297
def test_cosine_vert(): import os import sys filedir = os.path.dirname(os.path.abspath(__file__)) codedir = os.path.join(filedir, '..', '..', 'code') sys.path.insert(0, codedir) import miniTopSim import surface saved = surface.load(os.path.join(filedir, 'cosine_vert.srf_save')) simulated = miniTopSim.simulate(os.path.join(filedir, 'cosine_vert.cfg'), False) assert simulated.distance(saved) == 0.
def test_cosine(): import os import sys dirname = os.path.dirname(os.path.abspath(__file__)) main_dir = os.path.join(dirname, os.path.pardir, os.path.pardir) code_dir = os.path.join(main_dir, "code") sys.path.insert(0, code_dir) import miniTopSim import surface import plot simulated = miniTopSim.simulate(os.path.join(dirname, 'cosine.cfg'), False) saved = surface.load(os.path.join(dirname, 'cosine.srf_save')) assert simulated.distance(saved) < 0.001
def test_etch_1_vs_1(): import os import sys dirname = os.path.dirname(os.path.abspath(__file__)) main_dir = os.path.join(dirname, os.path.pardir, os.path.pardir) code_dir = os.path.join(main_dir, "code") sys.path.insert(0, code_dir) import miniTopSim import surface import plot simulated = miniTopSim.simulate(os.path.join(dirname, 'etch_dx1.cfg'), False) saved = surface.load(os.path.join(dirname, 'etch_dx1.srf_save')) #measured value: (formerly: 0.0135894565864) assert simulated.distance(saved) < 0.00292933136297 #(formerly: 0.0027584)
def test_raster_scan(): import os import sys dirname = os.path.dirname(os.path.abspath(__file__)) main_dir = os.path.join(dirname, os.path.pardir, os.path.pardir) code_dir = os.path.join(main_dir, "code") sys.path.insert(0, code_dir) import miniTopSim import surface as surf import parameters as par config_file = os.path.join(dirname, 'raster_scan_1.cfg') par.set_parameters(config_file) '''filename,''' sim = miniTopSim.simulate(config_file, True) surface_save = surf.load(os.path.join(dirname, 'raster_scan_1.srf_save')) assert sim.distance(surface_save) < 0.00292
def test_etch_1_vs_0_125(): import os import sys dirname = os.path.dirname(os.path.abspath(__file__)) main_dir = os.path.join(dirname, os.path.pardir, os.path.pardir) code_dir = os.path.join(main_dir, "code") sys.path.insert(0, code_dir) import miniTopSim import surface import plot simulated = miniTopSim.simulate(os.path.join(dirname, 'etch_dx1.cfg'), False) saved = surface.load(os.path.join(dirname, 'etch_dx0_125.srf_save')) #measured value: 0.0135894565864 #new measured value (using deloop): 0.0055168003680422344 #still newer value: 0.00585866272594 assert simulated.distance(saved) > 0.00292933136297 #0.0027584
import os import sys dirname = os.path.dirname(os.path.abspath(__file__)) main_dir = os.path.join(dirname, os.path.pardir, os.path.pardir) code_dir = os.path.join(main_dir, "code") sys.path.insert(0, code_dir) import surface surface1 = surface.load('etch_dx0_125.srf') surface2 = surface.load('etch_dx1.srf') print('Distance = ', surface1.distance(surface2))