Skip to main content

A python package to plot pixelmaps generated by Domino.

Project description

pix2py

Tests PyPI Compatible Python Versions

A python package to plot pixelmaps generated by Theriak-Domino using matplotlib.

Installation

The latest version of pix2py can be installed using pip:

pip install pix2py

Quickstart

In your Python script or notebook you must first import PixelMap from pix2py.

from pix2py import PixelMap

To use pix2py, you need to have a pixelmap folder called _pixelmaps generated by Domino in your working directory. Or you can specify the path to the pixelmap folder:

from pathlib import Path

pixelmap_dir = Path("{INSERT PATH HERE}", "_pixelmaps")

Since the individual pixelmaps for solid solution phases are named after the dominant endmember, you need to provide a dictionary to map a phase name to all endmember names for that phase in the thermodynamic database used to generate the pixelmaps.
This dictionary has the general form: ENDMEMBER_DICT = {"phase_name": "endmember1, endmember2, ...", ...}. Create a local dictionary for the project by:

LOCAL_ENDMEMBER_DICT = {}
LOCAL_ENDMEMBER_DICT["biotite"] = "phl", "annm", "obi", "east", "tbi", "fbi", "mnbi"

Additonal phases can be added to the dictionary as needed:

LOCAL_ENDMEMBER_DICT["LIQtc6"] = "q4L", "abL", "kspL", "anL", "slL", "fo2L", "fa2L", "h2oL"

Next, set up a pixelmap object by passing the path to the pixelmap folder and the endmember dictionary.

pixmap = PixelMap(pixelmap_dir, LOCAL_ENDMEMBER_DICT)

To plot a pixelmap, use the plot_pixelmap method of the pixelmap object. The method takes a variable to plot (variable) the phase name (mineral) as input arguments and returns a matplotlib figure object and ax object.

pixmap.plot_pixelmap("vol", mineral="LIQtc6")

Pixelmap of melt (LIQtc6) volume fraction

To plot isolines, use the plot_isolines method of the pixelmap object. The method takes a variable to plot (variable) and the phase name (mineral) as input arguments and returns a matplotlib figure object and ax object.

pixmap.plot_isolines("vol", mineral="LIQtc6")

Isolines of melt (LIQtc6) volume fraction

Capture the figure and ax objects to save or further customise the plotted pixelmap.

fig, ax = pixmap.plot_pixelmap("vol", mineral="LIQtc6")
fig.savefig("LIQtc6_vol.png", dpi=300)

You can use matplotlib's functions to further customise the plotted pixelmap.

fig, ax = pixmap.plot_pixelmap("vol", mineral="LIQtc6")
ax.set_title("LIQtc6 Volume Fraction")

Full Example

from pix2py import PixelMap
from pathlib import Path

pixelmap_dir = Path("{path_to_pixelmap_folder}", "_pixelmaps")

LOCAL_ENDMEMBER_DICT = {}
LOCAL_ENDMEMBER_DICT["biotite"] = "phl", "annm", "obi", "east", "tbi", "fbi", "mnbi"

pixmap = PixelMap(pixelmap_dir, LOCAL_ENDMEMBER_DICT)

fig, ax = pixmap.plot_pixelmap("#Mg", mineral="biotite")
fig.savefig("Biotite_Mg.png", dpi=300)

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

pix2py-0.2.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

pix2py-0.2.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file pix2py-0.2.0.tar.gz.

File metadata

  • Download URL: pix2py-0.2.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.2 Linux/6.2.0-1019-azure

File hashes

Hashes for pix2py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7690f661e359cae7b469cbceeb834a4561a3df148a97d8ef838827b18d3e1a1e
MD5 425165771b124db906e24660874ffc27
BLAKE2b-256 b4600b104f186584457671520aca7eea957e4b38dd061062786ba353a932f29d

See more details on using hashes here.

File details

Details for the file pix2py-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pix2py-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.2 Linux/6.2.0-1019-azure

File hashes

Hashes for pix2py-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af212557b9e03b9ba3dc2614f771d0376a616c82ce33381f4faf3671ed2763e5
MD5 8039791dce3e8dc1b777fd6ce034ed9c
BLAKE2b-256 751d8e0ffc9e20b8c31a7938ce9eb4849c9741dee25780a64115c9fcaa4fa37d

See more details on using hashes here.

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