Skip to content

Commit

Permalink
Merge branch 'python_box_model' of https://github.com/NCAR/music-box
Browse files Browse the repository at this point in the history
…into python_box_model
  • Loading branch information
alexjamesgarza committed Apr 6, 2024
2 parents b78fafc + 9663de5 commit 2bcc8bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/music_box/music_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,15 @@ def generateConfig(self, directory):
species_concentration = next((x for x in self.evolving_conditions.conditions[i].species_concentrations if x.species.name == species_name), None)
row.append(species_concentration.concentration)
elif header.endswith(".s-1"):
reaction_name = header.split('.')[1]
reaction_name = header.split('.')

if reaction_name[0] == 'LOSS' or reaction_name[0] == 'EMIS':
reaction_name = reaction_name[0] + '_' + reaction_name[1]
else:
reaction_name = reaction_name[1]

reaction_rate = next((x for x in self.evolving_conditions.conditions[i].reaction_rates if x.reaction.name == reaction_name), None)
row.append(reaction_rate.rate)
row.append(reaction_rate.rate)

writer.writerow(row)

Expand Down Expand Up @@ -570,7 +576,7 @@ def order_reaction_rates(self, curr_conditions, rate_constant_ordering):
ordered_rate_constants = len(rate_constants.keys()) * [0.0]
for key, value in rate_constants.items():

ordered_rate_constants[rate_constant_ordering[key]] = value
ordered_rate_constants[rate_constant_ordering[key]] = float(value)
return ordered_rate_constants

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion src/music_box/music_box_evolving_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def from_UI_JSON(cls, UI_JSON, species_list, reaction_list):

evol_from_json = UI_JSON['conditions']['evolving conditions']
for i in range(1, len(evol_from_json)):
times.append(evol_from_json[i][0])
times.append(float(evol_from_json[i][0]))

pressure = None
if 'ENV.pressure.Pa' in headers:
Expand Down

0 comments on commit 2bcc8bf

Please sign in to comment.