Skip to main content

Easy-to-use library for calculating the rgb values of the IPF map of cubic materials.

Project description

crystalipf

This is an easy-to-use library to create inverse pole-figures (ipf) for crystal lattices with cubic symmetry.

Installation

The library can be installed in three different ways:

  1. Install it from the Python Package Index.
    pip install crystalipf
    
  2. Clone the repository and install it.
    git clone https://github.com/silvioachilles/crystalipf.git
    cd crystalipf
    pip install .
    
  3. Copy crystalipf/cubic.py to your project and include it in your code.

Usage

An orientation must be expressed as an orientation matrix. In the code snippet below it is shown how to retrieve the rgb color of the orientation and its position in the ipf.

import numpy as np
import matplotlib.pyplot as plt

from crystalipf.cubic import position, rgb, image, image_plt, edges

# example orientation matrix of a grain
grain = np.array([
    [ 0.71825437, -0.68019413,  0.14644661],
    [ 0.68019413,  0.6421339,  -0.35355339],
    [ 0.14644661,  0.35355339,  0.92387953]
])

# sample direction
g = np.array([0, 0, 1])

# ipf position
grain_ipf_x, grain_ipf_y = position(grain, g)

# ipf color
grain_ipf_rgb = rgb(grain, g)

# to illustrate, the grain's orientation is plotted
# in the ipf with respective coloring
fig, ax = plt.subplots()
ax.scatter([grain_ipf_x], [grain_ipf_y], c=[grain_ipf_rgb])

# the edges of the ipf
ipf_edges_xs, ipf_edges_ys = edges()
ax.plot(ipf_edges_xs, ipf_edges_ys)

ax.axis('off')
plt.show()

Using the image_plt function, you can create a matplotlib plot of a fully colored ipf with annotations for the corners.

fig, ax = plt.subplots()
image_plt(ax)
plt.show()

An raw image of a fully colored ipf can be retrieved with the image function, allowing to create a customized ipf plot.

fig, ax = plt.subplots()

ipf_image, xmax, ymax = image()
ax.imshow(ipf_image, extent=0, xmax, 0, ymax)
ax.plot(ipf_edges_xs, ipf_edges_ys, c='black')

plt.show()

Troubleshooting

Please open a github issue if anything appears not correct.

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

crystalipf-0.0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

crystalipf-0.0.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file crystalipf-0.0.1.tar.gz.

File metadata

  • Download URL: crystalipf-0.0.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for crystalipf-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fff4f5e3e56ad6ea316ff010374b2b7041c88c8ab34de011ba2d19556e363913
MD5 65320210e4896dd9edf6bf47fcd40c9b
BLAKE2b-256 761589e5b1dbb4aece44b0f5ae98fa24ceaa8e412a5b20f6f1f0bf7f39109d0c

See more details on using hashes here.

File details

Details for the file crystalipf-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: crystalipf-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for crystalipf-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 593170d6a69aaaeb5d6cf14efe678f3f6bd508a1a2ebfa0128506a6f6607029c
MD5 530d28ec4d941a856b506e6beaa65ee1
BLAKE2b-256 8e3a1ed0e6429b7bb4385bcfa61ade94e368ac8ead8de3e413da93483eeee9d2

See more details on using hashes here.

Supported by

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