def test_erf_1(): """ Compares the the values from erf_1.cfg and erf_1.srf_save through distance :return: """ srf_filename_1 = os.path.join(filedir, 'erf_1.srf') srf_filename_2 = os.path.join(filedir, 'erf_1.srf_save') srfplotter = srfplot._SurfacePlotter(srf_filename_1, srf_filename_2) srf1 = Surface() srf1.xvals = srfplotter.xpoints_list[-1] srf1.yvals = srfplotter.ypoints_list[-1] srf2 = Surface() srf2.xvals = srfplotter.refsrf.xpoints_list[-1] srf2.yvals = srfplotter.refsrf.ypoints_list[-1] dist = srf1.distance(srf2) assert len(srf1.xvals) == len(srf2.xvals), \ 'number of x-values from simulation and erf_1.srf_save do not match' assert len(srf1.yvals) == len(srf2.yvals), \ 'number of y-values from simulation and erf_1.srf_save do not match' assert dist <= 0.005, \ 'values from simulation and erf_1.srf_save do not match' \ + ' distance %.3f is too great' % dist
def test_calc_distance(): """ calculates distance between surfaces and tests it with treshold value calculates distance between cosine.srf and cosine.srf_save and tests it with treshold value calculated in calc_distance """ srf_filename1 = os.path.join(filedir,'cosine.srf') srf_filename2 = os.path.join(filedir,'cosine.srf_save') srfplotter = srfplt._SurfacePlotter(srf_filename1, srf_filename2) srf1 = Surface() srf1.xvals = srfplotter.xpoints_list[-1] srf1.yvals = srfplotter.ypoints_list[-1] srf2 = Surface() srf2.xvals = srfplotter.refsrf.xpoints_list[-1] srf2.yvals = srfplotter.refsrf.ypoints_list[-1] dist = srf1.distance(srf2) assert dist <= 1e-9
def calc_distance(): """ calculates distance between etch_dx1.srf and etch_dx1.srf_save """ srf_filename1 = os.path.join(filedir,'etch_dx1.srf') srf_filename2 = os.path.join(filedir,'etch_dx0_125.srf_save') srfplotter = srfplt._SurfacePlotter(srf_filename1, srf_filename2) srf1 = Surface() srf1.xvals, srf1.yvals = (srfplotter.xpoints_list[-1], srfplotter.ypoints_list[-1]) srf2 = Surface() srf2.xvals = srfplotter.refsrf.xpoints_list[-1] srf2.yvals = srfplotter.refsrf.ypoints_list[-1] global dist dist = srf1.distance(srf2) dist = 0.035 # Distance ohne Delooping!
def test_calc_distance(calc_distance): """ calculates distance between surfaces and tests it with treshold value calculates distance between etch_dx1.srf and etch_dx1.srf_save and tests it with treshold value calculated in calc_distance """ srf_filename1 = os.path.join(filedir, 'etch_dx1.srf') srf_filename2 = os.path.join(filedir, 'etch_dx1.srf_save') srfplotter = srfplt._SurfacePlotter(srf_filename1, srf_filename2) srf1 = Surface() srf1.xvals = srfplotter.xpoints_list[-1] srf1.yvals = srfplotter.ypoints_list[-1] srf2 = Surface() srf2.xvals = srfplotter.refsrf.xpoints_list[-1] srf2.yvals = srfplotter.refsrf.ypoints_list[-1] assert srf1.distance(srf2) <= 0.5 * dist
import os, sys filedir = os.path.dirname(__file__) codedir = os.path.join(filedir, '..', '..', 'mini_topsim') sys.path.insert(0, codedir) import mini_topsim.plot as srfplt from mini_topsim.surface import Surface from mini_topsim.main import par srf_filename1 = os.path.join(filedir, 'etch_dx0_125.srf') srf_filename2 = os.path.join(filedir, 'etch_dx1.srf') srfplotter = srfplt._SurfacePlotter(srf_filename1, srf_filename2) par.load_parameters(os.path.join(filedir, 'etch_dx0_125.cfg')) srf1 = Surface() srf1.xvals = srfplotter.xpoints_list[-1] srf1.yvals = srfplotter.ypoints_list[-1] par.load_parameters(os.path.join(filedir, 'etch_dx1.cfg')) srf2 = Surface() srf2.xvals = srfplotter.refsrf.xpoints_list[-1] srf2.yvals = srfplotter.refsrf.ypoints_list[-1] print('Surface distance dx0_125 to dx1 = %.5f' % srf1.distance(srf2)) print('Surface distance dx1 to dx0_125 = %.5f' % srf2.distance(srf1))