def test_1d_aps_slope_error(self): mirror_length = 200.0 step = 1.0 random_seed = 898882 rms = 1e-7 # units mm wName_x, wName = create_simulated_1D_file_APS( mirror_length=mirror_length, step=step, random_seed=random_seed, error_type=SLOPE_ERROR, rms=rms) slopes = numpy.gradient(wName, wName_x[1] - wName_x[0]) print( "test_1d: test function: %s, SLOPES Stdev: input=%g, obtained=%g" % ("test_1d_aps_figure_error", rms, slopes.std())) assert numpy.abs(rms - slopes.std()) < 0.01 * numpy.abs(rms) if do_plot: from srxraylib.plot.gol import plot plot(wName_x, slopes, title="test_1d_aps_slope_error", xtitle="Y", ytitle="slopes Z'")
def test_1d_gaussian_figure_error(self): mirror_length = 200.0 step = 1.0 rms = 1e-7 correlation_length = 10.0 x, f = simulate_profile_1D_gaussian(step=step, \ mirror_length=mirror_length, \ rms_heights=rms, \ correlation_length=correlation_length,\ renormalize_to_heights_sd=None) slopes = numpy.gradient(f, x[1] - x[0]) print( "test_1d_gaussian: test function: %s, Stdev (not normalized): HEIGHTS=%g.SLOPES=%g" % ("test_1d_gaussian_figure_error", f.std(), slopes.std())) x, f = simulate_profile_1D_gaussian(step=step, \ mirror_length=mirror_length, \ rms_heights=rms, \ correlation_length=correlation_length,\ renormalize_to_heights_sd=rms) print( "test_1d_gaussian: test function: %s, HEIGHTS Stdev (normalized to %g)=%g" % ("test_1d_gaussian_figure_error", rms, f.std())) assert numpy.abs(rms - f.std()) < 0.01 * numpy.abs(rms) if do_plot: from srxraylib.plot.gol import plot plot(x, f, title="test_1d_gaussian_figure_error", xtitle="Y", ytitle="heights profile Z")
def test_1d_gaussian_slope_error(self): mirror_length=200.0 step=1.0 rms_slopes=1.3e-7 rms_heights = 1e-7 correlation_length = 10.0 x, f = simulate_profile_1D_gaussian(step=step, \ mirror_length=mirror_length, \ rms_heights=rms_heights, \ correlation_length=correlation_length,\ renormalize_to_slopes_sd=None) slopes = numpy.gradient(f, x[1]-x[0]) print("test_1d_gaussian: test function: %s, Stdev (not normalized): HEIGHTS=%g.SLOPES=%g"%("test_1d_gaussian_slope_error",f.std(),slopes.std())) x, f = simulate_profile_1D_gaussian(step=step, \ mirror_length=mirror_length, \ rms_heights=rms_heights, \ correlation_length=correlation_length,\ renormalize_to_slopes_sd=rms_slopes) slopes = numpy.gradient(f, x[1]-x[0]) print("test_1d_gaussian: test function: %s, SLOPES Stdev (normalized to %g)=%g"%("test_1d_gaussian_slope_error",rms_slopes,slopes.std())) assert numpy.abs( rms_slopes - slopes.std() ) < 0.01 * numpy.abs(rms_slopes) if do_plot: from srxraylib.plot.gol import plot plot(x,slopes,title="test_1d_gaussian_slope_error",xtitle="Y",ytitle="slopes Z'")
def test_1d_fractal_slope_error(self): mirror_length = 200.0 step = 1.0 rms = 3e-6 x, f = simulate_profile_1D_fractal(step=step, mirror_length=mirror_length, renormalize_to_slopes_sd=rms) slopes = numpy.gradient(f, x[1] - x[0]) print("%s, SLOPES Stdev: input=%g, obtained=%g" % ("test_1d_fractal_slope_error", rms, slopes.std())) assert numpy.abs(rms - slopes.std()) < 0.01 * numpy.abs(rms) if do_plot: from srxraylib.plot.gol import plot plot(x, slopes, title="test_1d_fractal_slope_error", xtitle="Y", ytitle="slopes Z'")
def test_1d_fractal_slope_error(self): mirror_length=200.0 step=1.0 rms=3e-6 x, f = simulate_profile_1D_fractal(step=step,mirror_length=mirror_length, renormalize_to_slopes_sd=rms) slopes = numpy.gradient(f, x[1]-x[0]) print("%s, SLOPES Stdev: input=%g, obtained=%g"%("test_1d_fractal_slope_error",rms,slopes.std())) assert numpy.abs( rms - slopes.std() ) < 0.01 * numpy.abs(rms) if do_plot: from srxraylib.plot.gol import plot plot(x,slopes,title="test_1d_fractal_slope_error",xtitle="Y",ytitle="slopes Z'")
def test_1d_aps_slope_error(self): mirror_length=200.0 step=1.0 random_seed=898882 rms=1e-7 # units mm wName_x,wName = create_simulated_1D_file_APS(mirror_length=mirror_length,step=step, random_seed=random_seed, error_type=SLOPE_ERROR, rms=rms) slopes = numpy.gradient(wName, wName_x[1]-wName_x[0]) print("test_1d: test function: %s, SLOPES Stdev: input=%g, obtained=%g"%("test_1d_aps_figure_error",rms,slopes.std())) assert numpy.abs( rms - slopes.std() ) < 0.01 * numpy.abs(rms) if do_plot: from srxraylib.plot.gol import plot plot(wName_x,slopes,title="test_1d_aps_slope_error",xtitle="Y",ytitle="slopes Z'")