PSF_sim

class GridParameters(pxsizex=40, pxsizez=50, Nx=100, Nz=1, pxpitch=75000.0, pxdim=50000.0, N=5, M=450)[source]

Bases: object

It calculates a z-stack of PSFs for all the elements of the SPAD array detector.

N

Number of detector elements in the array in each dimension (typically 5)

Type:

int

Nx

Number of pixels in each dimension in the simulation array (e.g. 1024)

Type:

int

pxpitch

Pixel pitch of the detector [nm] (real space, typically 75000)

Type:

float

pxdim

Detector element size [nm] (real space, typically 50000)

Type:

float

pxsizex

Pixel size of the simulation space [nm] (typically 1)

Type:

float

Nz

number of axial planes (typically an odd integer)

Type:

int

pinhole_shape

Shape of the invidual pinhole. Valid choices are ‘square’, ‘cirle’, or ‘hexagon’.

Type:

str

geometry

Detector geometry. Valid choices are ‘rect’ or ‘hex’.

Type:

str

name

If ‘airyscan’, the simulated detector is the commercial 32-elements AiryScan from Zeiss.

Type:

str

M

Total magnification of the optical system (typically 500)

Type:

float

rotation

Detector rotation angle (rad)

Type:

float

mirroring

Flip of the horizonatal axis of the detector plane (+1 or - 1)

Type:

int

property Nch
Print()[source]
copy()[source]
property rangex
property rangez
spad_size(mode: str = 'magnified', simPar=None)[source]
SPAD_PSF_2D(gridPar, exPar, emPar, n_photon_excitation=1, stedPar=None, z_shift=0, spad=None, normalize=True, process: str = 'gpu', output: str = 'numpy')[source]

Calculate PSFs for all pixels of the SPAD array by using FFTs

Parameters:
  • gridPar (GridParameters object) – object with simulation space parameters

  • exPar (simSettings object) – object with excitation PSF parameters

  • emPar (simSettings object) – object with emission PSF parameters

  • n_photon_excitation (int) – Order of non-linear excitation. Default is 1.

  • stedPar (simSettings object) – object with STED beam parameters

  • z_shift (float) – Distance from the focal plane at which generate the PSF [nm]

  • spad (np.array( N**2 x Nx x Nx)) – Pinholes distribution . If none it is calculated using the input parameters

  • normalize (bool) – If True, all the returned PSFs are divided by the total flux. Default is True.

Returns:

  • PSF (np.array(Nx x Nx x N**2)) – array with the overall PSFs for each detector element

  • detPSF (np.array(Nx x Nx x N**2)) – array with the detection PSFs for each detector element

  • exPSF (np.array(Nx x Nx)) – array with the excitation PSF

SPAD_PSF_3D(gridPar, exPar, emPar, stedPar=None, spad=None, n_photon_excitation: int = 1, stack: str = 'symmetrical', normalize: bool = True, process: str = 'gpu', output: str = 'numpy')[source]

It calculates a z-stack of PSFs for all the elements of the SPAD array detector.

Parameters:
  • gridPar (GridParameters object) – object with simulation space parameters

  • exPar (simSettings object) – object with excitation PSF parameters

  • emPar (simSettings object) – object with emission PSF parameters

  • n_photon_excitation (int) – Order of non-linear excitation. Default is 1.

  • stedPar (simSettings object) – object with STED beam parameters

  • spad (np.array( N**2 x Nx x Nx)) – Pinholes distribution . If none it is calculated using the input parameters

  • stack (str) – String that defines the direction along z of the simulation. If “symmetrical”, the stack is generated at planes around z = 0 both on the negative and positive directions. Other possible entries are “positive”, and “negative”. Default: “symmetrical”.

  • normalize (bool) – If True, the returned PSFs are divided by the total flux calculated on the focal plane (z=0). Default is True.

Returns:

  • PSF (np.array(Nz x Nx x Nx x N**2)) – array with the overall PSFs for each detector element

  • detPSF (np.array(Nz x Nx x Nx x N**2)) – array with the detection PSFs for each detector element

  • exPSF (np.array(Nz x Nx x Nx)) – array with the excitation PSF

class simSettings(na=1.4, n=1.5, wl=485.0, h=2.8, gamma=45.0, beta=90.0, w0=100.0, I0=1, field='PlaneWave', mask=None, mask_sampl=200, sted_sat=50, sted_pulse=1, sted_tau=3.5, abe_index=None, abe_ampli=None)[source]

Bases: object

Optical settings used to calculate the psf Read more at https://pyfocus.readthedocs.io/en/latest/

na

numerical aperture

Type:

float

n

sample refractive index

Type:

float

wl

wavelength in vacuum [nm]

Type:

float

h

radius of aperture of the objective lens [mm]

Type:

float

gamma

parameter describing the light polarization (amplitude)

Type:

float

beta

parameter describing the light polarization (phase)

Type:

float

w0

radius of the incident gaussian beam [mm]

Type:

float

I0

Intensity of the entrance field [W/m**2]

Type:

float

field

spatial distribution of the entrance field ‘PlaneWave’ = flat field ‘Gaussian’ = gaussian beam of waist w0

Type:

str

mask

phase mask None = no mask ‘VP’ = vortex phase plate

Type:

str

mask_sampl

entrance field and mask sampling (# points)

Type:

int

sted_sat

STED maximum saturation factor

Type:

float

sted_pulse

STED pulse duration [ns]

Type:

float

sted_tau

fluorescence lifetime [ns]

Type:

float

abe_index

aberration index

Type:

int or array

abe_ampli

aberration amplitude in rad

Type:

float or array

f : float

Returns the focal length.

alpha : float

Returns the semi angular aperture.

aberration : str / list

Returns the list of aberrations by name.

Print()[source]
property aberration
property airy_unit
property alpha
copy()[source]
property depth_of_field
property f
property wavefront
singlePSF(par, pxsizex, Nx, rangez, nz, device: str = 'cpu')[source]

Simulate PSFs with PyFocus

Parameters:
  • par (simSettings object) – Object with PSF parameters

  • pxsizex (float) – Pixel size of the simulation space in XY [nm] (typically 1)

  • Nx (int) – Number of pixels in XY dimensions in the simulation array, e.g. 1024

Returns:

  • exPSF (np.array(Nx x Nx)) – with the excitation PSF calculated from exPSF

  • emPSF (np.array(Nx x Nx)) – with the emission PSF calculated from emPSF