Package documentation
Subpackages
- t4_geom_convert.IntegrationTests package
- 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
- t4_geom_convert.Kernel.Composition.EIsotopeNameElementT4 module
- 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
- t4_geom_convert.Kernel.Surface.ESurfaceTypeT4 module
- 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
- 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
- t4_geom_convert.Kernel.VectUtils module
- Module contents
- Subpackages
- t4_geom_convert.UnitTests package
Submodules
t4_geom_convert.Debug module
Useful tools for debugging.
- t4_geom_convert.Debug.debug(wrapped)
Prints input and output values of any function it decorates.
t4_geom_convert.conftest module
pytest configuration file.
- class t4_geom_convert.conftest.MCNPRunner(path, work_path)
Bases:
object
A helper class to run MCNP on a given input file.
- class t4_geom_convert.conftest.OracleRunner(path, work_path)
Bases:
object
A helper class to run the test oracle.
- run(t4_o, mcnp_i, mcnp_ptrac, oracle_opts=None)
Run the test oracle on the given files.
- t4_geom_convert.conftest.check_failed_points(failed_path)
Read the failed_path file and return the number of failed points and the maximum distance for them.
- t4_geom_convert.conftest.datadir(tmp_path, request)
Fixture responsible for searching a folder called ‘data’ in the same directory as the test module and, if available, moving all contents to a temporary directory so tests can use them freely.
- t4_geom_convert.conftest.foreach_data(*args, **kwargs)
Decorator that parametrizes a test function over files in the data directory for the current tests.
Assume that the following snippet resides in
tests/submod/test_submod.py
:@foreach_data('datafile') def test_something(datafile): pass
When pytest imports
test_submod.py
, it will parametrize the datafile argument totest_something()
over all the files present intests/submod/data/
.If you wish to filter away some of the files, you can use the alternative syntax:
@foreach_data(datafile=lambda path: str(path).endswith('.txt')) def test_something(datafile): pass
Here the argument to the datafile keyword argument is a predicate that must return True if path is to be parametrized over, and False otherwise. Note that the path argument to the lambda is a
pathlib.Path
object. In this example, pytest will parametrizetest_something()
only over files whose name ends in'.txt'
.
- t4_geom_convert.conftest.mcnp(mcnp_path, tmp_path)
Return an instance of the
MCNPRunner
class.
- t4_geom_convert.conftest.mcnp_path(request)
Fixture yielding the path to the MCNP executable specified on the command line.
- t4_geom_convert.conftest.oracle(oracle_path, tmp_path)
Return an instance of the
OracleRunner
class.
- t4_geom_convert.conftest.oracle_path(request)
Fixture yielding the path to the oracle executable specified on the command line.
- t4_geom_convert.conftest.parse_outside_points(stdout_path)
Parse the file at stdout_path and return the number of points that fall outside the geometry.
t4_geom_convert.main module
- t4_geom_convert.main.conversion(args)
Orchestrate the conversion.
- t4_geom_convert.main.main()
Main entry point for the CLI tool.
- t4_geom_convert.main.parse_args(argv)
Parse the command-line arguments.
- Returns:
a namespace containing the parsed arguments.
- t4_geom_convert.main.parse_lattice(lattice_list)
Check the arguments to the –lattice option and parse them into a usable form.
The arguments to –lattice (the option may be given multiple times) have the form
cell,i_min:i_max[,j_min:j_max[,k_min:k_max]]
>>> opt_lattice = ['200,2:5,0:4', '5902,0:5,0:5,0:5', '10,-4:4']
This function parses the opt_lattice list into a dictionary associating cell numbers to a list of ranges, as tuples:
>>> dic = parse_lattice(opt_lattice) >>> dic == {200: [(2, 5), (0, 4)], ... 5902: [(0, 5), (0, 5), (0, 5)], ... 10: [(-4, 4)]} True
The function does some error checking, too:
>>> parse_lattice(['malformed']) Traceback (most recent call last): ... ValueError: no ranges specified in option 'malformed' >>> parse_lattice(['three,-1:5']) Traceback (most recent call last): ... ValueError: cell number 'three' is not an integer in option 'three,-1:5' >>> parse_lattice(['100,']) Traceback (most recent call last): ... ValueError: needs exactly 2 colon-separated range bounds in argument '' in option '100,' >>> parse_lattice(['100,0:4,0:4,0:4,0:4']) Traceback (most recent call last): ... ValueError: too many ranges specified in option '100,0:4,0:4,0:4,0:4' >>> parse_lattice(['100,0:6.022e23']) Traceback (most recent call last): ... ValueError: range bound '6.022e23' is not an integer in option '100,0:6.022e23' >>> parse_lattice(['100,-6.022e23:0']) Traceback (most recent call last): ... ValueError: range bound '-6.022e23' is not an integer in option '100,-6.022e23:0'
- t4_geom_convert.main.writeHeader(ofile)
Write a short header for the TRIPOLI-4 output file.