Exemplo n.º 1
0
def example_beam_stopper(do_plot=True):

    src = SourceGaussian.initialize_collimated_source(number_of_rays=10000,
                                                      sigmaX=1e-6,
                                                      sigmaZ=1e-6)
    beam = src.get_beam()

    #
    # slit definition
    #
    boundary_shape = Ellipse(-1e-6, 1e-6, -0.5e-6, 0.5e-6)
    coordinates = ElementCoordinates(p=100.0, q=0.0)
    optical_element = S4Screen(name="slit1",
                               boundary_shape=boundary_shape,
                               i_abs=False,
                               i_stop=True,
                               thick=0.0,
                               file_abs="")

    screen1 = S4ScreenElement(optical_element=optical_element,
                              coordinates=coordinates)

    print(screen1.info())

    #
    # trace
    #

    beam2, tmp = screen1.trace_beam(beam)

    #
    if do_plot:
        plotxy(beam2, 1, 3, nbins=100, title="BEAM STOPPER", nolost=True)
Exemplo n.º 2
0
def example_screen(do_plot=True):

    #
    # collimated source
    #
    src = SourceGaussian.initialize_collimated_source(number_of_rays=10000,
                                                      sigmaX=1e-6,
                                                      sigmaZ=1e-6)

    beam = src.get_beam()

    print(beam.info())

    #
    # screen definition
    #

    screen1 = S4ScreenElement(optical_element=S4Screen(),
                              coordinates=ElementCoordinates(p=100.0, q=0.0))

    print(screen1.info())

    beam2, tmp = screen1.trace_beam(beam)

    #
    if do_plot:
        plotxy(beam2, 1, 3, nbins=100, title="SCREEN")
Exemplo n.º 3
0
def lens_with_collimated_beam(do_plot=True):

    #
    # collimated source
    #
    src = SourceGaussian.initialize_collimated_source(number_of_rays=10000,sigmaX=1e-6,sigmaZ=1e-6)




    beam = src.get_beam()

    print(beam.info())
    SX, SZ = (1e6*beam.get_standard_deviation(1),1e6*beam.get_standard_deviation(3))

    if do_plot:
        plotxy(beam,1,3,nbins=100,title="SOURCE")
        # histo1(beam, 1, nbins=100)

    #
    # lens definition
    #



    lens1e = S4IdealLensElement(optical_element=S4IdealLens(name="Undefined", focal_x=10.0, focal_y=10.0),
                                coordinates=ElementCoordinates(p=100.0, q=10.0))


    print(lens1e.info())

    #
    # trace
    #

    beam2, tmp = lens1e.trace_beam(beam)

    #
    if do_plot:
        plotxy(beam2,1,3,nbins=100,title="FOCAL PLANE")

    FX, FZ = (1e6*beam2.get_standard_deviation(1),1e6*beam2.get_standard_deviation(3))
    print("Source dimensions: %f %f um"%(SX,SZ))
    print("Focal dimensions: %f %f um"%(FX,FZ))
    print("Demagnification: %g %g"%(SX/FX,SX/FZ))
Exemplo n.º 4
0
def example_filter(do_plot=True):

    src = SourceGaussian.initialize_collimated_source(number_of_rays=10000,
                                                      sigmaX=1e-6,
                                                      sigmaZ=1e-6)
    beam = src.get_beam()

    #
    # slit definition
    #

    from shadow4.physical_models.prerefl.prerefl import PreRefl
    PreRefl.prerefl(interactive=False,
                    SYMBOL="Be",
                    DENSITY=1.848,
                    FILE="Be.dat",
                    E_MIN=100.0,
                    E_MAX=20000.0,
                    E_STEP=100.0)

    optical_element = S4Screen(name="filter1",
                               boundary_shape=None,
                               i_abs=True,
                               i_stop=False,
                               thick=10e-6,
                               file_abs="Be.dat")
    coordinates = ElementCoordinates(p=100.0, q=0.0)
    filter1 = S4ScreenElement(optical_element=optical_element,
                              coordinates=coordinates)

    print(filter1.info())

    #
    # trace
    #

    beam2, tmp = filter1.trace_beam(beam)

    #
    if do_plot:
        plotxy(beam2, 1, 3, nbins=100, title="FILTER", nolost=True)

    print("Intensity: ", beam2.intensity())
Exemplo n.º 5
0
def example_collimated_source():
    #
    a = SourceGaussian.initialize_collimated_source(
        number_of_rays=10000,
        sigmaX=1.0,
        sigmaY=0.0,
        sigmaZ=1.0,
        real_space_center=[0.0, 0.0, 0.0],
        direction_space_center=[0.0, 0.0])

    print(a.info())
    beam = a.get_beam()

    plotxy(beam, 1, 3, title="collimated source")

    plot_scatter(beam.get_column(1),
                 beam.get_column(3),
                 xtitle="col 1",
                 ytitle="col 3",
                 title="collimated source")
    print(beam.info())
Exemplo n.º 6
0
def example_holed_filter(do_plot=True):

    src = SourceGaussian.initialize_collimated_source(number_of_rays=10000,
                                                      sigmaX=1e-6,
                                                      sigmaZ=1e-6)
    beam = src.get_beam()

    #
    # slit definition
    #
    boundary_shape = Rectangle(x_left=-0.5e-6,
                               x_right=0.5e-6,
                               y_bottom=-0.5e-6,
                               y_top=0.5e-6)

    optical_element = S4Screen(name="filter1",
                               boundary_shape=boundary_shape,
                               i_abs=True,
                               i_stop=True,
                               thick=10e-6,
                               file_abs="Be.dat")

    coordinates = ElementCoordinates(p=100.0, q=0.0)
    filter1 = S4ScreenElement(optical_element=optical_element,
                              coordinates=coordinates)

    print(filter1.info())

    #
    # trace
    #

    beam2, tmp = filter1.trace_beam(beam)

    #
    if do_plot:
        plotxy(beam2, 1, 3, nbins=100, title="HOLED FILTER", nolost=True)