oasys-elettra-kit / OASYS1-Wiser

The implementation of WISER into OASYS
MIT License
0 stars 1 forks source link

Bug: Detector size, in OASYS #55

Open capitanevs opened 3 years ago

capitanevs commented 3 years ago

These two diagrams give a different detector size in the end. The detector size is probed by the last two widgets (A and B). The captions contain the result: A has mistmatching dimensions, B has matching dimension.

immagine

I used for the first time the "Code generator" of WISER. It is working quite well (I just had to correct the positioning directives and the names, as it supports just python compatible name, with no spaces etc.)

This is the code


# -*- coding: utf-8 -*-
"""
Created on Mon Jul 19 17:13:08 2021

@author: Mike
"""

from LibWiser.EasyGo import *

#%%
s =LibWiser.Foundation.OpticalElement(  Name = 'Gaussian Source',
    IsSource = True,
    CoreOpticsElement =LibWiser.Optics.SourceGaussian(      Lambda = 1.000000e-08,
        Waist0 = 1.800000e-04,
        M2 = 1.000000e+00,
        AnglePropagation = 0.000000e+00,
        Orientation = OPTICS_ORIENTATION.ANY,
    ),
    PositioningDirectives =LibWiser.Foundation.PositioningDirectives(       ReferTo = 'absolute',
        PlaceWhat = 'centre',
        PlaceWhere = 'centre',
        GrazingAngle = 0,
        Distance = None,
    ),
)
Detector =LibWiser.Foundation.OpticalElement(   Name = 'Detector',
    IsSource = False,
    CoreOpticsElement =LibWiser.Optics.Detector(        L = 5.000000e-03,
        AngleGrazing = 1.5707963267948966,
        Orientation = OPTICS_ORIENTATION.ANY,
    ),
    PositioningDirectives =LibWiser.Foundation.PositioningDirectives(       ReferTo = 'source',
        PlaceWhat = 'centre',
        PlaceWhere = 'centre',
        GrazingAngle = np.pi/2,
        Distance = 10,
    ),
)

#%%
WiserBeamline = BeamlineElements([s, Detector])
WiserBeamline.RefreshPositions()

for _ in WiserBeamline.ItemList:
    _.ComputationSettings.UseCustomSampling = True
    _.ComputationSettings.NSamples = 5000

#%%
WiserBeamline.ComputeFields()

Detector.PlotIntensity() # makes a plot

the plot of the last line has a correct transverse size (5mm)

immagine

PROBLEM: we are hiding something, probably in OASYS, but I have no idea of the position.

capitanevs commented 3 years ago

FOUND

ACTION not a priority now. I'll get it sooner or later