Skip to main content

Tensor interpolation package

Project description

Image source "OREO": https://news.mit.edu/2022/oreometer-cream-0419
The trademarks, logos, photography, brand names, design and service marks of "OREO" are owned by the company Nabisco. No copyright infringement intended.

Graphic by Blarr


PyPI version CC BY-NC-SA 4.0

Interpolation of tensors of second and fourth order via decomposition approach

Disclaimer

The paper describing the scientific background and the methods underlying this repository is: Blarr, J., Sabiston, T., Krauß, C. et al. Implementation and comparison of algebraic and machine learning based tensor interpolation methods applied to fiber orientation tensor fields obtained from CT images. Computational Materials Science, 2023.

This code was published alongside the raw data of the CT scans and the evaluated tensor data first as research data set here: https://doi.org/10.5445/IR/1000153725.

If you use the code in this repository, please cite both DOIs.

Content

OrioPy is a Python package to interpolate fiber orientation tensors (or tensors of any kind for that matter) of second or fourth order. Both methods make use of the fact that symmetric positive definite tensors can be decomposed into eigenvalues and eigenvectors in spectral decomposition. In terms of the visualization of tensors in the form of tensor glyphs, the eigenvalues are responsible for the shape, while the eigenvectors are responsible for the orientation of the tensor in space.

In case of the tensors of fourth order, these eigenvalues and eigenvectors (in the form of the rotation matrix R) are directly weighted according to Shepard's inverse distance weighting, interpolated separately and then recomposed into a tensor.

In case of the orientation tensors of second order, instead of the eigenvalues another group of invariants, so-called orthogonal invariants, are used. The eigenvectors are also recalculated to quaternions and then interpolated. The reasons for this detour is explained in the paper mentioned above. The approach is additionally visualized in the following graphic:

Usage

In the folder "oriopy" there are three Python scripts. The "component_averaging_interpolation.py" and the "decomposition_interpolation.py" work the same: The script needs an input .txt-file with coordinates and the corresponding fiber orientation tensors (the example used in the publication is given in the folder "example" (file "input_file_FOT.txt")). After running the code you are asked in the console for the name of the output file and for lower and upper x and y limit, which are 1 and 13, respectively, in the given case. The scripts then calculate the fiber orientation tensors at all missing positions with the respective method, which are then written into a MATLAB file (which is named the way you input in the console). This MATLAB file is structured in a way that the fiber orientation tensors can be plotted directly with the tensor glyph visualization function of Barmpoutis ("plotDTI"): https://de.mathworks.com/matlabcentral/fileexchange/27462-diffusion-tensor-field-dti-visualization. The third file "4th_order_decomposition_interpolation.py" works basically the same way, aside from the fact that it needs fourth order tensors as an input and outputs fourth order tensors. In the "example"-folder, there is another input file named "input_file_FOT_4th_order.txt", which can be used for this purpose. Please be aware that there is the possibility for the visualization of fourth order tensors within the mentioned Matlab methods, however, this takes up quite some time to plot the entire field of fourth order tensors. Be free to only use the methods of the oriopy package for interpolation and write your own visualization function instead of using this Matlab visualization or the proposed main of the authors.

An example of a fiber orientation tensor field generated with the decomposition method for tensors of second order can be seen below.

Details and background

The authors originally determined fiber orientation tensors (FOT) of second and fourth order from µCT scans of carbon fiber reinforced polyamide 6 specimen. The C++ code for the FOT determination works with a structure tensor approach, is explained in this paper and can be found here: Pinter P, Dietrich S, Bertram B, Kehrer L, Elsner P, Weidenmann KA. Comparison and error estimation of 3D fibre orientation analysis of computed tomography image data for fibre reinforced composites. NDT & E International 2018; 95:26–35. https://doi.org/10.1016/j.ndteint.2018.01.001. https://sourceforge.net/p/composight/code/HEAD/tree/trunk/SiOTo/StructureTensorOrientation/FibreOrientation/StructureTensorOrientationFilter.cxx#l186

The specimens were cut from a 400 mm x 400 mm x 4 mm plate to 10 mm x 10 mm x 4 mm in order to be able to have a high enough resolution to detect fibers in the CT in general. That resulted in very local information of the fiber orientation in the plate. Hence, the idea was to generate a full field of FOT across the plate in order to gain a more holistic idea of the flow behavior in the process and of the mechanical properties of the plate. In the paper of Blarr et al., three tensor interpolation methods for tensors of second order were compared, of which the decomposition method showed the most reliable results and was therefore evolved into the oriopy package. The component averaging method can be found as well. Only the code for the ANN is not available here, but the Jupyter notebook can also be accessed through the data set mentioned above.

The method for the interpolation of tensors of fourth order was implemented later and is described in a following paper, where the results are also assessed in terms of their mechanical meaningfulness. Hence, the results are used for both the Mori Tanaka and the Halpin Tsai homogenization to predict stiffnesses, which are then compared to tensile test based results of Young's moduli.

For further questions, please consider the documentation in the paper Blarr et al. (2023).

Version

The current version will be further developed into classes soon.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

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

oriopy-0.0.5.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oriopy-0.0.5-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file oriopy-0.0.5.tar.gz.

File metadata

  • Download URL: oriopy-0.0.5.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for oriopy-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9668a94a0ea36e68bd9901385c4a4d52ff294d36d8c08fc1b9bc66fabe9a6206
MD5 c3615f33518669833eef70d812576dd8
BLAKE2b-256 411c8250889c4556a58e4585847ca680cd3dcaedb0712b2bac3008086bfdda13

See more details on using hashes here.

File details

Details for the file oriopy-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: oriopy-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for oriopy-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a1f2a918933406dd190d3090b24ada663a4fbc55eeb2b3b8e317b74847e8b950
MD5 608475a7bd0274b8c3468e2e41a35440
BLAKE2b-256 9733367ed4e3f0ab0049ba27cae748d6aaae4cc37602104a4954d8af6c720bfd

See more details on using hashes here.

Supported by

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