feat(python): Repaired python bindings

Python bindings have now been brought back up to feature pairity with
C++. Further, stubs have been added for all python features so that code
completion will work
This commit is contained in:
2025-11-25 14:08:58 -05:00
parent 22b52abc30
commit bb1d6bbb24
51 changed files with 3798 additions and 460 deletions

View File

@@ -0,0 +1,15 @@
"""
Python bindings for the fourdst utility modules which are a part of the 4D-STAR project.
"""
from __future__ import annotations
from . import engine
from . import exceptions
from . import io
from . import partition
from . import policy
from . import reaction
from . import screening
from . import solver
from . import type
from . import utils
__all__: list[str] = ['engine', 'exceptions', 'io', 'partition', 'policy', 'reaction', 'screening', 'solver', 'type', 'utils']

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
"""
A submodule for engine diagnostics
"""
from __future__ import annotations
import collections.abc
import fourdst._phys.composition
import gridfire._gridfire.engine
import typing
__all__: list[str] = ['inspect_jacobian_stiffness', 'inspect_species_balance', 'report_limiting_species']
def inspect_jacobian_stiffness(engine: gridfire._gridfire.engine.DynamicEngine, comp: fourdst._phys.composition.Composition, T9: typing.SupportsFloat, rho: typing.SupportsFloat, json: bool) -> ... | None:
...
def inspect_species_balance(engine: gridfire._gridfire.engine.DynamicEngine, species_name: str, comp: fourdst._phys.composition.Composition, T9: typing.SupportsFloat, rho: typing.SupportsFloat, json: bool) -> ... | None:
...
def report_limiting_species(engine: gridfire._gridfire.engine.DynamicEngine, Y_full: collections.abc.Sequence[typing.SupportsFloat], E_full: collections.abc.Sequence[typing.SupportsFloat], relTol: typing.SupportsFloat, absTol: typing.SupportsFloat, top_n: typing.SupportsInt, json: bool) -> ... | None:
...

View File

@@ -0,0 +1,59 @@
"""
GridFire exceptions bindings
"""
from __future__ import annotations
__all__: list[str] = ['BadCollectionError', 'BadRHSEngineError', 'CVODESolverFailureError', 'DebugException', 'EngineError', 'FailedToPartitionEngineError', 'GridFireError', 'HashingError', 'IllConditionedJacobianError', 'InvalidQSESolutionError', 'JacobianError', 'KINSolSolverFailureError', 'MissingBaseReactionError', 'MissingKeyReactionError', 'MissingSeedSpeciesError', 'NetworkResizedError', 'PolicyError', 'ReactionError', 'ReactionParsingError', 'SUNDIALSError', 'SingularJacobianError', 'SolverError', 'StaleJacobianError', 'UnableToSetNetworkReactionsError', 'UninitializedJacobianError', 'UnknownJacobianError', 'UtilityError']
class BadCollectionError(EngineError):
pass
class BadRHSEngineError(EngineError):
pass
class CVODESolverFailureError(SUNDIALSError):
pass
class DebugException(GridFireError):
pass
class EngineError(GridFireError):
pass
class FailedToPartitionEngineError(EngineError):
pass
class GridFireError(Exception):
pass
class HashingError(UtilityError):
pass
class IllConditionedJacobianError(SolverError):
pass
class InvalidQSESolutionError(EngineError):
pass
class JacobianError(EngineError):
pass
class KINSolSolverFailureError(SUNDIALSError):
pass
class MissingBaseReactionError(PolicyError):
pass
class MissingKeyReactionError(PolicyError):
pass
class MissingSeedSpeciesError(PolicyError):
pass
class NetworkResizedError(EngineError):
pass
class PolicyError(GridFireError):
pass
class ReactionError(GridFireError):
pass
class ReactionParsingError(ReactionError):
pass
class SUNDIALSError(SolverError):
pass
class SingularJacobianError(SolverError):
pass
class SolverError(GridFireError):
pass
class StaleJacobianError(JacobianError):
pass
class UnableToSetNetworkReactionsError(EngineError):
pass
class UninitializedJacobianError(JacobianError):
pass
class UnknownJacobianError(JacobianError):
pass
class UtilityError(GridFireError):
pass

View File

@@ -0,0 +1,14 @@
"""
GridFire io bindings
"""
from __future__ import annotations
__all__: list[str] = ['NetworkFileParser', 'ParsedNetworkData', 'SimpleReactionListFileParser']
class NetworkFileParser:
pass
class ParsedNetworkData:
pass
class SimpleReactionListFileParser(NetworkFileParser):
def parse(self, filename: str) -> ParsedNetworkData:
"""
Parse a simple reaction list file and return a ParsedNetworkData object.
"""

View File

@@ -0,0 +1,142 @@
"""
GridFire partition function bindings
"""
from __future__ import annotations
import collections.abc
import typing
__all__: list[str] = ['BasePartitionType', 'CompositePartitionFunction', 'GroundState', 'GroundStatePartitionFunction', 'PartitionFunction', 'RauscherThielemann', 'RauscherThielemannPartitionDataRecord', 'RauscherThielemannPartitionFunction', 'basePartitionTypeToString', 'stringToBasePartitionType']
class BasePartitionType:
"""
Members:
RauscherThielemann
GroundState
"""
GroundState: typing.ClassVar[BasePartitionType] # value = <BasePartitionType.GroundState: 1>
RauscherThielemann: typing.ClassVar[BasePartitionType] # value = <BasePartitionType.RauscherThielemann: 0>
__members__: typing.ClassVar[dict[str, BasePartitionType]] # value = {'RauscherThielemann': <BasePartitionType.RauscherThielemann: 0>, 'GroundState': <BasePartitionType.GroundState: 1>}
def __eq__(self, other: typing.Any) -> bool:
...
def __getstate__(self) -> int:
...
def __hash__(self) -> int:
...
def __index__(self) -> int:
...
def __init__(self, value: typing.SupportsInt) -> None:
...
def __int__(self) -> int:
...
def __ne__(self, other: typing.Any) -> bool:
...
def __repr__(self) -> str:
...
def __setstate__(self, state: typing.SupportsInt) -> None:
...
def __str__(self) -> str:
...
@property
def name(self) -> str:
...
@property
def value(self) -> int:
...
class CompositePartitionFunction:
@typing.overload
def __init__(self, partitionFunctions: collections.abc.Sequence[BasePartitionType]) -> None:
"""
Create a composite partition function from a list of base partition types.
"""
@typing.overload
def __init__(self, arg0: CompositePartitionFunction) -> None:
"""
Copy constructor for CompositePartitionFunction.
"""
def evaluate(self, z: typing.SupportsInt, a: typing.SupportsInt, T9: typing.SupportsFloat) -> float:
"""
Evaluate the composite partition function for given Z, A, and T9.
"""
def evaluateDerivative(self, z: typing.SupportsInt, a: typing.SupportsInt, T9: typing.SupportsFloat) -> float:
"""
Evaluate the derivative of the composite partition function for given Z, A, and T9.
"""
def get_type(self) -> str:
"""
Get the type of the partition function (should return 'Composite').
"""
def supports(self, z: typing.SupportsInt, a: typing.SupportsInt) -> bool:
"""
Check if the composite partition function supports given Z and A.
"""
class GroundStatePartitionFunction(PartitionFunction):
def __init__(self) -> None:
...
def evaluate(self, z: typing.SupportsInt, a: typing.SupportsInt, T9: typing.SupportsFloat) -> float:
"""
Evaluate the ground state partition function for given Z, A, and T9.
"""
def evaluateDerivative(self, z: typing.SupportsInt, a: typing.SupportsInt, T9: typing.SupportsFloat) -> float:
"""
Evaluate the derivative of the ground state partition function for given Z, A, and T9.
"""
def get_type(self) -> str:
"""
Get the type of the partition function (should return 'GroundState').
"""
def supports(self, z: typing.SupportsInt, a: typing.SupportsInt) -> bool:
"""
Check if the ground state partition function supports given Z and A.
"""
class PartitionFunction:
pass
class RauscherThielemannPartitionDataRecord:
@property
def a(self) -> int:
"""
Mass number
"""
@property
def ground_state_spin(self) -> float:
"""
Ground state spin
"""
@property
def normalized_g_values(self) -> float:
"""
Normalized g-values for the first 24 energy levels
"""
@property
def z(self) -> int:
"""
Atomic number
"""
class RauscherThielemannPartitionFunction(PartitionFunction):
def __init__(self) -> None:
...
def evaluate(self, z: typing.SupportsInt, a: typing.SupportsInt, T9: typing.SupportsFloat) -> float:
"""
Evaluate the Rauscher-Thielemann partition function for given Z, A, and T9.
"""
def evaluateDerivative(self, z: typing.SupportsInt, a: typing.SupportsInt, T9: typing.SupportsFloat) -> float:
"""
Evaluate the derivative of the Rauscher-Thielemann partition function for given Z, A, and T9.
"""
def get_type(self) -> str:
"""
Get the type of the partition function (should return 'RauscherThielemann').
"""
def supports(self, z: typing.SupportsInt, a: typing.SupportsInt) -> bool:
"""
Check if the Rauscher-Thielemann partition function supports given Z and A.
"""
def basePartitionTypeToString(type: BasePartitionType) -> str:
"""
Convert BasePartitionType to string.
"""
def stringToBasePartitionType(typeStr: str) -> BasePartitionType:
"""
Convert string to BasePartitionType.
"""
GroundState: BasePartitionType # value = <BasePartitionType.GroundState: 1>
RauscherThielemann: BasePartitionType # value = <BasePartitionType.RauscherThielemann: 0>

View File

@@ -0,0 +1,750 @@
"""
GridFire network policy bindings
"""
from __future__ import annotations
import collections.abc
import fourdst._phys.atomic
import fourdst._phys.composition
import gridfire._gridfire.engine
import gridfire._gridfire.reaction
import typing
__all__: list[str] = ['CNOChainPolicy', 'CNOIChainPolicy', 'CNOIIChainPolicy', 'CNOIIIChainPolicy', 'CNOIVChainPolicy', 'HotCNOChainPolicy', 'HotCNOIChainPolicy', 'HotCNOIIChainPolicy', 'HotCNOIIIChainPolicy', 'INITIALIZED_UNVERIFIED', 'INITIALIZED_VERIFIED', 'MISSING_KEY_REACTION', 'MISSING_KEY_SPECIES', 'MainSequencePolicy', 'MainSequenceReactionChainPolicy', 'MultiReactionChainPolicy', 'NetworkPolicy', 'NetworkPolicyStatus', 'ProtonProtonChainPolicy', 'ProtonProtonIChainPolicy', 'ProtonProtonIIChainPolicy', 'ProtonProtonIIIChainPolicy', 'ReactionChainPolicy', 'TemperatureDependentChainPolicy', 'TripleAlphaChainPolicy', 'UNINITIALIZED']
class CNOChainPolicy(MultiReactionChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class CNOIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class CNOIIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class CNOIIIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class CNOIVChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class HotCNOChainPolicy(MultiReactionChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class HotCNOIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class HotCNOIIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class HotCNOIIIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class MainSequencePolicy(NetworkPolicy):
@typing.overload
def __init__(self, composition: fourdst._phys.composition.Composition) -> None:
"""
Construct MainSequencePolicy from an existing composition.
"""
@typing.overload
def __init__(self, seed_species: collections.abc.Sequence[fourdst._phys.atomic.Species], mass_fractions: collections.abc.Sequence[typing.SupportsFloat]) -> None:
"""
Construct MainSequencePolicy from seed species and mass fractions.
"""
def construct(self) -> gridfire._gridfire.engine.DynamicEngine:
"""
Construct the network according to the policy.
"""
def get_engine_types_stack(self) -> list[gridfire._gridfire.engine.EngineTypes]:
"""
Get the types of engines in the stack constructed by the network policy.
"""
def get_seed_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the set of seed reactions required by the network policy.
"""
def get_seed_species(self) -> set[fourdst._phys.atomic.Species]:
"""
Get the set of seed species required by the network policy.
"""
def get_status(self) -> NetworkPolicyStatus:
"""
Get the current status of the network policy.
"""
def name(self) -> str:
"""
Get the name of the network policy.
"""
class MainSequenceReactionChainPolicy(MultiReactionChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class MultiReactionChainPolicy(ReactionChainPolicy):
pass
class NetworkPolicy:
pass
class NetworkPolicyStatus:
"""
Members:
UNINITIALIZED
INITIALIZED_UNVERIFIED
MISSING_KEY_REACTION
MISSING_KEY_SPECIES
INITIALIZED_VERIFIED
"""
INITIALIZED_UNVERIFIED: typing.ClassVar[NetworkPolicyStatus] # value = <NetworkPolicyStatus.INITIALIZED_UNVERIFIED: 1>
INITIALIZED_VERIFIED: typing.ClassVar[NetworkPolicyStatus] # value = <NetworkPolicyStatus.INITIALIZED_VERIFIED: 4>
MISSING_KEY_REACTION: typing.ClassVar[NetworkPolicyStatus] # value = <NetworkPolicyStatus.MISSING_KEY_REACTION: 2>
MISSING_KEY_SPECIES: typing.ClassVar[NetworkPolicyStatus] # value = <NetworkPolicyStatus.MISSING_KEY_SPECIES: 3>
UNINITIALIZED: typing.ClassVar[NetworkPolicyStatus] # value = <NetworkPolicyStatus.UNINITIALIZED: 0>
__members__: typing.ClassVar[dict[str, NetworkPolicyStatus]] # value = {'UNINITIALIZED': <NetworkPolicyStatus.UNINITIALIZED: 0>, 'INITIALIZED_UNVERIFIED': <NetworkPolicyStatus.INITIALIZED_UNVERIFIED: 1>, 'MISSING_KEY_REACTION': <NetworkPolicyStatus.MISSING_KEY_REACTION: 2>, 'MISSING_KEY_SPECIES': <NetworkPolicyStatus.MISSING_KEY_SPECIES: 3>, 'INITIALIZED_VERIFIED': <NetworkPolicyStatus.INITIALIZED_VERIFIED: 4>}
def __eq__(self, other: typing.Any) -> bool:
...
def __getstate__(self) -> int:
...
def __hash__(self) -> int:
...
def __index__(self) -> int:
...
def __init__(self, value: typing.SupportsInt) -> None:
...
def __int__(self) -> int:
...
def __ne__(self, other: typing.Any) -> bool:
...
def __repr__(self) -> str:
...
def __setstate__(self, state: typing.SupportsInt) -> None:
...
def __str__(self) -> str:
...
@property
def name(self) -> str:
...
@property
def value(self) -> int:
...
class ProtonProtonChainPolicy(MultiReactionChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class ProtonProtonIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class ProtonProtonIIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class ProtonProtonIIIChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
class ReactionChainPolicy:
pass
class TemperatureDependentChainPolicy(ReactionChainPolicy):
pass
class TripleAlphaChainPolicy(TemperatureDependentChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
Check equality with another ReactionChainPolicy.
"""
def __hash__(self) -> int:
...
def __init__(self) -> None:
...
def __ne__(self, other: ReactionChainPolicy) -> bool:
"""
Check inequality with another ReactionChainPolicy.
"""
def __repr__(self) -> str:
...
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the reaction chain contains a reaction with the given ID.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the reaction chain contains the given reaction.
"""
def get_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the ReactionSet representing this reaction chain.
"""
def hash(self, seed: typing.SupportsInt) -> int:
"""
Compute a hash value for the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
@typing.overload
def name(self) -> str:
"""
Get the name of the reaction chain policy.
"""
INITIALIZED_UNVERIFIED: NetworkPolicyStatus # value = <NetworkPolicyStatus.INITIALIZED_UNVERIFIED: 1>
INITIALIZED_VERIFIED: NetworkPolicyStatus # value = <NetworkPolicyStatus.INITIALIZED_VERIFIED: 4>
MISSING_KEY_REACTION: NetworkPolicyStatus # value = <NetworkPolicyStatus.MISSING_KEY_REACTION: 2>
MISSING_KEY_SPECIES: NetworkPolicyStatus # value = <NetworkPolicyStatus.MISSING_KEY_SPECIES: 3>
UNINITIALIZED: NetworkPolicyStatus # value = <NetworkPolicyStatus.UNINITIALIZED: 0>

View File

@@ -0,0 +1,249 @@
"""
GridFire reaction bindings
"""
from __future__ import annotations
import collections.abc
import fourdst._phys.atomic
import fourdst._phys.composition
import typing
__all__: list[str] = ['LogicalReaclibReaction', 'RateCoefficientSet', 'ReaclibReaction', 'ReactionSet', 'get_all_reactions', 'packReactionSet']
class LogicalReaclibReaction(ReaclibReaction):
@typing.overload
def __init__(self, reactions: collections.abc.Sequence[ReaclibReaction]) -> None:
"""
Construct a LogicalReaclibReaction from a vector of ReaclibReaction objects.
"""
@typing.overload
def __init__(self, reactions: collections.abc.Sequence[ReaclibReaction], is_reverse: bool) -> None:
"""
Construct a LogicalReaclibReaction from a vector of ReaclibReaction objects.
"""
def __len__(self) -> int:
"""
Overload len() to return the number of source rates.
"""
def add_reaction(self, reaction: ReaclibReaction) -> None:
"""
Add another Reaction source to this logical reaction.
"""
def calculate_forward_rate_log_derivative(self, T9: typing.SupportsFloat, rho: typing.SupportsFloat, Ye: typing.SupportsFloat, mue: typing.SupportsFloat, Composition: fourdst._phys.composition.Composition) -> float:
"""
Calculate the forward rate log derivative at a given temperature T9 (in units of 10^9 K).
"""
def calculate_rate(self, T9: typing.SupportsFloat, rho: typing.SupportsFloat, Ye: typing.SupportsFloat, mue: typing.SupportsFloat, Y: collections.abc.Sequence[typing.SupportsFloat], index_to_species_map: collections.abc.Mapping[typing.SupportsInt, fourdst._phys.atomic.Species]) -> float:
"""
Calculate the reaction rate at a given temperature T9 (in units of 10^9 K). Note that for a reaclib reaction only T9 is actually used, all other parameters are there for interface compatibility.
"""
def size(self) -> int:
"""
Get the number of source rates contributing to this logical reaction.
"""
def sources(self) -> list[str]:
"""
Get the list of source labels for the aggregated rates.
"""
class RateCoefficientSet:
def __init__(self, a0: typing.SupportsFloat, a1: typing.SupportsFloat, a2: typing.SupportsFloat, a3: typing.SupportsFloat, a4: typing.SupportsFloat, a5: typing.SupportsFloat, a6: typing.SupportsFloat) -> None:
"""
Construct a RateCoefficientSet with the given parameters.
"""
class ReaclibReaction:
__hash__: typing.ClassVar[None] = None
def __eq__(self, arg0: ReaclibReaction) -> bool:
"""
Equality operator for reactions based on their IDs.
"""
def __init__(self, id: str, peName: str, chapter: typing.SupportsInt, reactants: collections.abc.Sequence[fourdst._phys.atomic.Species], products: collections.abc.Sequence[fourdst._phys.atomic.Species], qValue: typing.SupportsFloat, label: str, sets: RateCoefficientSet, reverse: bool = False) -> None:
"""
Construct a Reaction with the given parameters.
"""
def __neq__(self, arg0: ReaclibReaction) -> bool:
"""
Inequality operator for reactions based on their IDs.
"""
def __repr__(self) -> str:
...
def all_species(self) -> set[fourdst._phys.atomic.Species]:
"""
Get all species involved in the reaction (both reactants and products) as a set.
"""
def calculate_rate(self, T9: typing.SupportsFloat, rho: typing.SupportsFloat, Y: collections.abc.Sequence[typing.SupportsFloat]) -> float:
"""
Calculate the reaction rate at a given temperature T9 (in units of 10^9 K).
"""
def chapter(self) -> int:
"""
Get the REACLIB chapter number defining the reaction structure.
"""
def contains(self, species: fourdst._phys.atomic.Species) -> bool:
"""
Check if the reaction contains a specific species.
"""
def contains_product(self, arg0: fourdst._phys.atomic.Species) -> bool:
"""
Check if the reaction contains a specific product species.
"""
def contains_reactant(self, arg0: fourdst._phys.atomic.Species) -> bool:
"""
Check if the reaction contains a specific reactant species.
"""
def excess_energy(self) -> float:
"""
Calculate the excess energy from the mass difference of reactants and products.
"""
def hash(self, seed: typing.SupportsInt = 0) -> int:
"""
Compute a hash for the reaction based on its ID.
"""
def id(self) -> str:
"""
Get the unique identifier of the reaction.
"""
def is_reverse(self) -> bool:
"""
Check if this is a reverse reaction rate.
"""
def num_species(self) -> int:
"""
Count the number of species in the reaction.
"""
def peName(self) -> str:
"""
Get the reaction name in (projectile, ejectile) notation (e.g., 'p(p,g)d').
"""
def product_species(self) -> set[fourdst._phys.atomic.Species]:
"""
Get the product species of the reaction as a set.
"""
def products(self) -> list[fourdst._phys.atomic.Species]:
"""
Get a list of product species in the reaction.
"""
def qValue(self) -> float:
"""
Get the Q-value of the reaction in MeV.
"""
def rateCoefficients(self) -> RateCoefficientSet:
"""
get the set of rate coefficients.
"""
def reactant_species(self) -> set[fourdst._phys.atomic.Species]:
"""
Get the reactant species of the reaction as a set.
"""
def reactants(self) -> list[fourdst._phys.atomic.Species]:
"""
Get a list of reactant species in the reaction.
"""
def sourceLabel(self) -> str:
"""
Get the source label for the rate data (e.g., 'wc12w', 'st08').
"""
@typing.overload
def stoichiometry(self, species: fourdst._phys.atomic.Species) -> int:
"""
Get the stoichiometry of the reaction as a map from species to their coefficients.
"""
@typing.overload
def stoichiometry(self) -> dict[fourdst._phys.atomic.Species, int]:
"""
Get the stoichiometry of the reaction as a map from species to their coefficients.
"""
class ReactionSet:
__hash__: typing.ClassVar[None] = None
@staticmethod
def from_clones(reactions: collections.abc.Sequence[...]) -> ReactionSet:
"""
Create a ReactionSet that takes ownership of the reactions by cloning the input reactions.
"""
def __eq__(self, LogicalReactionSet: ReactionSet) -> bool:
"""
Equality operator for LogicalReactionSets based on their contents.
"""
def __getitem__(self, index: typing.SupportsInt) -> ...:
"""
Get a LogicalReaclibReaction by index.
"""
def __getitem___(self, id: str) -> ...:
"""
Get a LogicalReaclibReaction by its ID.
"""
@typing.overload
def __init__(self, reactions: collections.abc.Sequence[...]) -> None:
"""
Construct a LogicalReactionSet from a vector of LogicalReaclibReaction objects.
"""
@typing.overload
def __init__(self) -> None:
"""
Default constructor for an empty LogicalReactionSet.
"""
@typing.overload
def __init__(self, other: ReactionSet) -> None:
"""
Copy constructor for LogicalReactionSet.
"""
def __len__(self) -> int:
"""
Overload len() to return the number of LogicalReactions.
"""
def __ne__(self, LogicalReactionSet: ReactionSet) -> bool:
"""
Inequality operator for LogicalReactionSets based on their contents.
"""
def __repr__(self) -> str:
...
def add_reaction(self, reaction: ...) -> None:
"""
Add a LogicalReaclibReaction to the set.
"""
def clear(self) -> None:
"""
Remove all LogicalReactions from the set.
"""
@typing.overload
def contains(self, id: str) -> bool:
"""
Check if the set contains a specific LogicalReaclibReaction.
"""
@typing.overload
def contains(self, reaction: ...) -> bool:
"""
Check if the set contains a specific Reaction.
"""
def contains_product(self, species: fourdst._phys.atomic.Species) -> bool:
"""
Check if any reaction in the set has the species as a product.
"""
def contains_reactant(self, species: fourdst._phys.atomic.Species) -> bool:
"""
Check if any reaction in the set has the species as a reactant.
"""
def contains_species(self, species: fourdst._phys.atomic.Species) -> bool:
"""
Check if any reaction in the set involves the given species.
"""
def getReactionSetSpecies(self) -> set[fourdst._phys.atomic.Species]:
"""
Get all species involved in the reactions of the set as a set of Species objects.
"""
def hash(self, seed: typing.SupportsInt = 0) -> int:
"""
Compute a hash for the LogicalReactionSet based on its contents.
"""
def remove_reaction(self, reaction: ...) -> None:
"""
Remove a LogicalReaclibReaction from the set.
"""
def size(self) -> int:
"""
Get the number of LogicalReactions in the set.
"""
def get_all_reactions() -> ReactionSet:
"""
Get all reactions from the REACLIB database.
"""
def packReactionSet(reactionSet: ReactionSet) -> ReactionSet:
"""
Convert a ReactionSet to a LogicalReactionSet by aggregating reactions with the same peName.
"""

View File

@@ -0,0 +1,68 @@
"""
GridFire plasma screening bindings
"""
from __future__ import annotations
import collections.abc
import fourdst._phys.atomic
import gridfire._gridfire.reaction
import typing
__all__: list[str] = ['BARE', 'BareScreeningModel', 'ScreeningModel', 'ScreeningType', 'WEAK', 'WeakScreeningModel', 'selectScreeningModel']
class BareScreeningModel:
def __init__(self) -> None:
...
def calculateScreeningFactors(self, reactions: gridfire._gridfire.reaction.ReactionSet, species: collections.abc.Sequence[fourdst._phys.atomic.Species], Y: collections.abc.Sequence[typing.SupportsFloat], T9: typing.SupportsFloat, rho: typing.SupportsFloat) -> list[float]:
"""
Calculate the bare plasma screening factors. This always returns 1.0 (bare)
"""
class ScreeningModel:
pass
class ScreeningType:
"""
Members:
BARE
WEAK
"""
BARE: typing.ClassVar[ScreeningType] # value = <ScreeningType.BARE: 0>
WEAK: typing.ClassVar[ScreeningType] # value = <ScreeningType.WEAK: 1>
__members__: typing.ClassVar[dict[str, ScreeningType]] # value = {'BARE': <ScreeningType.BARE: 0>, 'WEAK': <ScreeningType.WEAK: 1>}
def __eq__(self, other: typing.Any) -> bool:
...
def __getstate__(self) -> int:
...
def __hash__(self) -> int:
...
def __index__(self) -> int:
...
def __init__(self, value: typing.SupportsInt) -> None:
...
def __int__(self) -> int:
...
def __ne__(self, other: typing.Any) -> bool:
...
def __repr__(self) -> str:
...
def __setstate__(self, state: typing.SupportsInt) -> None:
...
def __str__(self) -> str:
...
@property
def name(self) -> str:
...
@property
def value(self) -> int:
...
class WeakScreeningModel:
def __init__(self) -> None:
...
def calculateScreeningFactors(self, reactions: gridfire._gridfire.reaction.ReactionSet, species: collections.abc.Sequence[fourdst._phys.atomic.Species], Y: collections.abc.Sequence[typing.SupportsFloat], T9: typing.SupportsFloat, rho: typing.SupportsFloat) -> list[float]:
"""
Calculate the weak plasma screening factors using the Salpeter (1954) model.
"""
def selectScreeningModel(type: ScreeningType) -> ScreeningModel:
"""
Select a screening model based on the specified type. Returns a pointer to the selected model.
"""
BARE: ScreeningType # value = <ScreeningType.BARE: 0>
WEAK: ScreeningType # value = <ScreeningType.WEAK: 1>

View File

@@ -0,0 +1,92 @@
"""
GridFire numerical solver bindings
"""
from __future__ import annotations
import collections.abc
import fourdst._phys.atomic
import gridfire._gridfire.engine
import gridfire._gridfire.type
import typing
__all__: list[str] = ['CVODESolverStrategy', 'CVODETimestepContext', 'DynamicNetworkSolverStrategy', 'SolverContextBase']
class CVODESolverStrategy(DynamicNetworkSolverStrategy):
def __init__(self, engine: gridfire._gridfire.engine.DynamicEngine) -> None:
"""
Initialize the CVODESolverStrategy object.
"""
def evaluate(self, netIn: gridfire._gridfire.type.NetIn, display_trigger: bool = False) -> gridfire._gridfire.type.NetOut:
"""
evaluate the dynamic engine using the dynamic engine class
"""
def get_absTol(self) -> float:
"""
Get the absolute tolerance for the CVODE solver.
"""
def get_relTol(self) -> float:
"""
Get the relative tolerance for the CVODE solver.
"""
def get_stdout_logging_enabled(self) -> bool:
"""
Check if solver logging to standard output is enabled.
"""
def set_absTol(self, absTol: typing.SupportsFloat) -> None:
"""
Set the absolute tolerance for the CVODE solver.
"""
def set_callback(self, cb: collections.abc.Callable[[CVODETimestepContext], None]) -> None:
"""
Set a callback function which will run at the end of every successful timestep
"""
def set_relTol(self, relTol: typing.SupportsFloat) -> None:
"""
Set the relative tolerance for the CVODE solver.
"""
def set_stdout_logging_enabled(self, logging_enabled: bool) -> None:
"""
Enable logging to standard output.
"""
class CVODETimestepContext(SolverContextBase):
@property
def T9(self) -> float:
...
@property
def currentConvergenceFailures(self) -> int:
...
@property
def currentNonlinearIterations(self) -> int:
...
@property
def dt(self) -> float:
...
@property
def engine(self) -> gridfire._gridfire.engine.DynamicEngine:
...
@property
def last_step_time(self) -> float:
...
@property
def networkSpecies(self) -> list[fourdst._phys.atomic.Species]:
...
@property
def num_steps(self) -> int:
...
@property
def rho(self) -> float:
...
@property
def state(self) -> list[float]:
...
@property
def t(self) -> float:
...
class DynamicNetworkSolverStrategy:
def describe_callback_context(self) -> list[tuple[str, str]]:
"""
Get a structure representing what data is in the callback context in a human readable format
"""
def evaluate(self, netIn: gridfire._gridfire.type.NetIn) -> gridfire._gridfire.type.NetOut:
"""
evaluate the dynamic engine using the dynamic engine class
"""
class SolverContextBase:
pass

View File

@@ -0,0 +1,61 @@
"""
GridFire type bindings
"""
from __future__ import annotations
import fourdst._phys.composition
import typing
__all__: list[str] = ['NetIn', 'NetOut']
class NetIn:
composition: fourdst._phys.composition.Composition
def __init__(self) -> None:
...
def __repr__(self) -> str:
...
@property
def density(self) -> float:
...
@density.setter
def density(self, arg0: typing.SupportsFloat) -> None:
...
@property
def dt0(self) -> float:
...
@dt0.setter
def dt0(self, arg0: typing.SupportsFloat) -> None:
...
@property
def energy(self) -> float:
...
@energy.setter
def energy(self, arg0: typing.SupportsFloat) -> None:
...
@property
def tMax(self) -> float:
...
@tMax.setter
def tMax(self, arg0: typing.SupportsFloat) -> None:
...
@property
def temperature(self) -> float:
...
@temperature.setter
def temperature(self, arg0: typing.SupportsFloat) -> None:
...
class NetOut:
def __repr__(self) -> str:
...
@property
def composition(self) -> fourdst._phys.composition.Composition:
...
@property
def dEps_dRho(self) -> float:
...
@property
def dEps_dT(self) -> float:
...
@property
def energy(self) -> float:
...
@property
def num_steps(self) -> int:
...

View File

@@ -0,0 +1,17 @@
"""
GridFire utility method bindings
"""
from __future__ import annotations
import fourdst._phys.composition
import gridfire._gridfire.engine
import typing
from . import hashing
__all__: list[str] = ['formatNuclearTimescaleLogString', 'hash_atomic', 'hash_reaction', 'hashing']
def formatNuclearTimescaleLogString(engine: gridfire._gridfire.engine.DynamicEngine, Y: fourdst._phys.composition.Composition, T9: typing.SupportsFloat, rho: typing.SupportsFloat) -> str:
"""
Format a string for logging nuclear timescales based on temperature, density, and energy generation rate.
"""
def hash_atomic(a: typing.SupportsInt, z: typing.SupportsInt) -> int:
...
def hash_reaction(reaction: ...) -> int:
...

View File

@@ -0,0 +1,6 @@
"""
module for gridfire hashing functions
"""
from __future__ import annotations
from . import reaction
__all__: list[str] = ['reaction']

View File

@@ -0,0 +1,12 @@
"""
utility module for hashing gridfire reaction functions
"""
from __future__ import annotations
import typing
__all__: list[str] = ['mix_species', 'multiset_combine', 'splitmix64']
def mix_species(a: typing.SupportsInt, z: typing.SupportsInt) -> int:
...
def multiset_combine(acc: typing.SupportsInt, x: typing.SupportsInt) -> int:
...
def splitmix64(x: typing.SupportsInt) -> int:
...