oasys-elettra-kit / OASYS1-Wiser

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

Personal Note MM: Check Focus Sweep #67

Closed capitanevs closed 2 years ago

capitanevs commented 3 years ago

focus sweep works in oasys but not in libwiser.

this does not make any sense.

understand why

capitanevs commented 3 years ago
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 17 17:43:33 2021

@author: Mike
"""

#%%
from LibWiser.EasyGo import* 
gs =LibWiser.Foundation.OpticalElement( Name = 'gs',
    IsSource = True,
    CoreOpticsElement =LibWiser.Optics.SourceGaussian(      Lambda = 1.100000e-08,
        Waist0 = 1.273240e-04,
        M2 = 1.000000e+00,
        AnglePropagation = 0.000000e+00,
        Orientation = OPTICS_ORIENTATION.ANY,
    ),
    PositioningDirectives =LibWiser.Foundation.PositioningDirectives(       ReferTo = 'absolute',
        PlaceWhat = None,
        PlaceWhere = None,
        GrazingAngle = None,
        Distance = None,
    ),
)
em =LibWiser.Foundation.OpticalElement( Name = 'em',
    IsSource = False,
    CoreOpticsElement =LibWiser.Optics.MirrorElliptic(      L = 4.000000e-01,
        Alpha = 0.03490658503988659,
        f1 = 9.900000e+01,
        f2 = 1.200000e+00,
        Orientation = OPTICS_ORIENTATION.ANY,
    ),
    PositioningDirectives =LibWiser.Foundation.PositioningDirectives(       ReferTo = 'source',
        PlaceWhat = 'centre',
        PlaceWhere = 'centre',
        GrazingAngle = None,
        Distance = 9.900000e+01,
    ),
)
det =LibWiser.Foundation.OpticalElement(    Name = 'det',
    IsSource = False,
    CoreOpticsElement =LibWiser.Optics.Detector(        L = 1.000000e-04,
        AngleGrazing = 1.5707963267948966,
        Orientation = OPTICS_ORIENTATION.ANY,
    ),
    PositioningDirectives =LibWiser.Foundation.PositioningDirectives(       ReferTo = 'upstream',
        PlaceWhat = 'centre',
        PlaceWhere = 'centre',
        GrazingAngle = None,
        Distance = 1,
    ),
)
WiserBeamline = BeamlineElements([gs, em, det])
WiserBeamline.RefreshPositions()
WiserBeamline.SetAllNSamples(6000)
WiserBeamline.SetAllUseCustomSampling = True

WiserBeamline.ComputeFields()

Foundation.FocusSweep(det, 
               np.linspace(-30e-3,30e-3, 11), 
               DetectorSize=50e-6, 
                      StartAtNominalFocus = True,
              Distance = 0,
               AngleInNominal=np.deg2rad(90))

det.PlotIntensity()
capitanevs commented 2 years ago

Let's check again, now...

capitanevs commented 2 years ago

It'sfine

immagine