= Gas('C2') C2
exex
Experiment codebase for chemchem package
This file will become your README and also the index of your documentation.
Install
pip install exex
= Gas('O2') O2
= Gas('CO2') CO2
= Reaction(reactants=[Gas('C2'), Gas('O2')], products=[Gas('CO2')]) r
r.__dict__
{'reaction': <chemlib.chemistry.Reaction>,
'reactants': [exex.gas.core.Gas(formula='C₂'),
exex.gas.core.Gas(formula='O₂')],
'products': [exex.gas.core.Gas(formula='C₁O₂')],
'formula': '1C₂ + 1O₂ --> 1C₁O₂',
'system': <exex.system.System>,
'environment': <exex.environment.OpenContainer>}
CO2.get_system()
<exex.system.System>
r.system.__dict__
{'universe': None,
'current_time': None,
'highest_time': None,
'reactions': [exex.reaction.core.Reaction(formula='1C₂ + 1O₂ --> 1C₁O₂')],
'_subscribers': {},
'idx_reaction': None}
r
exex.reaction.core.Reaction(formula='1C₂ + 1O₂ --> 1C₁O₂')
CO2.properties
{'mass': <exex.core.Mass>,
'mole': <exex.core.Mole>,
'pressure': <exex.core.Pressure>,
'volume': <exex.core.Volume>,
'temperature': <exex.core.Temperature>,
'ideal_gas_constant': <exex.gas.core.IdealGasConstant>,
'is_ideal_gas': <exex.gas.core.IsIdealGas>}
'mass_mole_ratio'].__dict__ CO2.laws[
{'compound': exex.gas.core.Gas(formula='C₁O₂'),
'properties': [{'object': exex.core.Mass}, {'object': exex.core.Mole}]}
from exex.utils import camel_to_snake
__name__) camel2snake(CO2.__class__.
'gas'
C2.snake_name
'C2'
= [C2, O2] reactants
= {} dic
C2.formula
'C₂'
for reactant in reactants:
= reactant dic[reactant.snake_name]
dic
{'C2': exex.gas.core.Gas(formula='C₂'), 'O2': exex.gas.core.Gas(formula='O₂')}
C2
exex.gas.core.Gas(formula='C₂')
C2.__dict__
{'properties': {'mass': <exex.core.Mass>,
'mole': <exex.core.Mole>,
'pressure': <exex.core.Pressure>,
'volume': <exex.core.Volume>,
'temperature': <exex.core.Temperature>,
'ideal_gas_constant': <exex.gas.core.IdealGasConstant>,
'is_ideal_gas': <exex.gas.core.IsIdealGas>},
'laws': {'mass_mole_ratio': <exex.compound.core.MassMoleRatio>,
'boyle_law': <exex.gas.core.BoyleLaw>,
'charles_law': <exex.gas.core.CharlesLaw>,
'avogadro_law': <exex.gas.core.AvogadroLaw>,
'ideal_gas_law': <exex.gas.core.IdealGasLaw>},
'time': None,
'system': <exex.system.System>,
'elements': [<chemlib.chemistry.Element>,
<chemlib.chemistry.Element>],
'formula': 'C₂',
'coefficient': 1,
'occurences': {'C': 2}}
C2.formula
'C₂'
r.reaction.__dict__
{'reactants': [exex.gas.core.Gas(formula='C₂'),
exex.gas.core.Gas(formula='O₂')],
'products': [exex.gas.core.Gas(formula='C₁O₂')],
'compounds': [exex.gas.core.Gas(formula='C₂'),
exex.gas.core.Gas(formula='O₂'),
exex.gas.core.Gas(formula='C₁O₂')],
'reactant_formulas': ['C₂', 'O₂'],
'product_formulas': ['C₁O₂'],
'formula': '1C₂ + 1O₂ --> 1C₁O₂',
'coefficients': {'C₂': 1, 'O₂': 1, 'C₁O₂': 1},
'constituents': ['C₂', 'O₂', 'C₁O₂'],
'reactant_occurences': {'C': 2, 'O': 2},
'product_occurences': {'C': 1, 'O': 2},
'is_balanced': False}
from chemlib import Reaction, Compound
=[Compound('CO2')], products=[]).__dict__ Reaction(reactants
{'reactants': [<chemlib.chemistry.Compound>],
'products': [],
'compounds': [<chemlib.chemistry.Compound>],
'reactant_formulas': ['C₁O₂'],
'product_formulas': [],
'formula': '1C₁O₂ --> ',
'coefficients': {'C₁O₂': 1},
'constituents': ['C₁O₂'],
'reactant_occurences': {'C': 1, 'O': 2},
'product_occurences': {},
'is_balanced': False}