Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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 = 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]

    global dist
    dist = srf1.distance(srf2)
    dist = 0.035  # Distance ohne Delooping!
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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))
Ejemplo n.º 6
0
def mini_topsim(config_file=None):
    """
    Loads parameters from config_file, starts the sim, plots and writes to file

    :param config_file: config_file with simulation parameters


    Loads parameters from config_file.   
    If no config_file is passed passed, None is returned.
    Creates a Surface Object and starts the simulation. 
    The correct timestep is calculated with the timestep function 
    from the advance module. 
    
    If a *.srf_save file with the same filename exists, the plot function with
    both surfaces is called.

    """
    print('Running miniTopSim ...')

    if config_file is None:
        if len(sys.argv) > 1:
            config_filename = sys.argv[1]
        else:
            sys.exit('No Config file passed')
            # config_filename = 'cosine.cfg'

        config_file = config_filename

    if not config_file.endswith('.cfg'):
        print('Error: Incorrect config.')
        sys.exit()

    filename = os.path.splitext(config_file)[0] + '.srf'

    if os.path.exists(filename):
        os.remove(filename)

    par.load_parameters(config_file)
    dir_path = os.path.dirname(os.path.realpath(config_file))
    par.INITIAL_SURFACE_FILE = os.path.join(dir_path, par.INITIAL_SURFACE_FILE)

    tend = par.TOTAL_TIME
    dt = par.TIME_STEP

    surface = Surface()

    # Initialize beam profile
    init_beam_profile()

    sputter.init_sputtering()
    time = 0
    start_simulation_time = currenttime()

    while time < tend:
        surface.write(time, filename)
        dtime = timestep(dt, time, tend)
        advance(surface, dtime)
        surface.eliminate_overhangs()
        time += dtime

    stop_simulation_time = currenttime()
    simulation_time = stop_simulation_time - start_simulation_time
    print('The Simulation took: {}s'.format(float(simulation_time)))
    surface.write(time, filename)

    filename_save = filename + '_save'

    if par.PLOT_SURFACE:
        if os.path.exists(filename_save):
            print('*.srf_save file exists... plotting both!')
            plot.plot(filename, filename_save)
        else:
            plot.plot(filename)
Ejemplo n.º 7
0
def mini_topsim_timing():
    """
    Reads the Simulation parameters, starts the sim, plots and writes to file

    the first sys.argv[1] is the config file name.

    if no sys argument is passed the programm will stop.
    Writes all calculated datapoints to a file with the
    filenname: <config_file_name>.srf

    """
    print('Running miniTopSim ...')

    if len(sys.argv) > 1:
        config_filename = sys.argv[1]
    else:
        print("Error: No config passed.")
        sys.exit()

    config_file = os.path.join(os.path.dirname(__file__), config_filename)

    if not config_file.endswith('.cfg'):
        print('Error: Incorrect config.')
        sys.exit()

    filename = os.path.splitext(config_file)[0] + '.srf'

    if os.path.exists(filename):
        os.remove(filename)

    par.load_parameters(config_file)

    tend = par.TOTAL_TIME
    dt = par.TIME_STEP
    par.DELTA_X = 10
    simulation_time_array = np.empty((2, 0))

    while par.DELTA_X > 0.2:
        # print(par.DELTA_X)
        surface = Surface()
        time = 0
        start_simulation_time = currenttime()
        while time < tend:
            surface.write(time, filename)
            dtime = timestep(dt, time, tend)
            advance(surface, dtime)
            time += dtime

        stop_simulation_time = currenttime()
        simulation_time = stop_simulation_time - start_simulation_time
        simulation_time_array = np.append(simulation_time_array,
                                          np.array(
                                              (int(100 / par.DELTA_X),
                                               simulation_time)).reshape(2, 1),
                                          axis=1)
        # print('The Simulation took: {}s'.format(float(simulation_time)))
        # print(np.array((int(100/par.DELTA_X))))
        # print(par.DELTA_X)
        surface.write(time, filename)
        par.DELTA_X = par.DELTA_X - 0.6
        # print(par.DELTA_X)

    plt.title('Simulationtime in dependence of the number of points')
    plt.plot(simulation_time_array[0], simulation_time_array[1], 'b+-')
    plt.xscale('log')
    plt.yscale('log')
    plt.xlabel('Number of points')
    plt.ylabel('Time in Seconds')
    plt.grid(which='both')
    plt.show()
    if par.PLOT_SURFACE:
        plot.plot(filename)