t4_geom_convert.Kernel package
Subpackages
- t4_geom_convert.Kernel.BoundaryCondition package
- t4_geom_convert.Kernel.Composition package
- Submodules
- t4_geom_convert.Kernel.Composition.Abundances module
- t4_geom_convert.Kernel.Composition.CCompositionMCNP module
- t4_geom_convert.Kernel.Composition.CCompositionT4 module
- t4_geom_convert.Kernel.Composition.CDictCompositionMCNP module
- t4_geom_convert.Kernel.Composition.CompositionConversionMCNPToT4 module
- t4_geom_convert.Kernel.Composition.ConstructCompositionT4 module
- t4_geom_convert.Kernel.Composition.ConvertIsotope module
- t4_geom_convert.Kernel.Composition.EIsotopeAtomicNumberMCNP module
EIsotopeAtomicNumberEIsotopeAtomicNumber.1EIsotopeAtomicNumber.10EIsotopeAtomicNumber.100EIsotopeAtomicNumber.101EIsotopeAtomicNumber.102EIsotopeAtomicNumber.103EIsotopeAtomicNumber.104EIsotopeAtomicNumber.105EIsotopeAtomicNumber.106EIsotopeAtomicNumber.107EIsotopeAtomicNumber.108EIsotopeAtomicNumber.109EIsotopeAtomicNumber.11EIsotopeAtomicNumber.110EIsotopeAtomicNumber.111EIsotopeAtomicNumber.112EIsotopeAtomicNumber.113EIsotopeAtomicNumber.114EIsotopeAtomicNumber.115EIsotopeAtomicNumber.116EIsotopeAtomicNumber.117EIsotopeAtomicNumber.118EIsotopeAtomicNumber.12EIsotopeAtomicNumber.13EIsotopeAtomicNumber.14EIsotopeAtomicNumber.15EIsotopeAtomicNumber.16EIsotopeAtomicNumber.17EIsotopeAtomicNumber.18EIsotopeAtomicNumber.19EIsotopeAtomicNumber.2EIsotopeAtomicNumber.20EIsotopeAtomicNumber.21EIsotopeAtomicNumber.22EIsotopeAtomicNumber.23EIsotopeAtomicNumber.24EIsotopeAtomicNumber.25EIsotopeAtomicNumber.26EIsotopeAtomicNumber.27EIsotopeAtomicNumber.28EIsotopeAtomicNumber.29EIsotopeAtomicNumber.3EIsotopeAtomicNumber.30EIsotopeAtomicNumber.31EIsotopeAtomicNumber.32EIsotopeAtomicNumber.33EIsotopeAtomicNumber.34EIsotopeAtomicNumber.35EIsotopeAtomicNumber.36EIsotopeAtomicNumber.37EIsotopeAtomicNumber.38EIsotopeAtomicNumber.39EIsotopeAtomicNumber.4EIsotopeAtomicNumber.40EIsotopeAtomicNumber.41EIsotopeAtomicNumber.42EIsotopeAtomicNumber.43EIsotopeAtomicNumber.44EIsotopeAtomicNumber.45EIsotopeAtomicNumber.46EIsotopeAtomicNumber.47EIsotopeAtomicNumber.48EIsotopeAtomicNumber.49EIsotopeAtomicNumber.5EIsotopeAtomicNumber.50EIsotopeAtomicNumber.51EIsotopeAtomicNumber.52EIsotopeAtomicNumber.53EIsotopeAtomicNumber.54EIsotopeAtomicNumber.55EIsotopeAtomicNumber.56EIsotopeAtomicNumber.57EIsotopeAtomicNumber.58EIsotopeAtomicNumber.59EIsotopeAtomicNumber.6EIsotopeAtomicNumber.60EIsotopeAtomicNumber.61EIsotopeAtomicNumber.62EIsotopeAtomicNumber.63EIsotopeAtomicNumber.64EIsotopeAtomicNumber.65EIsotopeAtomicNumber.66EIsotopeAtomicNumber.67EIsotopeAtomicNumber.68EIsotopeAtomicNumber.69EIsotopeAtomicNumber.7EIsotopeAtomicNumber.70EIsotopeAtomicNumber.71EIsotopeAtomicNumber.72EIsotopeAtomicNumber.73EIsotopeAtomicNumber.74EIsotopeAtomicNumber.75EIsotopeAtomicNumber.76EIsotopeAtomicNumber.77EIsotopeAtomicNumber.78EIsotopeAtomicNumber.79EIsotopeAtomicNumber.8EIsotopeAtomicNumber.80EIsotopeAtomicNumber.81EIsotopeAtomicNumber.82EIsotopeAtomicNumber.83EIsotopeAtomicNumber.84EIsotopeAtomicNumber.85EIsotopeAtomicNumber.86EIsotopeAtomicNumber.87EIsotopeAtomicNumber.88EIsotopeAtomicNumber.89EIsotopeAtomicNumber.9EIsotopeAtomicNumber.90EIsotopeAtomicNumber.91EIsotopeAtomicNumber.92EIsotopeAtomicNumber.93EIsotopeAtomicNumber.94EIsotopeAtomicNumber.95EIsotopeAtomicNumber.96EIsotopeAtomicNumber.97EIsotopeAtomicNumber.98EIsotopeAtomicNumber.99
- t4_geom_convert.Kernel.Composition.EIsotopeNameElementT4 module
EIsotopeNameElementEIsotopeNameElement.ACEIsotopeNameElement.AGEIsotopeNameElement.ALEIsotopeNameElement.AMEIsotopeNameElement.AREIsotopeNameElement.ASEIsotopeNameElement.ATEIsotopeNameElement.AUEIsotopeNameElement.BEIsotopeNameElement.BAEIsotopeNameElement.BEEIsotopeNameElement.BHEIsotopeNameElement.BIEIsotopeNameElement.BKEIsotopeNameElement.BREIsotopeNameElement.CEIsotopeNameElement.CAEIsotopeNameElement.CDEIsotopeNameElement.CEEIsotopeNameElement.CFEIsotopeNameElement.CLEIsotopeNameElement.CMEIsotopeNameElement.CNEIsotopeNameElement.COEIsotopeNameElement.CREIsotopeNameElement.CSEIsotopeNameElement.CUEIsotopeNameElement.DBEIsotopeNameElement.DSEIsotopeNameElement.DYEIsotopeNameElement.EREIsotopeNameElement.ESEIsotopeNameElement.EUEIsotopeNameElement.FEIsotopeNameElement.FEEIsotopeNameElement.FLEIsotopeNameElement.FMEIsotopeNameElement.FREIsotopeNameElement.GAEIsotopeNameElement.GDEIsotopeNameElement.GEEIsotopeNameElement.HEIsotopeNameElement.HEEIsotopeNameElement.HFEIsotopeNameElement.HGEIsotopeNameElement.HOEIsotopeNameElement.HSEIsotopeNameElement.IEIsotopeNameElement.INEIsotopeNameElement.IREIsotopeNameElement.KEIsotopeNameElement.KREIsotopeNameElement.LAEIsotopeNameElement.LIEIsotopeNameElement.LREIsotopeNameElement.LUEIsotopeNameElement.LVEIsotopeNameElement.MCEIsotopeNameElement.MDEIsotopeNameElement.MGEIsotopeNameElement.MNEIsotopeNameElement.MOEIsotopeNameElement.MTEIsotopeNameElement.NEIsotopeNameElement.NAEIsotopeNameElement.NBEIsotopeNameElement.NDEIsotopeNameElement.NEEIsotopeNameElement.NHEIsotopeNameElement.NIEIsotopeNameElement.NOEIsotopeNameElement.NPEIsotopeNameElement.OEIsotopeNameElement.OGEIsotopeNameElement.OSEIsotopeNameElement.PEIsotopeNameElement.PAEIsotopeNameElement.PBEIsotopeNameElement.PDEIsotopeNameElement.PMEIsotopeNameElement.POEIsotopeNameElement.PREIsotopeNameElement.PTEIsotopeNameElement.PUEIsotopeNameElement.RAEIsotopeNameElement.RBEIsotopeNameElement.REEIsotopeNameElement.RFEIsotopeNameElement.RGEIsotopeNameElement.RHEIsotopeNameElement.RNEIsotopeNameElement.RUEIsotopeNameElement.SEIsotopeNameElement.SBEIsotopeNameElement.SCEIsotopeNameElement.SEEIsotopeNameElement.SGEIsotopeNameElement.SIEIsotopeNameElement.SMEIsotopeNameElement.SNEIsotopeNameElement.SREIsotopeNameElement.TAEIsotopeNameElement.TBEIsotopeNameElement.TCEIsotopeNameElement.TEEIsotopeNameElement.THEIsotopeNameElement.TIEIsotopeNameElement.TLEIsotopeNameElement.TMEIsotopeNameElement.TSEIsotopeNameElement.UEIsotopeNameElement.VEIsotopeNameElement.WEIsotopeNameElement.XEEIsotopeNameElement.YEIsotopeNameElement.YBEIsotopeNameElement.ZNEIsotopeNameElement.ZR
- Module contents
- t4_geom_convert.Kernel.Configuration package
- t4_geom_convert.Kernel.Exceptions package
- t4_geom_convert.Kernel.FileHandlers package
- t4_geom_convert.Kernel.GeomComp package
- t4_geom_convert.Kernel.Surface package
- Submodules
- t4_geom_convert.Kernel.Surface.CTransformationMCNP module
- t4_geom_convert.Kernel.Surface.CollectionDict module
- t4_geom_convert.Kernel.Surface.ConstructSurfaceT4 module
- t4_geom_convert.Kernel.Surface.ConversionSurfaceMCNPToT4 module
- t4_geom_convert.Kernel.Surface.DTypeConversion module
- t4_geom_convert.Kernel.Surface.Duplicates module
- t4_geom_convert.Kernel.Surface.ESurfaceTypeMCNP module
ESurfaceTypeMCNPESurfaceTypeMCNP.ARBESurfaceTypeMCNP.BOXESurfaceTypeMCNP.CESurfaceTypeMCNP.CXESurfaceTypeMCNP.CYESurfaceTypeMCNP.CZESurfaceTypeMCNP.C_XESurfaceTypeMCNP.C_YESurfaceTypeMCNP.C_ZESurfaceTypeMCNP.ELLESurfaceTypeMCNP.GQESurfaceTypeMCNP.HEXESurfaceTypeMCNP.KESurfaceTypeMCNP.KXESurfaceTypeMCNP.KYESurfaceTypeMCNP.KZESurfaceTypeMCNP.K_XESurfaceTypeMCNP.K_YESurfaceTypeMCNP.K_ZESurfaceTypeMCNP.PESurfaceTypeMCNP.PXESurfaceTypeMCNP.PYESurfaceTypeMCNP.PZESurfaceTypeMCNP.RCCESurfaceTypeMCNP.RECESurfaceTypeMCNP.RHPESurfaceTypeMCNP.RPPESurfaceTypeMCNP.SESurfaceTypeMCNP.SOESurfaceTypeMCNP.SPHESurfaceTypeMCNP.SQESurfaceTypeMCNP.SXESurfaceTypeMCNP.SYESurfaceTypeMCNP.SZESurfaceTypeMCNP.TESurfaceTypeMCNP.TRCESurfaceTypeMCNP.TXESurfaceTypeMCNP.TYESurfaceTypeMCNP.TZESurfaceTypeMCNP.WEDESurfaceTypeMCNP.XESurfaceTypeMCNP.YESurfaceTypeMCNP.Z
mcnp_to_mip()string_to_enum()
- t4_geom_convert.Kernel.Surface.ESurfaceTypeT4 module
ESurfaceTypeT4ESurfaceTypeT4.CONEESurfaceTypeT4.CONEXESurfaceTypeT4.CONEYESurfaceTypeT4.CONEZESurfaceTypeT4.CYLESurfaceTypeT4.CYLXESurfaceTypeT4.CYLYESurfaceTypeT4.CYLZESurfaceTypeT4.PLANEESurfaceTypeT4.PLANEXESurfaceTypeT4.PLANEYESurfaceTypeT4.PLANEZESurfaceTypeT4.QUADESurfaceTypeT4.SPHEREESurfaceTypeT4.TORUSXESurfaceTypeT4.TORUSYESurfaceTypeT4.TORUSZ
- t4_geom_convert.Kernel.Surface.MacroBodies module
- t4_geom_convert.Kernel.Surface.SurfaceCollection module
- t4_geom_convert.Kernel.Surface.SurfaceConversionError module
- t4_geom_convert.Kernel.Surface.SurfaceMCNP module
- t4_geom_convert.Kernel.Surface.SurfaceT4 module
- Module contents
- t4_geom_convert.Kernel.Transformation package
- t4_geom_convert.Kernel.Volume package
- Submodules
- t4_geom_convert.Kernel.Volume.ByUniverse module
- t4_geom_convert.Kernel.Volume.CellConversion module
CellConversionCellConversion.apply_trcl()CellConversion.cell_transform()CellConversion.conv_equa()CellConversion.conv_intersection()CellConversion.conv_union()CellConversion.conv_union_helpers()CellConversion.convert_cellref()CellConversion.convert_surface()CellConversion.develop_lattice()CellConversion.extract_surfaces()CellConversion.pot_complement()CellConversion.pot_convert()CellConversion.pot_expand_surfs()CellConversion.pot_fill()CellConversion.pot_flag()CellConversion.pot_optimise()CellConversion.pot_to_t4_cell()CellConversion.pot_transform()
- t4_geom_convert.Kernel.Volume.CellConversionError module
- t4_geom_convert.Kernel.Volume.CellInlining module
- t4_geom_convert.Kernel.Volume.CellMCNP module
- t4_geom_convert.Kernel.Volume.ConstructVolumeT4 module
- t4_geom_convert.Kernel.Volume.DictVolumeT4 module
- t4_geom_convert.Kernel.Volume.Lattice module
- t4_geom_convert.Kernel.Volume.TreeFunctions module
- t4_geom_convert.Kernel.Volume.VolumeT4 module
- Module contents
Submodules
t4_geom_convert.Kernel.Progress module
Implementation of a simple progress meter.
t4_geom_convert.Kernel.VectUtils module
- t4_geom_convert.Kernel.VectUtils.isPointOnPlane(point, plane, *, tol=1e-10)
Returns True if the point lies on the plane within the specified tolerance.
>>> point = (1.0, 1.0, 1.0) >>> plane = ((3.0, 0.0, 0.0), (1.0, 1.0, 1.0)) >>> isPointOnPlane(point, plane) True
- t4_geom_convert.Kernel.VectUtils.isVectorParallelToPlane(vector, plane, *, tol=1e-10)
Returns True if the vector is parallel to the plane within the specified tolerance.
>>> vector = (1.0, 1.0, -2.0) >>> plane = ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0)) >>> isVectorParallelToPlane(vector, plane) True >>> isVectorParallelToPlane(rescale(2.0, vector), plane) True >>> isVectorParallelToPlane(plane[1], plane) False
- t4_geom_convert.Kernel.VectUtils.mag(vec)
Return the magnitude of vec.
- t4_geom_convert.Kernel.VectUtils.mag2(vec)
Return the square of the magnitude of vec.
- t4_geom_convert.Kernel.VectUtils.matrix_rows(matrix)
Transform a 3x3 matrix into the list of its rows.
>>> mat = [1, 2, 3, 4, 5, 6, 7, 8, 9] >>> matrix_rows(mat) [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- t4_geom_convert.Kernel.VectUtils.mixed(v1, v2, v3)
Yields the mixed product of v1, v2 and v3.
The mixed product is defined as v1 · (v2 × v3) and is equal to the determinant of the matrix having the components of v1, v2 and v3 as rows.
- t4_geom_convert.Kernel.VectUtils.planeParamsFromNormalAndPoint(normal, point)
Return the MCNP-style parameters of the plane having the given normal and passing through the given points.
- t4_geom_convert.Kernel.VectUtils.planeParamsFromPoints(pt1, pt2, pt3)
Compute the parameters (a ,b, c, d) of the plane passing through the three given points pt1, pt2, pt3.
The equation of the plane is written in the MCNP form as
\[a x + b y + c z - d = 0\]Furthermore, the normal to the plane is oriented in such as way that the origin has negative sense (this is the MCNP convention).
- t4_geom_convert.Kernel.VectUtils.planeSide(point, plane)
Returns 1 if point lies on the positive side of the plane, -1 if it lies on the negative side and 0 if it lies on the plane (no numerical tolerance).
- t4_geom_convert.Kernel.VectUtils.pointInPlaneIntersection(plane1, plane2)
Construct a point in the intersection of two planes. The planes must be given as a (point, normal) pair.
>>> from math import isclose >>> def is_in_plane(point, plane): ... pt, norm = plane ... return isclose(scal(vdiff(point, pt), norm), 0., abs_tol=1e-10)
>>> plane1 = ((0, 0, 0), (1, 0, 0)) >>> plane2 = ((0, 0, 0), (0, 1, 0)) >>> pointInPlaneIntersection(plane1, plane2) ((0.0, 0.0, 0.0), (0.0, 0.0, 1.0))
>>> plane1 = ((0, 0, 0), (1, 0, 0)) >>> plane2 = ((0, 5, 0), (0, 1, 0)) >>> int_p, line_vec = pointInPlaneIntersection(plane1, plane2) >>> is_in_plane(int_p, plane1) and is_in_plane(int_p, plane2) True >>> isclose(scal(line_vec, (1, 0, 0)), 0., abs_tol=1e-10) True >>> isclose(scal(line_vec, (0, 1, 0)), 0., abs_tol=1e-10) True
- t4_geom_convert.Kernel.VectUtils.projectPointOnPlane(point, plane, direction)
Project a point on a plane along the given direction.
>>> from math import isclose, sqrt >>> point = (0, 0, 3) >>> plane = ((0, 0, 0), (0, 0, 1)) >>> direction = (1, 0, 1) >>> proj = projectPointOnPlane(point, plane, direction) >>> expected = (-3, 0, 0) >>> all(isclose(p, e, abs_tol=1e-10) for p, e in zip(proj, expected)) True
>>> point = (0, 0, 3) >>> plane = ((0, 0, 1), (0, 0, 1)) >>> direction = (2, 0, 1) >>> proj = projectPointOnPlane(point, plane, direction) >>> expected = (-4, 0, 1) >>> all(isclose(p, e, abs_tol=1e-10) for p, e in zip(proj, expected)) True
- t4_geom_convert.Kernel.VectUtils.renorm(vec, norm=1.0)
Return a new vector parallel to vec whose norm is equal to norm.
- t4_geom_convert.Kernel.VectUtils.rescale(a, v1)
Return v1 multiplied by a scalar a, as a new vector.
- t4_geom_convert.Kernel.VectUtils.rotate(vec, axis, angle)
Rotate vector vec around the axis axis by angle angle, according to the right-hand rule.
This function uses Rodrigues’ rotation formula. If we denote vec as v, the angle as θ and the axis as k, the formula reads:
\[v' = v \cos(\theta) + (k ^ v) \sin(\theta) + k (k\cdot v) (1 - \cos(\theta))\]Examples:
>>> from math import pi >>> vec = (1, 1, 0) >>> axis = (0, 0, 1) >>> rot_vec = rotate(vec, axis, 0.5*pi) >>> print('({:.5f}, {:.5f}, {:.5f})'.format(*rot_vec)) (-1.00000, 1.00000, 0.00000) >>> rot_vec = rotate(vec, axis, 0.25*pi) >>> print('({:.5f}, {:.5f}, {:.5f})'.format(*rot_vec)) (0.00000, 1.41421, 0.00000)
- Parameters:
vec – the vector to rotate
axis – the rotation axis (must be a unit vector)
angle – the rotation angle, in radians
- t4_geom_convert.Kernel.VectUtils.rotation_from_vectors(vector_from, vector_to)
Return a rotation matrix transforming vector_from into a vector parallel to vector_to.
>>> rotation_from_vectors((0.0, 0.0, 1.0), (0.0, 0.0, 1.0)) array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]) >>> rotation_from_vectors((0.0, 0.0, 3.0), (0.0, 0.0, 5.0)) array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]) >>> rotation_from_vectors((0.0, 0.0, 1.0), (0.0, 1.0, 0.0)) array([[ 1., 0., 0.], [ 0., 0., 1.], [ 0., -1., 0.]])
- t4_geom_convert.Kernel.VectUtils.scal(v1, v2)
Yields the scalar product of v1 and v2.
- t4_geom_convert.Kernel.VectUtils.transpose(matrix)
Transpose a 3x3 matrix.
>>> mat = [1, 2, 3, 4, 5, 6, 7, 8, 9] >>> transpose(mat) [1, 4, 7, 2, 5, 8, 3, 6, 9]
- t4_geom_convert.Kernel.VectUtils.vdiff(v1, v2)
Return the vector difference of v1 and v2 (v1-v2).
- t4_geom_convert.Kernel.VectUtils.vect(v1, v2)
Yields the vector product of v1 and v2.
- t4_geom_convert.Kernel.VectUtils.vsum(*args)
Return the vector sum of its arguments.