Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Oct 11, 2024
1 parent 135e76f commit 21eba37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
15 changes: 7 additions & 8 deletions src/acom_music_box/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def __init__(
Args:
pressure (float): The pressure of the conditions in atmospheres.
temperature (float): The temperature of the conditions in Kelvin.
species_concentrations (List[SpeciesConcentration]): A list of species concentrations. Default is an empty list.
reaction_rates (List[ReactionRate]): A list of reaction rates. Default is an empty list.
species_concentrations (Dict[Species, float]): A dictionary of species concentrations.
reaction_rates (Dict[Reaction, float]): A dictionary of reaction rates.
"""
self.pressure = pressure
self.temperature = temperature
Expand Down Expand Up @@ -117,9 +117,7 @@ def from_config_JSON(
Args:
path_to_json (str): The path to the JSON file containing the initial conditions and settings.
config_JSON (dict): The configuration JSON object containing the initial conditions and settings.
species_list (SpeciesList): A SpeciesList containing the species involved in the simulation.
reaction_list (ReactionList): A ReactionList containing the reactions involved in the simulation.
object (dict): The configuration JSON object containing the initial conditions and settings.
Returns:
object: An instance of the Conditions class with the settings from the configuration JSON object.
Expand Down Expand Up @@ -172,10 +170,9 @@ def read_initial_rates_from_file(cls, file_path):
Args:
file_path (str): The path to the file containing the initial reaction rates.
reaction_list (ReactionList): A ReactionList containing the reactions involved in the simulation.
Returns:
list: A list where each element represents the initial rate of a reaction.
dict: A dictionary of initial reaction rates.
"""

reaction_rates = {}
Expand All @@ -192,7 +189,9 @@ def read_initial_rates_from_file(cls, file_path):
elif len(parts) == 2:
reaction_type, label = parts
else:
logger.error(f"Unexpected format in key: {key}")
error = f"Unexpected format in key: {key}"
logger.error(error)
raise ValueError(error)
rate_name = f'{reaction_type}.{label}'
if rate_name in reaction_rates:
raise ValueError(f"Duplicate reaction rate found: {rate_name}")
Expand Down
6 changes: 3 additions & 3 deletions src/acom_music_box/music_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def loadJson(self, path_to_json):
# Set initial conditions
self.initial_conditions = Conditions.from_config_JSON(path_to_json, data)

# Set initial conditions
# Set evolving conditions
self.evolving_conditions = EvolvingConditions.from_config_JSON(path_to_json, data)

camp_path = os.path.join(os.path.dirname(path_to_json), self.config_file)
Expand All @@ -255,8 +255,8 @@ def order_reaction_rates(curr_conditions, rate_constant_ordering):
and reorders the reaction rates accordingly.
Args:
rate_constants (dict): A dictionary of rate constants.
rate_constant_ordering (dict): A dictionary that maps rate constant keys to indices for ordering.
curr_conditions: A Condition with the current state information
rate_constant_ordering: A dictionary which maps reaction names to their index in the reaction rates array
Returns:
list: An ordered list of rate constants.
Expand Down

0 comments on commit 21eba37

Please sign in to comment.