open_viewmin.nematic.nematic_plot#
Create plotter classes specific to nematic liquid crystals visualization
Submodules#
Classes#
Plotter class for nematic liquid crystals visualization, |
|
Plotter class for nematic liquid crystals visualization, with the |
Package Contents#
- class NematicPlot(filenames=None, q0=0.0, user_settings=None, data_format='open-Qmin', sep='\t', reader=None, theme=None, dims=None, data_stride=1, **kwargs)#
Bases:
open_viewmin.filter_tree_plot_Qt.filter_tree_plot_Qt.FilterTreePlotQt
,open_viewmin.nematic.nematic_plot.nematic_plot_no_qt.NematicPlotNoQt
Plotter class for nematic liquid crystals visualization, with the filters tree, in a Qt window.
- Parameters:
filenames (list[str], str, or None, optional) – Files to import.
q0 (float, optional) – Chiral wavenumber for cholesteric (chiral nematic) ground state, used in free energy calculations.
user_settings (dict or None, optional) – Customizations to default plotter settings.
data_format (['open-Qmin' | 'Qmin' | 'director'], optional) – Formatting style of data text files to import; used only if parameter reader has value None.
sep (str, optional) – Column delimiter for imported text file(s)
reader (callable() or None, optional) – Function for reading data from text files; set to None to use the data_format (and, optionally, sep) parameters to determine data import behavior.
theme (['dark' | 'document' | 'paraview' | None], optional) – PyVista plot theme
dims (tuple(int) or None) – System size; used only if filenames is None.
data_stride (int, optional) – Data spacing; used only if filenames is None.
kwargs (dict, optional) – Keyword arguments to
FilterTreePlot
- auto_setup(notebook=False)#
Add nematic-specific items to the “Calculate” menu
- setup_defects()#
Automatic setup for defects visualization
- setup_director()#
Automatic setup for director visualization
- show_jones(**kwargs)#
Display optical transmission, calculated from Jones matrices, on three planes.
- Parameters:
kwargs (dict, optional)
- Returns:
callback that refreshes Jones planes by re-applying the control slider widgets
- Return type:
callable()
- reader#
- class NematicPlotNoQt(filenames=None, q0=0.0, user_settings=None, data_format='open-Qmin', sep='\t', reader=None, theme=None, off_screen=False, notebook=True, **kwargs)#
Bases:
open_viewmin.filter_tree_plot.filter_tree_plot.FilterTreePlot
- Plotter class for nematic liquid crystals visualization, with the
filters tree but without Qt.
- Parameters:
filenames (list[str], str, or None, optional) – Files to import.
q0 (float, optional) – Chiral wavenumber for cholesteric (chiral nematic) ground state, used in free energy calculations.
user_settings (dict or None, optional) – Customizations to default plotter settings.
data_format (['open-Qmin' | 'Qmin' | 'director'], optional) – Formatting style of data text files to import; used only if parameter reader has value None.
sep (str, optional) – Column delimiter for imported text file(s)
reader (callable() or None, optional) – Function for reading data from text files; set to None to use the data_format (and, optionally, sep) parameters to determine data import behavior.
theme ([‘dark’ | ‘document’ | ‘paraview’ | None], optional) – PyVista plot theme
off_screen (bool, optional) – Whether to render off-screen
notebook (bool, optional) – Whether to display inside of a Jupyter notebook
**kwargs – Keyword arguments to
FilterTreePlot
- static Q33_from_Q5(q5)#
Convert 5-component Q-tensor information to 3x3 matrix
- static Q_from_n(director_data)#
Create Q-tensor array from director data assuming S_0=1
- _legacy_qmin_import(qtensor_filename)#
Reader for output from older Qmin (a.k.a. nematicvXX) code.
Note that while only the “Qtensor_…” files are supplied directly, this routine expects the associated “Qmatrix_…” files to be in the same directory.
- Parameters:
qtensor_filename (str) – Filenames of “Qtensor_…”
- Returns:
Imported data
- Return type:
list[np.ndarray]
- _pre_init(q0, data_format, reader, sep)#
Portion of initialization to run before open_viewmin.FilterTreePlot.__init__()
- Parameters:
q0 (float) – Chiral wavenumber
data_format (['open-Qmin' | 'Qmin' | 'director'], optional) – Formatting style of data text files to import; used only if parameter reader has value None.
reader (callable() or None, optional) – Function for reading data from text files; set to None to use the data_format (and, optionally, sep) parameters to determine data import behavior.
sep (str, optional) – Column delimiter for imported text file(s)
- Returns:
Reader
- Return type:
callable()
- add_circuits_around_points(points_mesh_name, normals_name, radius=3, n_samples=16, use_ints=False)#
Create small, closed-loop meshes around a set of points, for use in plotting director winding near disclinations.
- Parameters:
points_mesh_name (str)
normals_name (str)
radius (float)
n_samples (int)
use_ints (bool)
- Return type:
- analyze_disclination_at_picked_point(**kwargs)#
Show director winding character at a picked point on a disclination
- Parameters:
**kwargs (dict, optional) – Keyword arguments to
analyze_disclinations_at_points()
- analyze_disclinations(defects_mesh_name='defects', n_centroids=50, tangents_glyph_name=None, **kwargs)#
For several “centroid” points along disclination lines, show the director winding character.
- Parameters:
defects_mesh_name (str)
n_centroids (int)
tangents_glyph_name (str, optional)
**kwargs (dict, optional) – Keyword arguments to
analyze_disclinations_at_points()
- analyze_disclinations_at_points(points_mesh_name, radius=3, n_samples=16, use_ints=False)#
- Parameters:
points_mesh_name (str)
radius (int)
n_samples (int)
use_ints (bool)
- Return type:
- auto_setup(notebook=True)#
Routines to run after first importing data.
- calculate_D_tensor(refresh=True)#
Calculate Schimming-Viñals tensor.
Creates the tensor array “D_tensor”, and the symmetric tensor arrays “D^T D” and “D D^T”.
- calculate_Westin_metrics()#
Calculate Westin scalars measures from the Q-tensor.
Creates the scalar arrays “Westin_l”, “Westin_p”, “Westin_s”.
- calculate_and_show_defect_tangent(glyph_stride=2, field_name=None, scale='nematic_sites', mesh_name='defects', threshold=0.4)#
Display disclination line tangent vectors as glyphs
- Parameters:
glyph_stride (int, optional) – Typical spacing between glyphs
field_name (str or None, optional) – Proposed name for new tangent vector field array
scale (str, optional) – Name of scalar array to use for glyph size scale.
mesh_name (str, optional) – Name of defects mesh
threshold (float or None, optional) – Minimum value of 1/S for deciding which points to include in tangent calculation.
- Returns:
Name of new glyphs mesh
- Return type:
str
- calculate_chi_tensor(refresh=True)#
Calculate Efrati-Irvine handedness pseudotensor.
Creates the tensor array “Chi”, the symmetric tensor arrays “Chi^T Chi” and “Chi Chi^T”, and the vector array “Omega from Chi”. Note that this calculation extends Efrati and Irvine’s construction to the Q-tensor rather than relying on the director field.
- calculate_defect_tangent(threshold=0.4, mesh_name='defects', field_name=None)#
Calculate the unit tangent field to defect lines.
- Parameters:
threshold (float or None, optional) – Minimum value of 1/S for deciding which points to include in tangent calculation.
mesh_name (str, optional) – Name of defects mesh
field_name (str or None, optional) – Proposed name for new tangent vector field array
- Returns:
Name of new tangent vector field array
- Return type:
str
- calculate_frank_energy_comps()#
Calculate splay, twist, and bend Frank free energy densities and related quantities.
- calculate_n_gradients(refresh=True)#
Calculate gradients of director field
- calculate_rotation_vector_n()#
Calculate a combination of derivatives on the director field that, for an ideal disclination, gives the rotation vector (a.k.a. Frank vector) up to sign.
- create_fullmesh(dat=None, mesh_name='fullmesh', frame_num=None)#
Create a uniform grid mesh as a root mesh for the filter tree.
- Parameters:
dat (np.ndarray, optional) – Data array, with first three columns holding integer coordinates X, Y, Z.
mesh_name (str, optional) – Name of root mesh.
frame_num (int or None, optional) – Frame number for this root mesh. Pass None to append as a new frame.
- Returns:
Frame number and new root mesh.
- Return type:
int, pyvista.dataset
- static director_data_import(filename, sep='\t')#
Import nematic director data and convert it into Q-tensor data in the open-Qmin data_format.
- Parameters:
filename (str)
sep (str, optional)
- Returns:
Q-tensor data in the open-Qmin data_format.
- Return type:
np.ndarray
- load(filenames, **kwargs)#
Import a file or files.
- Parameters:
filenames (str or list[str]) – Files to load.
reader (callable, optional) – Function to read each file.
mpi_group (bool, optional) – Whether to stitch files together as separate outputs from the same timestep from an MPI run.
do_load_frame (bool, optional) – Whether to view the frame containing the loaded data.
- static max_re_eigval(a)#
Maximum real part of eigenvalue for eigenvalues in an array of 3x3 matrices
- Parameters:
a (np.ndarray | pyvista.pyvista_ndarray) – Array of 3x3 matrices
- Returns:
Maximum real part of eigenvalues
- Return type:
np.ndarray
- static n_from_Q(q_matrix)#
Get director from 3x3-matrix Q-tensor data
- nematic_calculations(dat, mesh)#
Assign Q-tensor and director field data to a mesh, and conduct calculations based on them.
- Parameters:
dat (np.ndarray) – Data array of floats in the open-Qmin data_format: x y z Qxx Qxy Qxz Qyy Qyz site_type S
mesh (pyvista.DataSet)
- num_boundaries()#
Number of boundary objects
- Returns:
Number of boundary objects
- Return type:
int
- pick_point_analyze_disclination(**kwargs)#
Enable surface picking mode and analyze director winding about the picked point, assumed to be on a disclination.
- Parameters:
**kwargs (dict, optional) – Keyword arguments to
analyze_disclinations_at_points()
- plot_director_glyphs_on_circuits(points_mesh_name, circuits_formula, result_name='director_on_circuits', defects_mesh_name='defects')#
Show director glyphs on small, closed-loop measuring circuits around disclinations at given points.
- Parameters:
points_mesh_name (str)
circuits_formula (
FilterFormula
)result_name (str)
defects_mesh_name (str)
- Return type:
- post_init()#
Portion of initialization to run after open_viewmin.FilterTreePlot.__init__()
- set_director(director_data, mesh_name=None)#
Set director orientation data directly from an array.
- Parameters:
director_data (np.ndarray)
mesh_name (str or None, optional) – Name of mesh on which to define director
- set_q0(q0)#
Set energetically preferred cholesteric wavenumber.
(Re)calculates arrays that depend on q0.
- Parameters:
q0 (float) – Chiral wavenumber
- set_qtensor(q_data, mesh)#
Set Q-tensor data directly from an array.
- Parameters:
q_data (np.ndarray) – Q-tensor data with each row formatted as [Qxx, Qxy, Qxz, Qyy, Qyz]
mesh (pyvista.DataSet)
- Returns:
Q-tensor data reformatted such that each row contains the nine elements of the symmetric Q-tensor matrix, flattened.
- Return type:
np.ndarray
- setup_boundaries(separate_meshes=False)#
Add isosurface or isosurfaces for boundaries.
- Parameters:
separate_meshes (bool, optional) – Whether to create a separate isosurface mesh for each boundary.
- setup_defects()#
Add single-value isosurface of uniaxial order to visualize defects
- setup_director()#
Add glyphs to visualize nematic director on a plane controlled by a plane widget
- show_jones(**kwargs)#
Display optical transmission, calculated from Jones matrices, on three planes.
- Parameters:
**kwargs (dict, optional)
- do_auto_setup = False#
- q0#
- reader#
- xyz_arrays#