From 8696033ddf84cc33fb3cd8e500c57ea226243d9a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 13:39:02 -0500 Subject: [PATCH] Auto-format code using Clang-Format (#258) Co-authored-by: GitHub Actions --- src/acom_music_box/conditions.py | 3 ++- src/acom_music_box/evolving_conditions.py | 2 +- src/acom_music_box/model_options.py | 3 +-- src/acom_music_box/music_box.py | 2 +- src/acom_music_box/utils.py | 22 +++++++++++----------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/acom_music_box/conditions.py b/src/acom_music_box/conditions.py index 5a0199d3..0fecbb3a 100644 --- a/src/acom_music_box/conditions.py +++ b/src/acom_music_box/conditions.py @@ -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, @@ -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): diff --git a/src/acom_music_box/evolving_conditions.py b/src/acom_music_box/evolving_conditions.py index e763fd1b..91a9375e 100644 --- a/src/acom_music_box/evolving_conditions.py +++ b/src/acom_music_box/evolving_conditions.py @@ -3,6 +3,7 @@ import re from .conditions import Conditions + class EvolvingConditions: """ Represents evolving conditions with attributes such as time and associated conditions. @@ -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 diff --git a/src/acom_music_box/model_options.py b/src/acom_music_box/model_options.py index 97588fad..00ce9fc7 100644 --- a/src/acom_music_box/model_options.py +++ b/src/acom_music_box/model_options.py @@ -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): """ diff --git a/src/acom_music_box/music_box.py b/src/acom_music_box/music_box.py index d23ac7e8..3ff70741 100644 --- a/src/acom_music_box/music_box.py +++ b/src/acom_music_box/music_box.py @@ -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 diff --git a/src/acom_music_box/utils.py b/src/acom_music_box/utils.py index 46750d50..7fc12c19 100644 --- a/src/acom_music_box/utils.py +++ b/src/acom_music_box/utils.py @@ -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: