Skip to content

XRByte/jaff

 
 

Repository files navigation

JAFF

Logo
(Just Another Fancy Format)

An astrochemical network parser that supports multiple reaction network formats including KIDA, UDFA, PRIZMO, KROME, and UCLCHEM.

For detailed instructons, please refer to the Documentation

Installation

From source

git clone https://github.com/jaff-chemistry/jaff.git
cd jaff
pip install .

For development

git clone https://github.com/jaff-chemistry/jaff.git
cd jaff
pip install -e .  # Editable install

Quick Start

Command Line Usage

After installation, you can use the jaff command:

# Load and validate a network file
jaff networks/gas_reactions_kida.uva.2024.in

# List all species and reactions
jaff networks/test.dat --list-species --list-reactions

Python API Usage

from jaff import Network

# Load a chemical network
network = Network("networks/react_COthin")

# Access species
for species in network.species:
    print(f"{species.name}: mass={species.mass}, charge={species.charge}")

# Access reactions
for reaction in network.reactions:
    print(f"{reaction.get_sympy()}")

Features

  • Multi-format support: Automatically detects and parses KIDA, UDFA, PRIZMO, KROME, and UCLCHEM formats
  • Validation: Checks for mass and charge conservation in reactions
  • Species analysis: Automatic extraction of elemental composition and properties
  • Rate calculations: Temperature-dependent rate coefficient evaluation
  • ODE generation: Creates differential equations for chemical kinetics

Supported Network Formats

Primitive Variables

The following variables are recognized in rate expressions:

  • tgas: gas temperature, K
  • av: visual extinction, Draine units
  • crate: cosmic rays ionization rate of H2, 1/s
  • ntot: total number density, 1/cm3
  • hnuclei: H nuclei number density, 1/cm3
  • d2g: dust-to-gas mass ratio

Examples

Example network files can be found in the networks/ directory.

Development

To contribute or modify JAFF:

# Install in development mode with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
ruff format

# Lint code
ruff check src/jaff

# Organize imports
ruff check --select I --fix

JAFF Schema Validation

JAFF network exports are JSON payloads serialized to .jaff (optionally gzip-compressed as .jaff.gz). To validate a decompressed payload against the schema:

check-jsonschema --schemafile jaff.network.schema.json test.jaff

xkcd:927

About

More than just a chemical network parser

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Fortran 59.0%
  • Python 39.4%
  • C++ 1.3%
  • Other 0.3%