Skip to content

Commit

Permalink
Auto-format code using Clang-Format (#258)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
github-actions[bot] and actions-user authored Oct 13, 2024
1 parent d82d6ea commit 8696033
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/acom_music_box/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
logger = logging.getLogger(__name__)


class Conditions:
"""
Represents conditions for a simulation with attributes such as pressure, temperature, species concentrations,
Expand Down Expand Up @@ -196,7 +197,7 @@ def read_initial_rates_from_file(cls, file_path):
if rate_name in reaction_rates:
raise ValueError(f"Duplicate reaction rate found: {rate_name}")
reaction_rates[rate_name] = df.iloc[0][key]

return reaction_rates

def add_species_concentration(self, species_concentration):
Expand Down
2 changes: 1 addition & 1 deletion src/acom_music_box/evolving_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
from .conditions import Conditions


class EvolvingConditions:
"""
Represents evolving conditions with attributes such as time and associated conditions.
Expand Down Expand Up @@ -190,7 +191,6 @@ def read_conditions_from_file(cls, file_path):
species_concentrations,
reaction_rates))


return cls(times=times, conditions=conditions)

# allows len overload for this class
Expand Down
3 changes: 1 addition & 2 deletions src/acom_music_box/model_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ def __init__(
self.output_step_time = output_step_time
self.simulation_length = simulation_length
self.grid = grid

def __repr__(self):
return f"BoxModelOptions(chem_step_time={self.chem_step_time}, output_step_time={self.output_step_time}, simulation_length={self.simulation_length}, grid={self.grid})"

def __str__(self):
return f"BoxModelOptions Time step: {self.chem_step_time}, Output time step: {self.output_step_time}, Simulation length: {self.simulation_length}, Grid: {self.grid}"


@classmethod
def from_UI_JSON(cls, UI_JSON):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/acom_music_box/music_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def order_reaction_rates(curr_conditions, rate_constant_ordering):

for rate_label, value in curr_conditions.reaction_rates.items():
ordered_rate_constants[rate_constant_ordering[rate_label]] = value

return ordered_rate_constants

@staticmethod
Expand Down
22 changes: 11 additions & 11 deletions src/acom_music_box/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ def convert_concentration(data, key, temperature, pressure):
air_density = calculate_air_density(temperature, pressure)

unit_conversions = {
'mol m-3': 1, # mol m-3 is the base unit
'mol cm-3': 1e6, # cm3 m-3
'molec m-3': 1 / AVOGADRO_CONSTANT, # mol
'molecule m-3': 1 / AVOGADRO_CONSTANT, # mol
'molec cm-3': 1e6 / AVOGADRO_CONSTANT, #mol cm3 m-3
'molecule cm-3': 1e6 / AVOGADRO_CONSTANT, #mol cm3 m-3
'ppth': 1e-3 * air_density, # moles / m^3
'ppm': 1e-6 * air_density, # moles / m^3
'ppb': 1e-9 * air_density, # moles / m^3
'ppt': 1e-12 * air_density, # moles / m^3
'mol mol-1': 1 * air_density # moles / m^3
'mol m-3': 1, # mol m-3 is the base unit
'mol cm-3': 1e6, # cm3 m-3
'molec m-3': 1 / AVOGADRO_CONSTANT, # mol
'molecule m-3': 1 / AVOGADRO_CONSTANT, # mol
'molec cm-3': 1e6 / AVOGADRO_CONSTANT, # mol cm3 m-3
'molecule cm-3': 1e6 / AVOGADRO_CONSTANT, # mol cm3 m-3
'ppth': 1e-3 * air_density, # moles / m^3
'ppm': 1e-6 * air_density, # moles / m^3
'ppb': 1e-9 * air_density, # moles / m^3
'ppt': 1e-12 * air_density, # moles / m^3
'mol mol-1': 1 * air_density # moles / m^3
}

if unit in unit_conversions:
Expand Down

0 comments on commit 8696033

Please sign in to comment.