import dtmm import numpy as np import matplotlib.pyplot as plt from dtmm.data import EpsilonCauchy dtmm.conf.set_verbose(2) #: pixel size in nm PIXELSIZE = 200 #: compute box dimensions NLAYERS, HEIGHT, WIDTH = 60, 96, 96 #: illumination wavelengths in nm WAVELENGTHS = np.linspace(380, 780, 9) #: create some experimental data (stack) d, epsv, epsa = dtmm.nematic_droplet_data((NLAYERS, HEIGHT, WIDTH), radius=30, profile="r", no=1.5, ne=1.6, nhost=1.5) """ we will be using Cauchy approximation with n = 2 coefficients. refind = a + b/lambda**2 #e take the epsv values as a reference, so first coefficient is just epv**0.5, and then w add some small anisotropic dispersion the b coefficient depends on the anistropy. units of coefficient b are microns**2 """ epsc = EpsilonCauchy(shape=(NLAYERS, HEIGHT, WIDTH), n=2) epsc.coefficients[..., 0] = (epsv)**0.5 # a term, just set to refractive index epsc.coefficients[..., 0:2,
"""This example shows that calculating 4x4 reflection is less stable and noisier. """ import dtmm import numpy as np #: pixel size in nm PIXELSIZE = 200 #: compute box dimensions NLAYERS, HEIGHT, WIDTH = 60, 96, 96 #: illumination wavelengths in nm WAVELENGTHS = np.linspace(380, 780, 9) #: create some experimental data (stack) optical_data = dtmm.nematic_droplet_data((NLAYERS, HEIGHT, WIDTH), radius=30, profile="r", no=3.5, ne=3.6, nhost=3.5) betamax = np.inf #no need to cutoff in 2x2 mode, in the 4x4 mode, filtering is done automatically NA = 0.9 #NA of the microscope objective... also this filters out high frequency modes window = dtmm.aperture((96, 96), 0.95, 0.) window = None #: create non-polarized input light (fin2, w, p) = dtmm.illumination_data((HEIGHT, WIDTH), WAVELENGTHS, beta=0., pixelsize=PIXELSIZE, window=window) (fin4, w, p) = (fin2.copy(), w, p)
import numpy as np import matplotlib.pyplot as plt # Change matplotlib backend to an interactive one import matplotlib #matplotlib.use("TkAgg") #: pixel size in nm PIXELSIZE = 100 #: compute box dimensions NLAYERS, HEIGHT, WIDTH = 100, 1024, 1024 #: illumination wavelengths in nm WAVELENGTHS = np.linspace(380, 780, 9) #: dummy data.. d, e, a = dtmm.nematic_droplet_data((NLAYERS, HEIGHT, WIDTH), radius=3000, profile="x", no=1.5, ne=1.5, nhost=1.5) d[...] = 1 a[...] = 0. a[..., 1] = np.pi / 2 def eps_periodic(size=1024, period=25, n1=1.7, n2=1.5): out = [] for i in range(size): if (i // period) % 2 == 0: out.append(n1**2) else:
if isinstance(data, tuple): d, eps, angles = validate_optical_data(data) else: angles = data director = angles2director(angles) return plot_director(director, **kwargs) __all__ = ["plot_material", "plot_angles", "plot_director"] if __name__ == "__main__": import dtmm import dtmm data = dtmm.nematic_droplet_data((60, 128, 128), radius=30, profile="r", no=1.5, ne=1.7, nhost=1.5) thickness, material_eps, angles = data fig = plot_material(material_eps, center=True, xlim=(-40, -20), ylim=(-10, 10), zlim=(-10, 10)) fig = dtmm.plot_angles(angles, center=True, xlim=(-3, 3), ylim=(-3, 3), zlim=(-3, 3))