def __init__(self, Mode: Union[tuple, list], NA: float, Rotation: Union[int, float] = 0, Sampling: int = 401, GammaOffset: Union[int, float] = 0, PhiOffset: Union[int, float] = 0, Filter: Union[int, float, bool] = None, CouplingMode: str = 'Centered'): self.isDetector = True assert CouplingMode in ['Centered', 'Mean'], Error_MeanCentered if NA > 1 or NA < 0: logging.warning(warning_NAHigh) self.CouplingMode = ('Amplitude', CouplingMode) self._Filter = _Polarization(Filter) self.ModeNumber = Mode self._NA = NA2Angle(NA).Radian self.Mesh = self.SphericalMesh(Sampling=Sampling, MaxAngle=NA2Angle(NA).Radian, PhiOffset=PhiOffset, GammaOffset=GammaOffset, Structured=False) self.Scalar = self.FarField(Num=self.Mesh.Sampling, Structured=False, Rotation=Rotation)
def __init__(self, NA: Union[int, float], Sampling: int = 400, CouplingMode: str = 'Centered', GammaOffset: Union[int, float] = 0, PhiOffset: Union[int, float] = 0, Filter: Union[int, float, bool] = None): self.isDetector = True self.CouplingMode = ('Intensity', CouplingMode) self._GammaOffset, self._PhiOffset = GammaOffset, PhiOffset self._Filter = _Polarization(Filter) self._NA = NA2Angle(NA).Radian self.Mesh = self.SphericalMesh(Sampling=Sampling, MaxAngle=self._NA, PhiOffset=PhiOffset, GammaOffset=GammaOffset, Structured=False) self.Scalar = self.FarField(Num=self.Mesh.Sampling, Structured=False)
def GetBinding(self): self.Mesh = FibonacciMesh(MaxAngle=NA2Angle(self._NA).Radian, Sampling=self._Sampling, PhiOffset=self._PhiOffset, GammaOffset=self._GammaOffset) self.Bind = BindedPhotodiode( Sampling=self._Sampling, NA=self._NA, Phi=np.deg2rad(self._PhiOffset), Gamma=np.deg2rad(self._GammaOffset), Filter=np.deg2rad(self._Filter) if self._Filter else float(4242))
def GetBinding(self): self.Mesh = FibonacciMesh(MaxAngle=NA2Angle(self._NA).Radian, Sampling=self._Sampling, PhiOffset=self._PhiOffset, GammaOffset=self._GammaOffset) self.ScalarField = GetFarFieldLP(Mode=self.ModeNumber, MaxAngle=NA2Angle(self._NA).Radian, Sampling=self._Sampling) self.Bind = BindedLPMode( ScalarField=self.ScalarField, Sampling=self._Sampling, NA=self._NA, Phi=np.deg2rad(self._PhiOffset), Gamma=np.deg2rad(self._GammaOffset), Filter=np.deg2rad(self._Filter) if self._Filter else np.nan, # VPara = self.Mesh.VPara, # HPara = self.Mesh.HPara, # VPerp = self.Mesh.VPerp, # HPerp = self.Mesh.HPerp, )
def __init__(self, NA: float, Sampling: int = 400, CouplingMode: str = 'Point', GammaOffset: float = 0, PhiOffset: float = 0, Filter: float = None): self.CouplingMode = CouplingMode self.Filter = Filter self._PhiOffset = PhiOffset self._GammaOffset = GammaOffset self._NA = NA self.Sampling = Sampling self.ScalarField = np.ones(Sampling) self.MaxAngle = NA2Angle(self._NA).Radian self.GetBinding()
def __init__(self, Scatterer, Detector): Num = 251 PaddingFactor = 10 TotalSize = Num*PaddingFactor MaxAngle = NA2Angle(Detector.NA) phi, theta = np.linspace(0, np.pi, Num), np.linspace(-np.pi, np.pi, Num) Phi, Theta = np.meshgrid(phi, theta) MaxDirect = 1 / (sin(MaxAngle.Radian) * Scatterer.Source.k / (2*np.pi)) X = Y = np.linspace(-1, 1, Num) * Num/2 * MaxDirect/PaddingFactor FarFieldPara, FarFieldPerp = Scatterer._FarField(Phi.flatten(), Theta.flatten(), 1.0, Structured=False) ScalarField = Detector.GetScalarField(Sampling=Num, Structured=True) Perp = ScalarField * FarFieldPerp.reshape(Theta.shape) Para = ScalarField * FarFieldPara.reshape(Theta.shape) FourierPara = np.fft.ifft2(Para, s=[TotalSize, TotalSize]) FourierPara = np.fft.fftshift(FourierPara).__abs__()**2 FourierPerp = np.fft.ifft2(Perp, s=[TotalSize, TotalSize]) FourierPerp = np.fft.fftshift(FourierPerp).__abs__()**2 start = int(TotalSize/2-np.floor(Num/2)) end = int(TotalSize/2+np.ceil(Num/2)) FourierPara = FourierPara[start: end, start: end] FourierPerp = FourierPerp[start: end, start: end] self['Map'] = (FourierPara + FourierPerp) self['DirectX'] = X self['DirectY'] = Y
def GetScalarField(self, Sampling, Structured=False): return GetFarFieldLP(Mode=self.ModeNumber, MaxAngle=NA2Angle(self._NA).Radian, Sampling=Sampling, Structured=Structured)
def NA(self, val): if val <= EPS: val = EPS self.MaxAngle = NA2Angle(val).Radian self.Mesh.UpdateSphere(MaxAngle=self.MaxAngle)