upxo.heirGs.pdomain_2 module
- class upxo.heirGs.pdomain_2.pdomInstances(count: int = 0, NPDI: int = 0, O: list = <factory>, B: list = <factory>, GSSM: list = <factory>, matdata: list = <factory>)[source]
Bases:
object- Summary:
Physical Domain instances
Each instance has the instance object and condensed object data
- Data fields:
N: Number of physical domain instances to create O: object list of physical domain instances B: bounds of the physical domain
- class upxo.heirGs.pdomain_2.pdomain_info(dimen: int = 2, technique: str = 'vt', vt_tool: str = 'scipy', vt_seed_01: str = 'hex', vt_seed_01_A: numpy.ndarray = <factory>, vt_seed_01_B: numpy.ndarray = <factory>, vt_seed_02: str = 'dont_optimize', vt_seed_02_A: str = 'equidistance', a1: float = 0.1, a2: float = 0.1, angle1: float = 60.0, angle2: float = 60.0, pertFlag: str = True, pertMethod: str = 'ru', px: float = 0.02, py: float = 0.02, pz: float = 0.02, level: int = 3, ninst0: int = 2, ninst1: int = 3, ninst2: int = 2, ninst3: int = 1, ninst_tex: int = 1)[source]
Bases:
object- Summary:
Makes a basic dataclass needed to construct physical domain
- Call:
> pdom(dimen=2, technique=’vt’, level=0, ninst0=2, ninst1=1, ninst2=0, ninst_tex=1) > pdom(dimen=3) # Rest of the fields will have default assignments > pdom() # All fields will be default assignments
- Suggestions:
Instantiate as pdom, to avoid conflict with pandas, normally imported as pd
- Returns:
InstanceName.data
- technique: str = 'vt'
Tool to be used in making Voronoi tessellation OPTIONS: scipy, shapely, freud, vtess, pyvoro++
- Type:
- vt_tool: str = 'scipy'
SEED POINT DISTRIBUTION ‘ur’: uniform random | ‘nr’: normal random | ‘rec’: rectangular ‘hex’: hexagonal | ‘tri’: triangular ‘hex_tri’: combination of hex and tri: interleaved ‘hex_sq’: combination of hex and square: interleaved ‘hex_ur’: combination of hex and uniform random: interleaved ‘sc’: simple cubic | ‘fcc’: face centred cubic | ‘bcc’: body centred cubic ‘hcp’: hexagonal closed packing
NOTE: trailing _p indicates purturbed coordinates ‘ur_p’: uniform random | ‘nr_p’: normal random | ‘rec_p’: rectangular ‘hex_p’: hexagonal | ‘tri_p’: triangular ‘hex_tri_p’: a combin of hex and tri: interleaved ‘hex_sq_p’: a combin of hex and square: interleaved ‘hex_ur_p’: a combin of hex and uniform random: interleaved ‘fcc_p’: face centred cubic | ‘bcc_p’: body centred cubic | ‘hcp_p’: hexagonal closed packing ‘import’: import from file
- Type:
- vt_seed_01_A: numpy.ndarray
STRETCH FACTORS FOR x, y and z
- Type:
- vt_seed_01_B: numpy.ndarray
SEED POINT DISTRIBUTION OPTIMIZATION FLAG
- Type:
- class upxo.heirGs.pdomain_2.pdomain_bounds(orix: float = 0.0, oriy: float = 0.0, oriz: float = 0.0, lenx: float = 1.0, leny: float = 1.0, lenz: float = 1.0, delx: float = 0.1, dely: float = 0.1, delz: float = 0.1, endx: float = 1.0, endy: float = 1.0, endz: float = 1.0)[source]
Bases:
objectA simple data class containing the bound information of the poly-crystal, be it Voronoi teseellated or Monte-Carlo simulation based grain structured
- class upxo.heirGs.pdomain_2.gstack(IDLevel0_GSSM: numpy.ndarray = <factory>, IDLevel1_GSSM: numpy.ndarray = <factory>, IDLevel2_GSSM: numpy.ndarray = <factory>, IDLevel3_GSSM: numpy.ndarray = <factory>)[source]
Bases:
object- Summary:
A stack of _______
- Fields:
Staks the instances gstack: Grain structure stack data GSS: Grain Structure Stack GSSM: Grain Structure Stack Matrix
IDLevelN_GSS : IDs in GSS data of Nth level GS : Unlinked across levels IDLevelN_GSSM: IDs in GSSM data of Nth level GS: Linked across levels
List holding counts of grain strucure instances
- IDLevel0_GSSM: numpy.ndarray
- IDLevel1_GSSM: numpy.ndarray
- IDLevel2_GSSM: numpy.ndarray
- IDLevel3_GSSM: numpy.ndarray
- build_IA(pdo_info)[source]
Construct the Instance Array. At a shallow level, instance array stores the number of instances across available levels as an array
- upxo.heirGs.pdomain_2.make_PDI()[source]
make Physical Domain Instances NPDI: number of physical domain instances needed
- upxo.heirGs.pdomain_2.make_LNI(PDs)[source]
LNI: Nth Level Instances, spanning ALL instances of physical domains PDs: To follow PEP8 guideline of code line length, Physical_Domains has been shortened to PDs. It is the Physical Domain Object Collection
- upxo.heirGs.pdomain_2.clean_querry_PDI_IDs(querry_PDI_IDs, Physical_Domains)[source]
Get the user querry into the queerY– arg and use Physical_Domaoins format to clean and format data before use
- upxo.heirGs.pdomain_2.print_UGSS(querry_PDI_IDs, LNI, Physical_Domains)[source]
print_UGSS: print Unlinked Grain Structure Stack querry_PDI_IDs: ID numbers of PDI being queried by user LNI: Nth Level Instances, spanning ALL instances of physical domains Physical_Domains: It is the Physical Domain Object Collection
- upxo.heirGs.pdomain_2.print_LGSS(querry_PDI_IDs, LNI, Physical_Domains)[source]
print_LGSS: print Linked Grain Structure Stack querry_PDI_IDs: ID numbers of PDI being queried by user LNI: Nth Level Instances, spanning ALL instances of physical domains Physical_Domains: It is the Physical Domain Object Collection
- upxo.heirGs.pdomain_2.make_pd_df_gstack(querry_PDI_IDs, Physical_Domains)[source]
make_pd_df_gstack: Make pandas dataframe of gstack Physical_Domains: It is the Physical Domain Object Collection
- upxo.heirGs.pdomain_2.print_instances_table(querry_PDI_IDs, Physical_Domains, gstack_pd_df)[source]
Prepare reusable strings
- upxo.heirGs.pdomain_2.get_level_instance_chains(gstack_pd_df, Physical_Domains, pullLink_pdi, pullLink_lev, Instance_Number, NumberType)[source]
Get the entire Instance-Dependency-Chain (IDC) for a given GS instance
- upxo.heirGs.pdomain_2.vis_all_gs_level_instances(Physical_Domains, pullLink_pdi)[source]
Visualize the GS stack dependency
- class upxo.heirGs.pdomain_2.lattice[source]
Bases:
pdomInstances,maths- Purpose:
generate 2D and 3D coordinates of all lattice instances across all PDI
store 2D and 3D coordinates of all lattice instances across all PDI
store lattice metadata
generate statistical data of all lattice instances
store statistical data of all lattice instances
Note
- There will be ninst0 number of unique base Level-0 lattices for
every instance of the physical domain
- Data fields:
1. Lattice object 1: Raw data: Coordinates 2: Processed data: ckdtree implementation of VT coordinate data 2: Processed data: 2: Statistical data: statistics data of the lattice
- Design requirements:
fast data access
simple data structure for storage, access and write operations
- Design: User-inputs:
For now, let us not ask user anything explicitly. Instead:
the user will have to manually change parameter values internally
- Design: Internals:
data centric
both gridded and ungridded coordinate data for VT
gridded coordinate data for MC
- Design: Outputs:
object data: lattice data objects of all Level-0 lattices
- figure: a console output of lattice offering a sneak peak of
generated base lattice point distribution
other data: coordinates, perturbations, statistics, metadata
- Rules:
Arrays must be numpy
Array structure must render internal use by xarray and dask
- container(display_structure=False)[source]
Create container data structure to host objects, raw data and metadata
- make_metadata()[source]
Contains metadata about lattice instances across all levels of all physical domain instances
- lattice_container(display_structure=False)[source]
Create container data structure to host objects of the lattice class, raw data and related metadata
- NOTE: For memory contrainsts, only unlinked data will be stored
It can easily be used for linked data by looking up lNi elements against GSSM elements. They have been commented out (see #LAT_linked for example) Uncomment them and use appropriately
- property statstat
Statstat.
- property statval
Statval.
- property opt_flag
Opt flag.
- property opt_technique
Opt technique.
- property pointcloudseed_N
Pointcloudseed n.
- property pointcount_N_trimmed
Pointcount n trimmed.
- coord_container()[source]
Generates containers for base coordinate related data
Variables not ending with _linked store actual raw coordinate related data Variables ending with _linked store object references only.
Values already in _linked can still be useful even if not replaced by objects
- Coordinate related data are:
[1] Unperturbed coordinates (identified by U, example: __LAT_XU) [2] Perturbed coordinates (identified by P, example: LAT_XP) [3] Perturbattion amount (identified as in example: LAT_PX)
- Objects could be:
[1] dataclass instances storing statistical data, or [2] dataclass instances storing perturbation parameters, etc.
- property xu
Xu.
- property yu
Yu.
- property zu
Zu.
- property cu
Cu.
- property xp
Xp.
- property yp
Yp.
- property get_zp
Return
zp.
- property get_cp
Return
cp.
- property get_px
Return
px.
- property get_py
Return
py.
- property get_pz
Return
pz.
- property get_pc
Return
pc.
- perturb(gana_pdi)[source]
- NOTE: PERTURBATION TO BE APPLIED AFTER THE VORONOI TESSELLATION HAS BEEN
TRUNCATED. ELSE, THERE WILL BE GOOD CHANCES WHERE THE DIFFERENT LEVBELS OF THE SAME SYTARTING MICROSTRUCRUE, HAVING DIFFERENT PERTIURBATION EXTWENTS CAN HAVE DIFFWERENT NUMBER OF GRAINS, MDEPENDING ON WHERE SOME OF THE POINTS MIGHT BE DURING TRUNCATION PROCESS
- make_xyz()[source]
This makes the traditional 3-column coordinate array of x, y and z
Note
[1] A return is intentionallly done here to reduce lattice obj size If needed in future, this can easily be internalized by removing return and makeing self.xyz = np.hstack(….)
- make_xyz_matrix(xyz)[source]
This makes the traditional 3-column coordinate array of x, y and z in the form of a numpy matrix
Note
[1] A return is intentionallly done here to reduce lattice obj size If needed in future, this can easily be internalized by removing return and chaing the code appropriately
- property setDPI
a setter to set the figure dpi value