Python API#
Complete API documentation for UCLCHEM’s Python interface.
Essential Python API#
Core modules for running models and analyzing results:
Advanced Python API#
For advanced usage and customization:
Supporting Modules#
Internal modules and utilities:
Fortran Modules#
Direct access to compiled Fortran modules and parameters:
Quick Start#
Model Classes (Recommended for Most Users)
import uclchem
# Create and run a cloud model
cloud = uclchem.model.Cloud(
param_dict={'initialDens': 1e4, 'finalTime': 1e6},
out_species=['CO', 'H2O']
)
# Access results as DataFrame
df = cloud.get_dataframe()
# Analyze chemistry
uclchem.analysis.plot_abundance(df, 'CO')
Analysis & Post-Processing
import uclchem
# Read and analyze existing output
df = uclchem.analysis.read_uclchem(['CO', 'H2O'], 'output.dat')
# Chemical network analysis
rates = uclchem.analysis.get_reaction_rates(['H2', 'H', 'O2'])
uclchem.analysis.plot_heating_cooling(df)
Network Customization
from uclchem.makerates import MakeRates
# Generate custom chemical network
network = MakeRates(
species_list=['H', 'H2', 'O', 'CO'],
elements=['H', 'C', 'O']
)
network.write_network()
Advanced: Direct Fortran Access
import uclchem
# Access Fortran parameters at runtime
settings = uclchem.advanced.GeneralSettings()
print(settings.defaultparameters.initialdens.get())
# Modify parameters
settings.defaultparameters.initialdens.set(1e5)
Module Guide#
Essential Modules (start here):
uclchem.model - Object-oriented model classes (Cloud, Collapse, HotCore, Shock)
uclchem.analysis - Chemical analysis and plotting tools
uclchem.utils - Utility functions for I/O and data processing
uclchem.makerates - Chemical network generation
Advanced Modules (for customization):
uclchem.functional - Legacy functional API (disk/memory modes)
uclchem.advanced - Direct Fortran module access via GeneralSettings
uclchem.plot - Additional plotting utilities
Internal Modules (reference only):
uclchem.constants - Physical constants
uclchem.version - Version information
uclchem.debug - Debugging utilities
uclchem.tests - Test suite
Notes#
Most users only need the Essential Modules (model, analysis, utils)
Python API is auto-generated from source code docstrings
Fortran API is auto-generated from compiled modules at build time
See Tutorials for practical examples
See Parameters Reference for parameter configuration guide