polyTEM.spatial.domain.DomainCollection¶
- class polyTEM.spatial.domain.DomainCollection(domains: list | None = None, pixel_res=None, savedir='')¶
Bases:
objectA collection of one or more Domains
- Variables:
domains – list of Domain objects
savedir – path to save directory
pixel_resolution – nm/pixel
parallel_dtheta – list of scipy random variable class generated from rv_histogram, which contains the distribution for probability P(dtheta|r), where r is the list index (i.e. parallel_dtheta[1] = P(dtheta | r=1) in the direction parallel to the nematic director of the centroid)
perpendicular_dtheta – same as DomainCollection.parallel_dtheta but in the perpendicular direction
Ld_par – orientation correlation length in the parallel direction (in pixels)
Ld_perp – orientation correlation length in the perpendicular direction (in pixels)
- histogram_dtheta()¶
computes parallel_dtheta and perpendicular_dtheta
- plot_orientation_change()¶
plots the pdf from histogram_dtheta
- Private attributes:
_parallel_dtheta_values, _perpendicular_dtheta_values _expected_val_par, _expected_val_perp _model_Ld_par, _model_Ld_perp _orientation_correlation_length_bounds
- __init__(domains: list | None = None, pixel_res=None, savedir='')¶
Methods
__init__([domains, pixel_res, savedir])frank_elastic_relation([freqs])Calculate an estimate for the Frank elastic relations by taking the average
from_crystalstack(crystal_stack[, savedir, ...])Creates DomainsCollection from CrystalStack
Histograms the orientation change as a function of distance in the directions parallel and perpendicular to the nematic director of at the domain centroid
load(savefile)orientation_correlation_length([min_dist, ...])Calculates the orientation correlation length given by the exponential decay fit of the expected value <2cos^2(Delta heta)-1>
plot_orientation_change(distances[, ...])Plots the pdf of the probability $P(Delta heta | r)$ in the directions parallel and perpendicular to the nematic director of the domain centroid.
plot_orientation_correlation()save(savefile)Save as json.
- _remove_unpicklable()¶
Returns a copy of the DomainCollection, but with unpicklable attributes set to None
- Current List of unserializable attributes:
parallel_dtheta and perpendicular_dtheta: scipy.stats distributions cannot be serialized
- frank_elastic_relation(freqs=array([0.14, 0.15755102, 0.17510204, 0.19265306, 0.21020408, 0.2277551, 0.24530612, 0.26285714, 0.28040816, 0.29795918, 0.3155102, 0.33306122, 0.35061224, 0.36816327, 0.38571429, 0.40326531, 0.42081633, 0.43836735, 0.45591837, 0.47346939, 0.49102041, 0.50857143, 0.52612245, 0.54367347, 0.56122449, 0.57877551, 0.59632653, 0.61387755, 0.63142857, 0.64897959, 0.66653061, 0.68408163, 0.70163265, 0.71918367, 0.73673469, 0.75428571, 0.77183673, 0.78938776, 0.80693878, 0.8244898, 0.84204082, 0.85959184, 0.87714286, 0.89469388, 0.9122449, 0.92979592, 0.94734694, 0.96489796, 0.98244898, 1.]))¶
Calculate an estimate for the Frank elastic relations by taking the average of the Fourier Transform of the orientation correlation function
Let R = autocorrelation function = $langle n(r) cdot n(r’)
- angle$. <br>
Then the Fourier transform of R is: egin{equation} mathscr{F}{R}(k) = 1 -
- rac{1}{K_B k_y^2 + K_Sk_x^2}
end{equation}
If we use R_parallel and R_perpendicular instead we get: egin{align}
mathscr{F}{R_{parallel}}(k) = 1 -
- rac{1}{K_B k_y^2}
mathscr{F}{R_{perp}}(k) = 1 -
- rac{1}{K_S k_x^2}
end{align} and the Frank Elastic relations egin{align}
K_Bk_y^2 &=
- rac{1}{1-mathscr{F}{R_{parallel}}}
K_Sk_x^2 &=
- rac{1}{1-mathscr{F}{R_{perp}}}
end{align}
- Returns:
freqs Ks_kx^2 Kb_ky^2
- classmethod from_crystalstack(crystal_stack, savedir='', alpha=0.2, cluster_df=None, num_threads=1)¶
Creates DomainsCollection from CrystalStack
for 1400 domains, this takes 12 seconds on 1 core if no cluster_df is given. Takes 6 seconds if cluster_df is provided (Polygons pre computed) So I probably don’t need to speed it up. but the multiprocessing is written for num_threads>1 just in case.
- Parameters:
crystal_stack – CrystalStack object
savedir – directory for savefiles
alpha – parameter to extract shape of domain, see Domain.make_domain()
cluster_df – optional, backwards compatibility with cluster_dfs made by pytem.spatial_analysis.create_polygons()
num_threads – integer, num_threads == 1 core does not use multiprocessing, else sets the number of cores used
- histogram_dtheta()¶
Histograms the orientation change as a function of distance in the directions parallel and perpendicular to the nematic director of at the domain centroid
- orientation_correlation_length(min_dist=0, max_dist=20, plot=False)¶
Calculates the orientation correlation length given by the exponential decay fit of the expected value <2cos^2(Delta heta)-1>
- plot_orientation_change(distances: list, dtheta_min=-5, dtheta_max=5)¶
Plots the pdf of the probability $P(Delta heta | r)$ in the directions parallel and perpendicular to the nematic director of the domain centroid.
- Parameters:
distances – list of integer distances to plot
dtheta_min – int
dtheta_max – int
- save(savefile)¶
Save as json. However, scipy.stats.distributions cannot be serialized, so DomainCollection.parallel_dtheta and DomainCollection.perpendicular_dtheta cannot be saved. Instead, we will only save _parallel_dtheta_values and _perpendicular_dtheta_values, and the rv_histogram will be recreated upon loading