feat(python): Python Bindings

Python Bindings are working again
This commit is contained in:
2025-12-20 16:02:52 -05:00
parent d65c237b26
commit 11a596b75b
78 changed files with 4411 additions and 1110 deletions

View File

@@ -6,9 +6,11 @@ import collections.abc
import fourdst._phys.atomic
import fourdst._phys.composition
import gridfire._gridfire.engine
import gridfire._gridfire.engine.scratchpads
import gridfire._gridfire.partition
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']
__all__: list[str] = ['CNOChainPolicy', 'CNOIChainPolicy', 'CNOIIChainPolicy', 'CNOIIIChainPolicy', 'CNOIVChainPolicy', 'ConstructionResults', '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', 'network_policy_status_to_string']
class CNOChainPolicy(MultiReactionChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
@@ -224,6 +226,13 @@ class CNOIVChainPolicy(TemperatureDependentChainPolicy):
"""
Get the name of the reaction chain policy.
"""
class ConstructionResults:
@property
def engine(self) -> gridfire._gridfire.engine.DynamicEngine:
...
@property
def scratch_blob(self) -> gridfire._gridfire.engine.scratchpads.StateBlob:
...
class HotCNOChainPolicy(MultiReactionChainPolicy):
def __eq__(self, other: ReactionChainPolicy) -> bool:
"""
@@ -407,14 +416,18 @@ class MainSequencePolicy(NetworkPolicy):
"""
Construct MainSequencePolicy from seed species and mass fractions.
"""
def construct(self) -> gridfire._gridfire.engine.DynamicEngine:
def construct(self) -> ConstructionResults:
"""
Construct the network according to the policy.
"""
def get_engine_stack(self) -> list[gridfire._gridfire.engine.DynamicEngine]:
...
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_partition_function(self) -> gridfire._gridfire.partition.PartitionFunction:
...
def get_seed_reactions(self) -> gridfire._gridfire.reaction.ReactionSet:
"""
Get the set of seed reactions required by the network policy.
@@ -423,6 +436,8 @@ class MainSequencePolicy(NetworkPolicy):
"""
Get the set of seed species required by the network policy.
"""
def get_stack_scratch_blob(self) -> gridfire._gridfire.engine.scratchpads.StateBlob:
...
def get_status(self) -> NetworkPolicyStatus:
"""
Get the current status of the network policy.
@@ -743,6 +758,10 @@ class TripleAlphaChainPolicy(TemperatureDependentChainPolicy):
"""
Get the name of the reaction chain policy.
"""
def network_policy_status_to_string(status: NetworkPolicyStatus) -> str:
"""
Convert a NetworkPolicyStatus enum value to its string representation.
"""
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>