polyTEM.spatial.domain.Domain

class polyTEM.spatial.domain.Domain(data=None, pixel_res=None, label=None, savedir='', polygon=None, centroid=None, centroid_orientation=None, coo=None, autopopulate=False)

Bases: object

Variables:
  • data – np.array of the theta values clustered into this domain

  • label – int index label that corresponds to the cluster_num in CrystalStack and cluster_df

  • savedir – directory to save to

  • polygon – Shapely Polygon object of the domain

  • centroid – indices of center of mass, calculated from the Shapely Polygon

  • coo – coordinates of the domain

  • centroid_orientation – theta orientation at the centroid of the domain

  • interpolated_data – np.array of theta values with missing values interpolated, and shifted such that the interpolated centroid is at the image center

  • aligned_data – np.array of interpolated_data rotated such that the nematic director of the centroid is in the y-direction

Notes

  • This class is indexed by x,y == i,j

__init__(data=None, pixel_res=None, label=None, savedir='', polygon=None, centroid=None, centroid_orientation=None, coo=None, autopopulate=False)

Methods

__init__([data, pixel_res, label, savedir, ...])

align_nematic_center([plot])

rotates the interpolated domain (and the orientations) such that the nematic director at the centroid of the domain is aligned parallel to the horizontal axis (j direction)

gradient([plot])

Calculates the spatial gradient of the nematic directors in the domain This function uses ij indexing, such that x iterates through rows and y iterates through columns and the array is plotted using plt.imshow

interpolate([plot])

Interpolates missing values in the domain array

load(filename)

make_domain(crystal_stack, label, savedir[, ...])

param stack:

CrystalStack

plot_gradient(*args)

param *args:

which gradients to plot, defined as strings.

rotate(angle)

Rotates the interpolated domain (and the orientations) by specified angle, Rotates about the center of the image

save([filename])

align_nematic_center(plot=False)

rotates the interpolated domain (and the orientations) such that the nematic director at the centroid of the domain is aligned parallel to the horizontal axis (j direction)

gradient(plot=False)

Calculates the spatial gradient of the nematic directors in the domain This function uses ij indexing, such that x iterates through rows and y iterates through columns and the array is plotted using plt.imshow

interpolate(plot=False)

Interpolates missing values in the domain array

classmethod make_domain(crystal_stack, label, savedir, alpha=0.2, polygon=None)
Parameters:
  • stack – CrystalStack

  • label – cluster_num of interest

  • savedir – directory to save Domain information

  • alpha – default 0.2, hyperparameter for getting domain shape from clustered coordinates, alpha=0 is the Convex Hull, alpha>1 Convex Hull

  • polygon – optional, Shapely Polygon object

Returns:

Domain object

plot_gradient(*args)
Parameters:

*args – which gradients to plot, defined as strings. can be ‘dx/dx’,’dx/dy’,’dy/dx’,’dy/dy’

rotate(angle)

Rotates the interpolated domain (and the orientations) by specified angle, Rotates about the center of the image