upxo.repgen.repgen3dmcgs module

3D representative MC grain-structure generation and temporal-slice ranking.

Class repgen3d ranks MCGS3D time slices and related candidates against a reference structure (morphology / grain-count style filters and property metrics). Used with 3D twin and OFHC-style pipelines for selecting host slices before twin introduction.

Import:

from upxo.repgen.repgen3dmcgs import repgen3d
class upxo.repgen.repgen3dmcgs.repgen3d(tdist=None, tstat=None, tgs=None, sgs=None, tdim=2, iroute='tgs.sgs', sgstype='upxo.mc3d', tgstype='upxo.mc3d')[source]

Bases: object

3D representative MC grain-structure ranking against a reference.

Ranks MCGS3D temporal slices and related candidates (sample sgs) against a target structure using morphology / grain-count filters and property metrics. Used with 3D twin and OFHC-style pipelines when selecting host slices before twin introduction.

Valid iroute values (VALiroutes)

  • 'tdist.sgs' — target distributions vs sample GS

  • 'tstat.sgs' — target statistics vs sample GS

  • 'tgs.sgs' — target and sample grain structures directly

tdist, tstat

Target distribution / statistics collections when used.

tgs, sgs

Target and sample grain-structure objects.

iroute

Generation / comparison route (see VALiroutes).

Type:

str

mpflags

Morphological-property control flags for target and/or sample.

Type:

dict

rm0tests, rm0

r0-test selection and results.

VALiroutes = ('tdist.sgs', 'tstat.sgs', 'tgs.sgs')
VALgs = ('upxo.mc2d', 'upxo.mc3d', 'upxo.pv2d', 'upxo.vv3d', 'upxo.v2d', 'upxo.v3d', 'image2d', 'image3d')
tdist
tstat
tgs
sgs
tdim
iroute
sgstype
tgstype
classmethod from_tdist_sgs(tdist=None, sgs=None, tdim=2, sgstype='upxo.mc3d')[source]

Alternative constructor for creating a RepGen3DMCGS instance using distribution data of target grain structure and sample grain structure.

The sample grain structure can be of the following types: - see description of sgstype parameter

Parameters:
  • tdist (upxo distribution collection object, optional) – Distribution data of the target grain structure. Defaults to None.

  • sgs (grain structure data object, optional) – The sample grain structure. Defaults to None.

  • tdim (int, optional) – Dimensionality of the target grain structure data used for tdist. Defaults to 2.

  • sgstype (str) – Type of the sample grain structure. Must be in VALgs.

Returns:

A new RepGen3DMCGS instance.

Return type:

RepGen3DMCGS

classmethod from_tstat_sgs(tstat=None, sgs=None, tdim=2, sgstype='upxo.mc3d')[source]

Alternative constructor for creating a RepGen3DMCGS instance using statistics data of target grain structure and sample grain structure.

The sample grain structure can be of the following types: - see description of sgstype parameter

Parameters:
  • tstat (upxo statistics collection object, optional) – Statistics data of the target grain structure. Defaults to None.

  • sgs (grain structure data object, optional) – The sample grain structure. Defaults to None.

  • tdim (int, optional) – Dimensionality of the target grain structure data used for tstat. Defaults to 2.

  • sgstype (str) – Type of the sample grain structure. Must be in VALgs.

Returns:

A new RepGen3DMCGS instance.

Return type:

RepGen3DMCGS

classmethod from_tgs_sgs(tgs=None, sgs=None, tgstype='upxo.mc3d', sgstype='upxo.mc3d')[source]

Alternative constructor for creating a RepGen3DMCGS instance using actual target and sample grain structures.

The sample grain structure can be of the following types: - see description of sgstype parameter

Parameters:
  • tstat (upxo statistics collection object, optional) – Statistics data of the target grain structure. Defaults to None.

  • sgs (grain structure data object, optional) – The sample grain structure. Defaults to None.

  • tdim (int, optional) – Dimensionality of the target grain structure data used for tstat. Defaults to 2.

  • tgstype (str, optional) – Type of the target grain structure. Must be in VALgs. Defaults to ‘upxo.mc3d’.

  • sgstype (str) – Type of the sample grain structure. Must be in VALgs.

Returns:

A new RepGen3DMCGS instance.

Return type:

RepGen3DMCGS

set_mpflags(volnv=False, volsr=False, volch=False, arbbox=False, sanv=False, savi=False, sasr=False, pernv=False, pervl=False, pergl=False, solidity=False, ecc=False, com=False, sph=False, fn=False, fdim=False, rat_sanv_volnv=False, arellfit=False, eqdia=False, feqdia=False, eqdia_base_size_spec='volnv', arbbox_fmt='gid_dict', arellfit_metric='max', arellfit_calculate_efits=False, arellfit_efit_routine=1, arellfit_efit_regularize_data=False)[source]

Set parameter values to control which morphological properties are calculated and used in representativeness assessments and/or representativeness grain structure identification/generation.

Parameters:
  • volnv (bool, optional) – Volume by number of voxels. Defaults to False.

  • volsr (bool, optional) – Volume after grain boundary surface reconstruction . Defaults to False.

  • volch (bool, optional) – Volume of the convex hull . Defaults to False.

  • arbbox (bool, optional) – Aligned bounding box . Defaults to False.

  • sanv (bool, optional) – Surface area of the non-void space . Defaults to False.

  • savi (bool, optional) – Surface area of the void space . Defaults to False.

  • sasr (bool, optional) – Surface area of the smallest rectangular prism . Defaults to False.

  • pernv (bool, optional) – perimeter by number of voxels . Defaults to False.

  • pervl (bool, optional) – perimeter by voxel edge lines . Defaults to False.

  • pergl (bool, optional) – perimeter by geometric grain boundary line segments . Defaults to False.

  • solidity (bool, optional) – Solidity . Defaults to False.

  • ecc (bool, optional) – Eccentricity . Defaults to False.

  • com (bool, optional) – compactness . Defaults to False.

  • sph (bool, optional) – Sphericity . Defaults to False.

  • fn (bool, optional) – Flatness . Defaults to False.

  • fdim (bool, optional) – Fractal dimension . Defaults to False.

  • rat_sanv_volnv (bool, optional) – Ratio of sanv to volnv . Defaults to False.

  • arellfit (bool, optional) – Whether to calculate the parameters of an equivalent ellipsoid . Defaults to False.

  • eqdia (bool, optional) – Equivalent diameter . Defaults to False.

  • feqdia (bool, optional) – Feret equivalent diameter . Defaults to False.

  • eqdia_base_size_spec (str, optional) – Specification for the base size for equivalent diameter calculation, ‘volnv’ (default), ‘volsr’, or ‘volch’.

  • arbbox_fmt (str, optional) – Format of the aligned bounding box, ‘gid_dict’ (default).

  • arellfit_metric (str, optional) – Metric to use for equivalent ellipsoid fitting, ‘max’ (default).

  • arellfit_calculate_efits (bool, optional) – Whether to calculate the efits . Defaults to False.

  • arellfit_efit_routine (int, optional) – Routine to use for efit calculation (default is 1).

  • arellfit_efit_regularize_data (bool, optional) – Whether to regularize data for efit calculation . Defaults to False.

Return type:

None

char_gs(find_spatial_bounds_of_grains=False)[source]

Char gs.

validate_mprops()[source]

Check or validate validate mprops.

rm0_setup(kld=False, ks2=False, mhd=True)[source]

Rm0 setup.

rm0_run()[source]

Rm0 run.

rm1_setup(nslices=1, avoid_bundary_slice=True, ordern=[1, 3], tests={'btwcen': False, 'clscen': False, 'degcen': False, 'ed': True, 'egnvcen': False, 'js': True, 'ksp': True, 'nlsd': True, 'wd': True})[source]

Rm1 setup.

rm1_run()[source]

Rm1 run.

mpflags
rm0tests
rm0
rm1tests