def do_wise_calculation(self): position_directives = self.get_PositionDirectives() position_directives.WhichAngle = Optics.TypeOfAngle.SelfFrameOfReference position_directives.Angle = 0.0 wise_source = WiserOpticalElement( name=self.source_name, boundary_shape=None, native_CoreOptics=Optics.SourceGaussian(self.source_lambda * 1e-9, self.source_waist * 1e-6, M2=self.source_m2), isSource=True, native_PositioningDirectives=position_directives) z = wise_source.native_optical_element.CoreOptics.RayleighRange # [metres] x = 4. * wise_source.native_optical_element.CoreOptics.Fwhm(z) self.rayleigh_range = z data_to_plot = numpy.zeros((2, 201)) sigma = self.source_waist * 1e-6 / 2. mu = 0.0 if self.XYCentre_checked else self.YCentre data_to_plot[0, :] = numpy.linspace(-x + mu, mu + x, 201) data_to_plot[ 1, :] = wise_source.native_optical_element.CoreOptics.Amplitude( data_to_plot[0, :], z) return wise_source, data_to_plot
def get_virtual_source(): return WiserOpticalElement( name="Virtual source", isSource=True, native_CoreOptics=Optics.SourceVirtual(), native_PositioningDirectives=Foundation.PositioningDirectives( ReferTo=Foundation.PositioningDirectives.ReferTo.AbsoluteReference, XYCentre=[0.0, 0.0], Angle=0.0))
def __init__(Lambda): theta_I = TehtaI(Lambda) Waist0 = Waist0E(Lambda) source_k = Optics.SourceGaussian(Lambda, Waist0) source_pd = Fundation.PositioningDirectives( ReferTo = 'absolute', XYCentre = [0,0], Angle = 0) source = Fundation.OpticalElement(source_k, Name = 'Fel1 source', IsSource = True, PositioningDirectives = source_pd)
def get_wavefront_source(wofry_wavefront): mesh_x = wofry_wavefront.get_abscissas() return WiserOpticalElement( name="Wavefront Source", isSource=False, native_CoreOptics=Optics.SourceWavefront( Lambda=wofry_wavefront.get_wavelength(), L=numpy.abs(mesh_x[0]) + numpy.abs(mesh_x[-1]), Field=wofry_wavefront.get_amplitude() * numpy.exp(1j * wofry_wavefront.get_phase()), Orientation=Optics.OPTICS_ORIENTATION.ISOTROPIC), native_PositioningDirectives=Foundation.PositioningDirectives( ReferTo=Foundation.PositioningDirectives.ReferTo.Source, PlaceWhat='centre', PlaceWhere='centre', Distance=4))
PropagationManager.Instance().add_propagator(WiserPropagator()) tl.Debug.On = True N = 3000 UseCustomSampling = True # SOURCE #========================================================================== Lambda = 2e-9 Waist0 = 180e-6 #Fermi.Waist0E(Lambda) ww_s = WiserOpticalElement( name='FEL2 source', boundary_shape=None, isSource=True, native_CoreOptics=Optics.SourceGaussian(Lambda=Lambda, Waist0=Waist0), native_PositioningDirectives=Foundation.PositioningDirectives( ReferTo='absolute', XYCentre=[0, 0], Angle=pi / 4. - AngleGrazing)) s = ww_s.native_optical_element # Wiser optical element s.ComputationSettings.UseSmallDisplacements = True s.Orientation = Optics.OPTICS_ORIENTATION.ANY s.CoreOptics.SmallDisplacements.Long = DeltaSourceList[0] s.CoreOptics.SmallDisplacements.Rotation = 0. # PM1 (h) #========================================================================== ww_pm1_h = WiserOpticalElement( name='pm1h', boundary_shape=None, native_CoreOptics=Optics.MirrorPlane(L=L, AngleGrazing=AngleGrazing),
def get_native_optical_element(self): return Optics.MirrorPlane(L=self.length, AngleGrazing=numpy.deg2rad(self.alpha))
def get_native_optical_element(self): return Optics.Detector(L=self.length, AngleGrazing=numpy.deg2rad(self.alpha))
def get_native_optical_element(self): return Optics.MirrorElliptic(f1=self.f1, f2=self.f2, L=self.length, Alpha=numpy.deg2rad(self.alpha))
def get_native_optical_element(self): return Optics.Slits(L=self.length)
def get_inner_wise_optical_element(self): return Optics.Detector(L=self.length * self.workspace_units_to_m, AngleGrazing=numpy.deg2rad(self.alpha))