Skip to main content

A tool for selectively removing tags such as the graveyard from DAGMC h5m files.

Project description

N|Python docker based CI PyPI codecov

This is a minimal Python package that provides both command line and API interfaces for removing multiple tags from a DAGMC h5m file.

This is useful for preparing the h5m file for visulisation where it is desirable to remove reflecting surfaces, vacuum materials and the graveyard(s) region from the geometry before viewing the vtk file.

Command line usage

Perhaps the most common use of this program is to remove a DAGMC graveyard.

remove-dagmc-tags -i dagmc.h5m -o dagmc_no_graveyard.h5m -t graveyard
  • the -i or --input argument specifies the input h5m file
  • the -o or --output argument specifies the output h5m or vtk filename
  • the -t or --tags argument specifies the tags to remove.
  • the -v or --verbose argument enables (true) or disables (false) the printing of additional details

Multiple tags can also be removed and vtk files can be generated. This example removes three tags from the dagmc.h5m file and saves the result as a vtk file.

remove-dagmc-tags -i dagmc.h5m -o output.vtk -t mat:graveyard mat:vacuum reflective

Python API usage

Removing a single tag called mat:graveyard from the dagmc.h5m file.

from remove_dagmc_tags import remove_tags

remove_tags(
    input='dagmc.h5m',
    output='output.h5m',
    tags='mat:graveyard'
)

Removing two tags called mat:graveyard and reflective from the dagmc.h5m file and saves the result as a vtk file and h5m file.

from remove_dagmc_tags import remove_tags

remove_tags(
    input='dagmc.h5m',
    output=['output.vtk', 'output.h5m'],
    tags=['reflective', 'mat:graveyard']
)

Installation

The recommended method of installing is via conda install as this is able to install all the dependencies including PyMoab.

conda install -c conda-forge remove_dagmc_tags

However the package is available via the PyPi package manager. In this case you will have to seperatly install PyMoab.

pip install remove_dagmc_tags

Some Python dependencies (such as Numpy) are installed during the pip install remove_dagmc_tags process, however PyMoab needs to be installed seperatly to make full use of this package.

One method of installing pymoab is to install MOAB via Conda which includes PyMoab.

conda install -c conda-forge moab

Another method of installing pymoab is to compile MOAB with pymoab enabled.

mkdir MOAB
cd MOAB ; \
mkdir build ; \
git clone  --single-branch --branch develop https://bitbucket.org/fathomteam/moab.git
cd build
cmake ../moab -DENABLE_HDF5=ON \
              -DENABLE_NETCDF=ON \
              -DENABLE_FORTRAN=OFF \
              -DENABLE_BLASLAPACK=OFF \
              -DBUILD_SHARED_LIBS=OFF \
              -DCMAKE_INSTALL_PREFIX=/MOAB
make -j"$compile_cores"
make -j"$compile_cores" install
cmake ../moab -DENABLE_HDF5=ON \
              -DENABLE_PYMOAB=ON \
              -DENABLE_FORTRAN=OFF \
              -DBUILD_SHARED_LIBS=ON \
              -DENABLE_BLASLAPACK=OFF \
              -DCMAKE_INSTALL_PREFIX=/MOAB
make -j"$compile_cores"
make -j"$compile_cores" install
cd pymoab
bash install.sh
python setup.py install

Achknowledgments

The package is largely inspired by the DAGMC-viz(https://github.com/svalinn/DAGMC-viz) repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

remove_dagmc_tags-0.0.5.tar.gz (18.1 kB view hashes)

Uploaded Source

Built Distribution

remove_dagmc_tags-0.0.5-py3-none-any.whl (19.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page