Skip to content

Commit

Permalink
created .whl for music_box package
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjamesgarza committed Apr 4, 2024
1 parent 0db500e commit 81b820b
Show file tree
Hide file tree
Showing 26 changed files with 97 additions and 3,661 deletions.
4 changes: 2 additions & 2 deletions src/analytical_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

from box_model import BoxModel
from music_box import MusicBox

import math


def __main__():
box_model = BoxModel()
box_model = MusicBox()

#configures box model
conditions_path = "configs/analytical_config/my_config.json"
Expand Down
4 changes: 2 additions & 2 deletions src/chapman_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from box_model import BoxModel
from music_box import MusicBox
import csv
import math

def __main__():
box_model = BoxModel()
box_model = MusicBox()

#configures box model
conditions_path = "configs/chapman_config/my_config.json"
Expand Down
Binary file added src/dist/music_box-0.1-py3-none-any.whl
Binary file not shown.
Binary file added src/dist/music_box-0.1.tar.gz
Binary file not shown.
7 changes: 7 additions & 0 deletions src/music_box.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Metadata-Version: 2.1
Name: music-box
Version: 0.1
Summary: MICM based box model
Home-page: https://github.com/NCAR/music-box
Author: NCAR
Author-email: [email protected]
19 changes: 19 additions & 0 deletions src/music_box.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
setup.py
music_box/__init__.py
music_box/music_box.py
music_box/music_box_conditions.py
music_box/music_box_evolving_conditions.py
music_box/music_box_model_options.py
music_box/music_box_product.py
music_box/music_box_reactant.py
music_box/music_box_reaction.py
music_box/music_box_reaction_list.py
music_box/music_box_reaction_rate.py
music_box/music_box_species.py
music_box/music_box_species_concentration.py
music_box/music_box_species_list.py
music_box/utils.py
music_box.egg-info/PKG-INFO
music_box.egg-info/SOURCES.txt
music_box.egg-info/dependency_links.txt
music_box.egg-info/top_level.txt
1 change: 1 addition & 0 deletions src/music_box.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions src/music_box.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
music_box
File renamed without changes.
14 changes: 14 additions & 0 deletions src/music_box/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from .utils import convert_time, convert_pressure, convert_temperature, convert_concentration
from .music_box_species import Species
from .music_box_product import Product
from .music_box_reactant import Reactant
from .music_box_reaction import Reaction, Branched, Arrhenius, Tunneling, Troe_Ternary
from .music_box_species_list import SpeciesList
from .music_box_model_options import BoxModelOptions
from .music_box_species_concentration import SpeciesConcentration
from .music_box_reaction_rate import ReactionRate
from .music_box_conditions import Conditions

from .music_box_evolving_conditions import EvolvingConditions
from .music_box import MusicBox

36 changes: 7 additions & 29 deletions src/box_model.py → src/music_box/music_box.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import json
import os

from music_box_evolving_conditions import EvolvingConditions
from music_box_reaction_list import ReactionList
from music_box_reaction import Reaction, Branched, Arrhenius, Tunneling, Troe_Ternary
from music_box_reactant import Reactant
from music_box_product import Product
from music_box_species_list import SpeciesList
from music_box_species import Species
from music_box_model_options import BoxModelOptions
from music_box_conditions import Conditions
from music_box_species_concentration import SpeciesConcentration
from music_box_reaction_rate import ReactionRate
from .music_box_evolving_conditions import EvolvingConditions
from .music_box_reaction_list import ReactionList
from .music_box_reaction import Reaction, Branched, Arrhenius, Tunneling, Troe_Ternary
from .music_box_species_list import SpeciesList
from .music_box_model_options import BoxModelOptions
from .music_box_conditions import Conditions
import csv
import musica

class BoxModel:
class MusicBox:
"""
Represents a box model with attributes such as box model options, species list, reaction list,
initial conditions, and evolving conditions.
Expand Down Expand Up @@ -571,20 +566,3 @@ def order_species_concentrations(self, curr_conditions, species_constant_orderin
return ordered_concentrations



# for testing purposes
def __main__():
# Create a new instance of the BoxModel class.
box_model = BoxModel()

# Read the box model configuration from a json file.
box_model.readFromUIJson("../chapman.json")

# Generate configuration JSON for the box model simulation.
box_model.generateConfig("UI_test")




if __name__ == "__main__":
__main__()
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import List
from music_box_reaction_rate import ReactionRate
from music_box_species import Species
from music_box_species_concentration import SpeciesConcentration
import utils
from .music_box_reaction_rate import ReactionRate
from .music_box_species import Species
from .music_box_species_concentration import SpeciesConcentration
from .utils import convert_time, convert_pressure, convert_temperature, convert_concentration


class Conditions:
"""
Expand Down Expand Up @@ -42,17 +43,17 @@ def from_UI_JSON(cls, UI_JSON, species_list, reaction_list):
Returns:
Conditions: A new instance of the Conditions class.
"""
pressure = utils.convert_pressure(UI_JSON['conditions']['environmental conditions']['pressure'], 'initial value')
pressure = convert_pressure(UI_JSON['conditions']['environmental conditions']['pressure'], 'initial value')

temperature = utils.convert_temperature(UI_JSON['conditions']['environmental conditions']['temperature'], 'initial value')
temperature = convert_temperature(UI_JSON['conditions']['environmental conditions']['temperature'], 'initial value')

# Set initial species concentrations
species_concentrations = []
for chem_spec in UI_JSON['conditions']['chemical species']:
match = filter(lambda x: x.name == chem_spec, species_list.species)
species = next(match, None)

concentration = utils.convert_concentration(UI_JSON['conditions']['chemical species'][chem_spec], 'initial value')
concentration = convert_concentration(UI_JSON['conditions']['chemical species'][chem_spec], 'initial value')

species_concentrations.append(SpeciesConcentration(species, concentration))

Expand All @@ -76,9 +77,9 @@ def from_UI_JSON(cls, UI_JSON, species_list, reaction_list):

@classmethod
def from_config_JSON(cls, config_JSON, species_list, reaction_list):
pressure = utils.convert_pressure(config_JSON['environmental conditions']['pressure'], 'initial value')
pressure = convert_pressure(config_JSON['environmental conditions']['pressure'], 'initial value')

temperature = utils.convert_temperature(config_JSON['environmental conditions']['temperature'], 'initial value')
temperature = convert_temperature(config_JSON['environmental conditions']['temperature'], 'initial value')


# Set initial species concentrations
Expand All @@ -93,7 +94,7 @@ def from_config_JSON(cls, config_JSON, species_list, reaction_list):
if 'chemical species' in config_JSON:
for chem_spec in config_JSON['chemical species']:
species = Species(name = chem_spec)
concentration = utils.convert_concentration(config_JSON['chemical species'][chem_spec], 'initial value')
concentration = convert_concentration(config_JSON['chemical species'][chem_spec], 'initial value')

species_concentrations.append(SpeciesConcentration(species, concentration))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import csv
import os
from typing import List
from music_box_conditions import Conditions
from music_box_species_concentration import SpeciesConcentration
from music_box_reaction_rate import ReactionRate
from .music_box_conditions import Conditions
from .music_box_species_concentration import SpeciesConcentration
from .music_box_reaction_rate import ReactionRate


class EvolvingConditions:
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import utils
from .utils import convert_time, convert_pressure, convert_temperature, convert_concentration


class BoxModelOptions:
"""
Expand Down Expand Up @@ -37,9 +38,9 @@ def from_UI_JSON(cls, UI_JSON):
Returns:
BoxModelOptions: A new instance of the BoxModelOptions class.
"""
chem_step_time = utils.convert_time(UI_JSON['conditions']['box model options'], 'chemistry time step')
output_step_time = utils.convert_time(UI_JSON['conditions']['box model options'], 'output time step')
simulation_length = utils.convert_time(UI_JSON['conditions']['box model options'], 'simulation length')
chem_step_time = convert_time(UI_JSON['conditions']['box model options'], 'chemistry time step')
output_step_time = convert_time(UI_JSON['conditions']['box model options'], 'output time step')
simulation_length = convert_time(UI_JSON['conditions']['box model options'], 'simulation length')

grid = UI_JSON['conditions']['box model options']['grid']

Expand All @@ -49,9 +50,9 @@ def from_UI_JSON(cls, UI_JSON):
@classmethod
def from_config_JSON(cls, config_JSON):

chem_step_time = utils.convert_time(config_JSON['box model options'], 'chemistry time step')
output_step_time = utils.convert_time(config_JSON['box model options'], 'output time step')
simulation_length = utils.convert_time(config_JSON['box model options'], 'simulation length')
chem_step_time = convert_time(config_JSON['box model options'], 'chemistry time step')
output_step_time = convert_time(config_JSON['box model options'], 'output time step')
simulation_length = convert_time(config_JSON['box model options'], 'simulation length')

grid = config_JSON['box model options']['grid']

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import json
from typing import List
from music_box_reaction import Reaction, Branched, Arrhenius, Tunneling, Troe_Ternary
from music_box_reactant import Reactant
from music_box_product import Product
from .music_box_reaction import Reaction, Branched, Arrhenius, Tunneling, Troe_Ternary
from .music_box_reactant import Reactant
from .music_box_product import Product

class ReactionList:
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import os
from typing import List
from music_box_species import Species
from .music_box_species import Species

class SpeciesList:
"""
Expand Down
File renamed without changes.
Loading

0 comments on commit 81b820b

Please sign in to comment.