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

count: int = 0
NPDI: int = 0
O: list
B: list
GSSM: list
matdata: list
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

dimen: int = 2
technique: str = 'vt'

Tool to be used in making Voronoi tessellation OPTIONS: scipy, shapely, freud, vtess, pyvoro++

Type:

vt_tool

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

vt_seed_01: str = 'hex'

PERTURBATION FACTORS for x, y and z

Type:

vt_seed_01_A

vt_seed_01_A: numpy.ndarray

STRETCH FACTORS FOR x, y and z

Type:

vt_seed_01_B

vt_seed_01_B: numpy.ndarray

SEED POINT DISTRIBUTION OPTIMIZATION FLAG

Type:

vt_seed_02

vt_seed_02: str = 'dont_optimize'

OPTIMIZATION TECNIQUE

Type:

vt_seed_02_A

vt_seed_02_A: str = 'equidistance'

some parameters governing the voronoi tessellation lattice geometry

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
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: object

A simple data class containing the bound information of the poly-crystal, be it Voronoi teseellated or Monte-Carlo simulation based grain structured

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
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

Level0_ID_GSS()[source]

Establish the level - 0 grain structure stack array - unlinked

Level1_ID_GSS()[source]

Establish the level - 1 grain structure stack array - unlinked

Level2_ID_GSS()[source]

Establish the level - 2 grain structure stack array - unlinked

Level3_ID_GSS()[source]

Establish the level - 3 grain structure stack array - unlinked

set_pmax(pdo_info)[source]

Calculate the maximum number of grain structure instances amongst all available levels for the physical domain under consideration

Level0_ID_GSSM()[source]

Establish the level-0 grain struture stack matrix

Level1_ID_GSSM()[source]

Establish the level-1 grain struture stack matrix

Level2_ID_GSSM()[source]

Establish the level-2 grain struture stack matrix

Level3_ID_GSSM()[source]

Establish the level-3 grain struture stack matrix

build(pdo_info)[source]

Build.

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.write_instances(self)[source]

Export or convert to te instances.

upxo.heirGs.pdomain_2.vis_all_gs_level_instances(Physical_Domains, pullLink_pdi)[source]

Visualize the GS stack dependency

class upxo.heirGs.pdomain_2.maths[source]

Bases: object

cosd()[source]

Cosd.

sind()[source]

Sind.

alike(arrayType='ru')[source]

Alike.

class upxo.heirGs.pdomain_2.lattice[source]

Bases: pdomInstances, maths

Purpose:
  1. generate 2D and 3D coordinates of all lattice instances across all PDI

  2. store 2D and 3D coordinates of all lattice instances across all PDI

  3. store lattice metadata

  4. generate statistical data of all lattice instances

  5. store statistical data of all lattice instances

Note

  1. 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:
  1. fast data access

  2. simple data structure for storage, access and write operations

Design: User-inputs:
    1. For now, let us not ask user anything explicitly. Instead:

    the user will have to manually change parameter values internally

Design: Internals:
  1. data centric

  2. both gridded and ungridded coordinate data for VT

  3. gridded coordinate data for MC

Design: Outputs:
  1. object data: lattice data objects of all Level-0 lattices

  2. figure: a console output of lattice offering a sneak peak of

    generated base lattice point distribution

  3. other data: coordinates, perturbations, statistics, metadata

Rules:
  1. Arrays must be numpy

  2. 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

make_lattice_container()[source]

Build unlinked data structure for lattice object container

status(*args)[source]

pdi_list: list: list of pdi for which status is to be displayed

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.

base_coord_generator_vt(gana_pdi)[source]

hexagonal random interleaved.

base_coord_generator_mc(gana_pdi)[source]

Base coord generator mc.

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

optimize()[source]

Optimize.

stretch()[source]

Stretch.

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

point_cloud_mean(xyz)[source]

Calcuaklte the geometric mean of the point cloud

squeeze_base_coord(xbase, ybase, zbase)[source]

TO DEPRECATE

property setDPI

a setter to set the figure dpi value

visualize_seeds(xyz, axis_obj, gana_pdi, gana_l0)[source]

Enables simple and quick visualixzation of the lattice seed points

finalize(gana_pdi)[source]

A couple lines of codes to finalize creation of lattice

upxo.heirGs.pdomain_2.make_lattice(Physical_Domain_Object)[source]

Definition to build all instances of the lattice using lattice class and the pdomInstances class

class upxo.heirGs.pdomain_2.opt_ckdtree[source]

Bases: object

class upxo.heirGs.pdomain_2.hdf5[source]

Bases: lattice

write()[source]

Write.