Skip to main content

MicPy is a Python package to facilitate MICRESS workflows.

Project description

MicPy logo

MicPy

MicPy is a Python package to facilitate MICRESS workflows. Whether you aim to visualize, convert, or manipulate MICRESS data, MicPy provides the necessary tools.

Installation

pip install micress-micpy

Dependencies

MicPy requires the following dependencies:

  • Python (>= 3.9)
  • Pandas (>= 1.1)
  • Matplotlib (>= 3) as an optional dependency for plotting

Examples

Below are some examples demonstrating how to use MicPy.

bin module

Read one field at a time

from micpy import bin

for field in bin.File("A001_Delta_Gamma.conc1"):
    print(field)

Read all fields

from micpy import bin

with bin.File("A001_Delta_Gamma.conc1") as file:
    fields = file.read()

print(fields)

Read a subset of fields providing a list of indices

from micpy import bin

with bin.File("A001_Delta_Gamma.conc1") as file:
    fields = file.read([0, 1, -2, -1])

print(fields)

Read a subset of fields providing a condition function

from micpy import bin

with bin.File("A001_Delta_Gamma.conc1") as file:
    fields = file.read(lambda field: field.time >= 10 and field.time <= 20)

print(fields)

Read fields opening and closing the file manually

from micpy import bin

file = bin.File("A001_Delta_Gamma.conc1")

file.open()

first_field = file.read(0)
second_field = file.read(1)

file.close()

print(first_field, second_field)

Plot a field

from micpy import bin

with bin.File("A001_Delta_Gamma.conc1") as file:
    field = file[-1]

fig, ax = field.plot()

Plot a list of fields normalizing the data

from micpy import bin

with bin.File("A001_Delta_Gamma.conc1") as file:
    fields = file[[0, 1, -2, -1]]

fig, ax = fields.plot(normalize=True, figsize=(8, 8))

Plot a specific plane of a field

from micpy import bin

with bin.File("A005_Grain_Growth_Misorientation_3D.korn") as file:
    field = file[0]

fig, ax = field.plot(plane="xy", slice=50)

tab module

Read a table

from micpy import tab

table = tab.read("A001_Delta_Gamma.TabF")

Plot a table

from micpy import tab

table = tab.read("A001_Delta_Gamma.TabF")

fig, ax = table.plot(x=1, y=[2, 3, 4])

Extract a subset of a table

from micpy import tab

table = tab.read("A001_Delta_Gamma.TabF")

table.loc[
    table["Fraction Phase 2 FCC_A1"] > 0,
    ["Temperature [K]", "Fraction Phase 1 BCC_A2", "Fraction Phase 2 FCC_A1"]
]

Convert a table to different file formats

from micpy import tab

table = tab.read("A001_Delta_Gamma.TabF")

table.to_csv("A001_Delta_Gamma.TabF.csv")
table.to_excel("A001_Delta_Gamma.TabF.xlsx")
table.to_json("A001_Delta_Gamma.TabF.json")

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

micress_micpy-0.2.13b4-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file micress_micpy-0.2.13b4-py3-none-any.whl.

File metadata

File hashes

Hashes for micress_micpy-0.2.13b4-py3-none-any.whl
Algorithm Hash digest
SHA256 a4b206951ad09c0b4e073e4ae61cb18e14fd6b8ac7bfb778a85dfbaa6f4164e9
MD5 83cdeaef9dfaaf73aed39122a87a086d
BLAKE2b-256 5a4b796f2cc37a669d64178ff025582926d07f59c24bdb55082f08caf0c86531

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