-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python main() is producing valid floating-point output.
- Loading branch information
1 parent
652fe37
commit 5e5b6be
Showing
7 changed files
with
83 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cd ..\.. | ||
pip install . | ||
cd src\acom_music_box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import sys | ||
|
||
# Class Logger is included here for completeness, | ||
# but not used because progress() is such a lighweight function. | ||
class Logger: | ||
""" | ||
Logs messages to the console, which can then be captured to a log file. | ||
Attributes: | ||
""" | ||
|
||
def __init__(self): | ||
""" | ||
Initializes a new instance of the Reaction class. | ||
Args: | ||
name (str): The name of the reaction. | ||
reaction_type (str): The type of the reaction. | ||
reactants (List[Reactant]): A list of Reactant instances representing the reactants. Default is an empty list. | ||
products (List[Product]): A list of Product instances representing the products. Default is an empty list. | ||
scaling_factor (float, optional): A scaling factor for the reaction rate. Defaults to None. | ||
""" | ||
pass | ||
|
||
|
||
|
||
# Display progress message on the console. | ||
# endString = set this to '' for no return | ||
def progress(message, endString='\n'): | ||
if (True): # disable here in production | ||
print(message, end=endString) | ||
sys.stdout.flush() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
from acom_music_box import MusicBox | ||
|
||
import math | ||
import datetime | ||
import sys | ||
|
||
import music_box_logger | ||
|
||
|
||
# Display progress message on the console. | ||
# endString = set this to '' for no return | ||
def progress(message, endString='\n'): | ||
if (True): # disable here in production | ||
print(message, end=endString) | ||
sys.stdout.flush() | ||
|
||
if __name__ == "__main__": | ||
music_box_logger.progress("{}".format(__file__)) | ||
music_box_logger.progress("Start time: {}".format(datetime.datetime.now())) | ||
|
||
music_box_logger.progress("Hello, MusicBox World!") | ||
|
||
# set up the home configuration directory TODO: Make this a command-line argument. | ||
musicBoxHomeDir = "C:\\2024\\MusicBox\\music-box\\tests\\configs\\analytical_config\\" | ||
|
||
# create and load a MusicBox object | ||
myBox = MusicBox() | ||
myBox.readConditionsFromJson(musicBoxHomeDir + "my_config.json") | ||
music_box_logger.progress("myBox = {}".format(myBox)) | ||
|
||
# create solver and solve | ||
myBox.create_solver(musicBoxHomeDir + myBox.config_file) | ||
mySolution = myBox.solve() | ||
music_box_logger.progress("mySolution = {}".format(mySolution)) | ||
|
||
if __name__ == "__main__": | ||
progress("Hello, MusicBox World!") | ||
music_box_logger.progress("End time: {}".format(datetime.datetime.now())) | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pytest |