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.16b0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file micress_micpy-0.2.16b0-py3-none-any.whl.

File metadata

File hashes

Hashes for micress_micpy-0.2.16b0-py3-none-any.whl
Algorithm Hash digest
SHA256 b075a12e363b6f82788f7bdab8c6cbed1f4dcd1bc0dcdcba11c0df0c4d988199
MD5 3e65ab15906aadc5a206b15e4a60c923
BLAKE2b-256 f099e985be19ec5352ef73b2f6650c34d8744351bacc9633162f056203b88b7d

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