dtmm.field¶
Field creation, transformation in IO functions
Module Contents¶
-
dtmm.field.illumination_rays(NA, diameter=5.0, smooth=0.1)¶ Returns beta, phi, intensity values for illumination.
This function can be used to define beta,phi,intensiy arrays that can be used to construct illumination data with the
illumination_data()function. The resulting beta,phi parameters define directions of rays for the input light with a homogeneous angular distribution of rays - input light with a given numerical aperture.- Parameters
NA (float) – Approximate numerical aperture of the illumination.
diameter (int) – Field aperture diaphragm diameter in pixels. Approximate number of rays is np.pi*(diameter/2)**2
smooth (float, optional) – Smoothness of diaphragm edge between 0. and 1.
- Returns
beta,phi, intensity – Ray parameters
- Return type
ndarrays
-
dtmm.field.illumination_data(shape, wavelengths, pixelsize=1.0, beta=0.0, phi=0.0, intensity=1.0, n=None, focus=0.0, window=None, backdir=False, jones=None, diffraction=True, eigenmodes=None, betamax=BETAMAX)¶ Constructs forward (or backward) propagating input illumination field data.
- Parameters
shape ((int,int)) – Shape of the illumination
wavelengths (array_like) – A list of wavelengths.
pixelsize (float, optional) – Size of the pixel in nm.
beta (float or array_like of floats, optional) – Beta parameter(s) of the illumination. (Default 0. - normal incidence)
phi (float or array_like of floats, optional) – Azimuthal angle(s) of the illumination.
n (float, optional) – Refractive index of the media that this illumination field is assumed to be propagating in (default to n_cover)
focus (float, optional) – Focal plane of the field. By default it is set at z=0.
window (array or None, optional) – If None, no window function is applied. This window function is multiplied with the constructed plane waves to define field diafragm of the input light. See
window.aperture().backdir (bool, optional) – Whether field is bacward propagating, instead of being forward propagating (default)
jones (jones vector or None, optional) – If specified it has to be a valid jones vector that defines polarization of the light. If not given (default), the resulting field will have two polarization components. See documentation for details and examples.
diffraction (bool, optional) – Specifies whether field is diffraction limited or not. By default, the field is filtered so that it has only propagating waves. You can disable this by specifying diffraction = False.
eigenmodes (bool or None) – If set to True (sefault value when window = None.), it defines whether to build eigenmodes from beta and phi values. In this case, beta and phi are only approximate values. If set to False (default when window != None), true beta and phi values are set.
betamax (float, optional) – The betamax parameter of the propagating field.
- Returns
illumination – A field data tuple.
- Return type
field_data
-
dtmm.field.field2intensity(field, out)¶ field2intensity(field)
Converts field array of shape […,4,height,width] to intensity array of shape […,height,width]. For each pixel element, a normal component of the Poynting vector is computed.
- Parameters
field (array_like) – Input field array
cmf (array_like) – Color matching function
- Returns
spec – Computed intensity array
- Return type
ndarray
-
dtmm.field.field2specter(field, out)¶ field2specter(field)
Converts field array of shape […,nwavelengths,4,height,width] to specter array of shape […,height,width,nwavelengths]. For each pixel element, a normal componentof Poynting vector is computed
- Parameters
field (array_like) – Input field array
cmf (array_like) – Color matching function
- Returns
spec – Computed specter array
- Return type
ndarray
-
dtmm.field.validate_field_data(data)¶ Validates field data.
This function inspects validity of the field data, and makes proper data conversions to match the field data format. In case data is not valid and it cannot be converted to a valid data it raises an exception (ValueError).
- Parameters
data (tuple of field data) – A valid field data tuple.
- Returns
data – Validated field data tuple.
- Return type
tuple
-
dtmm.field.save_field(file, field_data)¶ Saves field data to a binary file in
.dtmfformat.- Parameters
file (file, str, or pathlib.Path) – File or filename to which the data is saved. If file is a file-object, then the filename is unchanged. If file is a string, a
.dtmfextension will be appended to the file name if it does not already have one.field_data ((field,wavelengths,pixelsize)) – A valid field data tuple
-
dtmm.field.load_field(file)¶ Load field data from file
- Parameters
file (file, str) – The file or filenam to read.