Skip to main content

VTRTool

PyPI Listing

Python utilities for Fullwave3D VTR model files.

The package contains a vtrtool executable, as well as a vtrtool.py python package

Installation

This tool can be obtained from PyPI. Simply do:

pip install vtrtool

vtrtool executable quick usage

vtrtool -h to show usage information

vtrtool info my_model_file.vtr shows metadata info for my_model_file.vtr

vtrtool info nx1 my_model_file.vtr prints out just the size of the 1st (x) dimension for my_model_file.vtr

vtrtool to_binary --property=2 my_model_file.vtr my_model_file.bin to dump the 2nd property from my_model_file.vtr to the float32 raw binary file my_model_file.bin

vtrtool to_stdout my_model_file.vtr to pipe the 1st property (default) from my_model_file.vtr to stdout in raw float32 binary format

vtrtool.py Python module quick usage

The vtrtool.VTRModel class represents a vtr model that lives at a given filename. The file will be parsed on object initialization:

import vtrtool

# read the vtr file `my_model_file.vtr` and construct a new VTRModel object with it
vtr_model = vtrtool.VTRModel("my_model_file.vtr")

# print model properties to stdout
vtrtool.print_vtr_metadata(vtr_model)

# model property 1 will be available as numpy ndarray in
vtr_model.arrays[0]

# model property 2 (if it exists) will be available as numpy ndarray in
vtr_model.arrays[1]

# etc...

Set the optional keyword use_memmap=True if you want the VTRModel object to use a NumPy memmap instead of in-memory representation for holding the model array.

The following instance properties exist for objects of the VTRModel class:

  • file: (str) the vtr filename referenced by the VTRModel object
  • num_dimensions: (int) number of dimensions in the model
  • num_attributes: (int) number of properties in the model
  • shape: (tuple of ints) shape (c-based) of numpy ndarray holding the models in the order (nx1, nx2, nx3)
  • shape_fortran: (tuple of ints) shape (fortran-based) of the models in the order (nx3, nx2, nx1)
  • nx1: (int) number of cells in the 1st (usually x) dimension
  • nx2: (int) number of cells in the 2nd (usually y) dimension
  • nx3: (int) number of cells in the 3rd (fastest, usually z) dimension
  • arrays: (list of ndarrays) holds the model property ndarrays, the length of the list correspond to the number of model properties (i.e., property 1 is in model[0]), and the shape of the ndarray will correspond to shape and with the number of dimensions in num_dimensions

Some convenience functions:

  • vtrtool.vtrfile_to_ndarray(filename, prop_index=0) quickly takes a vtr file and returns the property specified by prop_index as an ndarray
  • vtrtool.print_vtr_metadata(vtrmodel_object) takes a VTRModel object and prints dimension information to stdout

Maintained by

Tim Lin tlin@s-cube.com, 2017

Release files for vtrtool 0.8.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vtrtool 0.8.6
File Size Uploaded
vtrtool-0.8.6.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vtrtool 0.8.6
File Interpreter ABI Platform
vtrtool-0.8.6-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 23.8 kB

Release files / vtrtool-0.8.6.tar.gz

Download URL vtrtool-0.8.6.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9d5b2b28787e607de9327044a2ae5aaccf7f1314816682b362e99c5fdd046173
BLAKE2b-256 checksum
How to use checksums
ab6a4cc5add24c5656af9d526249609ffb1c7ffc080f50795f265cca0fefe65c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / vtrtool-0.8.6-py2.py3-none-any.whl

Download URL vtrtool-0.8.6-py2.py3-none-any.whl
Size 13.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c94f810f85bf080de304ae3d82577a85523c43e1d8bf7eb32c3edd968439b272
BLAKE2b-256 checksum
How to use checksums
3eac010e547b9095c80aaddecced12608b2cb54058484020f09e4ebb7ad0378a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release history Release notifications | RSS feed

0.8.8

2 release files

0.8.7

2 release files

This release

0.8.6 This release

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page