8000 Energy distribution histogram for different fluxKind plot parametrs · Issue #241 · kklmn/xrt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Energy distribution histogram for different fluxKind plot parametrs #241
Open
@saga111a

Description

@saga111a

Strange behavior fot the energy distribution histogram when changing fluxKind plot. It seems like a bug but I am not sure.

For beamline with BM source, slits, and screen I have different energy distributions histogram when use fluxKind=power and fluxKind=total. The SPECTRA software plot and the plot for fluxKind=power are similar. Versions xrt 1.3,4 1.6.0 1.6.1 have similar behavior, new beamline build too. (we tested only in win, but I think it will be same with linux). Changing the energy range has no effect, the distribution histogram is different for different fluxKind.

30eV-100keV
Image

other energy range(5000-10000eV)

Image

test beamline file
# -*- coding: utf-8 -*-
"""

__author__ = "Konstantin Klementiev", "Roman Chernikov"
__date__ = "2025-04-30"

Created with xrtQook




"""

import numpy as np
import sys
#sys.path.append(r"C:\Users\saga1\xrt\XRT_MODE-16\Lib\site-packages")
import xrt.backends.raycing.sources as rsources
import xrt.backends.raycing.screens as rscreens
import xrt.backends.raycing.materials as rmats
import xrt.backends.raycing.oes as roes
import xrt.backends.raycing.apertures as rapts
import xrt.backends.raycing.run as rrun
import xrt.backends.raycing as raycing
import xrt.plotter as xrtplot
import xrt.runner as xrtrun


def build_beamline():
    BL_test = raycing.BeamLine()

    BL_test.BPC = rsources.BendingMagnet(
        bl=BL_test,
        center=[0, 0, 0],
        eE=3.0,
        eI=0.4,
        eEspread=0.001,
        eEpsilonX=0.096,
        eEpsilonZ=0.0096,
        betaX=0.252,
        betaZ=7.77,
        xPrimeMax=0.42,
        zPrimeMax=0.21,
        eMin=30,
        eMax=100000,
        B0=2.05)

    BL_test.MASK_10m_08_04_mrad = rapts.RectangularAperture(
        bl=BL_test,
        name=None,
        center=[0, 10000, 0],
        opening=[-4, 4, -2, 2])

    BL_test.screen_before_WB_slit = rscreens.Screen(
        bl=BL_test,
        name=None,
        center=[0, 20999, 0])

    return BL_test


def run_process(BL_test):
    bendingMagnet01beamGlobal01 = BL_test.BPC.shine()

    rectangularAperture01beamLocal01 = BL_test.MASK_10m_08_04_mrad.propagate(
        beam=bendingMagnet01beamGlobal01)

    screen01beamLocal04 = BL_test.screen_before_WB_slit.expose(
        beam=bendingMagnet01beamGlobal01)

    outDict = {
        'bendingMagnet01beamGlobal01': bendingMagnet01beamGlobal01,
        'rectangularAperture01beamLocal01': rectangularAperture01beamLocal01,
        'screen01beamLocal04': screen01beamLocal04}
    return outDict


rrun.run_process = run_process



def define_plots():
    plots = []

    screen_before_WB_slits = xrtplot.XYCPlot(
        beam=r"screen01beamLocal04",
        xaxis=xrtplot.XYCAxis(
            label=r"x",
            bins=256,
            fwhmFormatStr=r"%.3f"),
        yaxis=xrtplot.XYCAxis(
            label=r"z",
            bins=256,
            fwhmFormatStr=r"%.3f"),
        caxis=xrtplot.XYCAxis(
            label=r"energy",
            unit=r"eV",
            bins=256,
            fwhmFormatStr=r"%.3f"),
        title=r"screen_power",
        fluxKind=r"power")
    plots.append(screen_before_WB_slits)

    screen_before_WB_slits_total = xrtplot.XYCPlot(
        beam=r"screen01beamLocal04",
        xaxis=xrtplot.XYCAxis(
            label=r"x",
            bins=256,
            fwhmFormatStr=r"%.3f"),
        yaxis=xrtplot.XYCAxis(
            label=r"z",
            bins=256,
            fwhmFormatStr=r"%.3f"),
        caxis=xrtplot.XYCAxis(
            label=r"energy",
            unit=r"eV",
            bins=256,
            fwhmFormatStr=r"%.3f"),
        title=r"screen_total")
    plots.append(screen_before_WB_slits_total)
    return plots


def main():
    BL_test = build_beamline()
    E0 = 0.5 * (BL_test.BPC.eMin +
                BL_test.BPC.eMax)
    BL_test.alignE=E0
    plots = define_plots()
    xrtrun.run_ray_tracing(
        plots=plots,
        repeats=32,
        updateEvery=8,
        backend=r"raycing",
        beamLine=BL_test,
        threads=8)


if __name__ == '__main__':
    main()
XrtQook screensshots

Image

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0