Skip to main content

opatIO python module

This module defines a set of tools to build, write, and read OPAT files. The OPAT fileformat is a custom file format designed to efficiently store opacity information for a variety of compositions.

Installation

The prefered, stable, way to install opatio is to use the version on pypi

pip install opatio

If you wish to insall from source or for developemnt you can and should clone the git repository instead You can install this module with pip

git clone https://github.com/4D-STAR/opat-core
cd opat-core/opatio-py
pip install . # For non development

or

pip install . -e # for development

General Usage

The general way that this module is mean to be used is to first build a schema for the opacity table and then save that to disk. The module will handle all the byte aligment and lookup table construction for you.

A simple example might look like the following

from opatio import OPAT

opacityFile = OPAT()
opacityFile.set_comment("This is a sample opacity file")
opacityFile.set_source("OPLIB")

# some code to get a logR, logT, and logKappa table
# where logKappa is of size (n,m) if logR is size n and
# logT is size m

card = opacityFile.add_table((X, Z), "data", logR, logT, logKappa, rowName="logR", columnName="logT")
opacityFile.save("opacity.opat")
opacityFile.save_as_ascii("opacity.txt")

If you wish you can add more tables to the same card. This means that there can be multiple tables associated to the same indexing vector (for example you might store data and pre calculated interpolation coefficients along side the same data)

opacityFile.add_table((X, Z), "interp", xOrder, yOrder, coeff, rowName="xCoeff", columnName="yCoeff", card=card)

Note how here I passed the card as an argument. This means that the same card will be modified and then repushed into the file.

You can also read opat files which have been generated with the loadOpat function

from opatio import read_opat

opacityFile = read_opat("opacity.opat")

print(opacityFile.header)

Converting from OPAL type I

Given the prevelence of OPAL type I tables, we have included a utility function to take care of this conversion for you. Assuming there is some OPAL type I file in your current working directory (in the below example we assume it is called GS98hz) then converting is as simple as calling the convert function...

from opatio.convert import OPALI_2_OPAT

OPALI_2_OPAT("GS98hz", "gs98hz.opat")

Problems

If you have problems feel free to either submit an issue to the root github repo (tagged as utils/opatio) or email Emily Boudreaux at emily.boudreaux@dartmouth.edu

Metadata

Release files for opatio 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opatio 0.3.0
File Size Uploaded Provenance
opatio-0.3.0.tar.gz 25.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for opatio 0.3.0
File Interpreter ABI Platform
opatio-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 54.6 kB

Release files / opatio-0.3.0.tar.gz

Download URL opatio-0.3.0.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
76526b96dee84a37f37ecbbfe532089e903913d27ad45880f61109edf13156f9
BLAKE2b-256 checksum
How to use checksums
7721114b04dcf083a235bfeeeea2d3025a940c4ee9673d8d7f8e414a668c6498
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / opatio-0.3.0-py3-none-any.whl

Download URL opatio-0.3.0-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ce9b292542ba93bbb4b7deefd83c12603a9fa36b7619085432d6e63cf692130
BLAKE2b-256 checksum
How to use checksums
39e2efd6f1a53bb590f515c24aaf5ca45932d34ddab410ee4e8d7f7914cd26f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for opatio 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page