Skip to content

Commit

Permalink
Merge pull request #9 from fotobiolab-unb/optim
Browse files Browse the repository at this point in the history
Updating with new optimization feature
  • Loading branch information
icarosadero authored Apr 14, 2024
2 parents f239213 + 39ce2df commit 99c8c08
Show file tree
Hide file tree
Showing 21 changed files with 839 additions and 275 deletions.
170 changes: 170 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

logs/

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.env.local
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
.vscode/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

cache.csv
log/
calibrate/
experiment.py
nohup.out
File renamed without changes.
File renamed without changes.
11 changes: 10 additions & 1 deletion pyduino/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import logging
import os
from dotenv import load_dotenv

load_dotenv()
load_dotenv(dotenv_path=".env.local")

log_file_path = os.environ.get('PYDUINO_SLAVE_LOG','/var/log/pyduino/slave.log')
os.makedirs(os.path.dirname(log_file_path), exist_ok=True)

logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(message)s',
handlers=[
logging.FileHandler('/var/log/pyduino/slave.log'),
logging.FileHandler(log_file_path),
logging.StreamHandler()
]
)
84 changes: 21 additions & 63 deletions pyduino/config.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,25 @@
hyperparameters:
reset_density: true #Whether or not to use gotod
log_name: "ga_dcte2400_branco_15" #Log folder name (delete to use the default)
f_param: efficiency #Parameter to read as fitness from the reactors
log_name: "free_growth_test_2024_04_07" #Log folder name (delete to use the default)
density_param: DensidadeAtual #Parameter name for density counts
mutation_probability: 0.01 #0.15
maximize: true
resolution: 4 #Number of bits used for each parameter
elitism: true #Whether or not to use elitism
do_crossover: false #Whether or not to perform crossover when the genetic algorithm is enabled
rng_seed: 2 #Random seed for genetic algorithm
maximize: false
rng_seed: 2 #Random seed parameter initialization
ranges:
# brilho:
# - 0
# - 100
branco:
- 1
#- 100
- 19
full:
- 100
others:
- 0
#- 100
- 17
"440":
- 0
#- 100
- 26
"470":
- 0
#- 100
- 24
"495":
- 0
#- 100
- 24
"530":
- 0
#- 100
- 24
"595":
- 0
#- 100
- 92
"634":
- 0
#- 100
- 58
"660":
- 0
#- 100
- 44
"684":
- 0
#- 100
- 35
#others:
# - 0
# - 100
- 100
slave:
port: "5000" #Must be a string
network: "192.168.1.1/24"
exclude: "192.168.1.112"
exclude: #"192.168.1.112"
system:
initial_state: "preset_state.d/no4.csv"
initial_state: "preset_state.d/all.csv"
reboot_wait_time: 5 #Time in seconds to wait after a reboot.
relevant_parameters:
# - brilho
Expand Down Expand Up @@ -116,7 +74,7 @@ system:
co2: int
dtco2: int
dash:
glob: "./log/pre_free1212_branco_3/*.csv"
glob: "./log/nelder_mead_power_test/*.csv"
plot:
-
name: Temperature
Expand All @@ -132,18 +90,18 @@ dash:
name: Density
cols:
DensidadeAtual:
-
name: Efficiency
cols:
efficiency:
growing_only: true
#mode: 'lines+markers'
-
name: GrowthRate
cols:
growth_rate:
growing_only: true
#mode: 'lines+markers'
# -
# name: Efficiency
# cols:
# efficiency:
# growing_only: true
# #mode: 'lines+markers'
# -
# name: GrowthRate
# cols:
# growth_rate:
# growing_only: true
# #mode: 'lines+markers'
-
name: power
cols:
Expand Down
2 changes: 1 addition & 1 deletion pyduino/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
NROWSDF = y["tail"]
if len(LOG_PATH)!=0:
with open(LOG_PATH[0]) as file:
HEAD = pd.read_csv(io.StringIO(''.join([file.readline() for _ in range(2)])),sep=SEP)
HEAD = pd.read_csv(io.StringIO(''.join([file.readline() for _ in range(1)])),sep=SEP)
print(HEAD)
HEAD = HEAD.columns
else:
Expand Down
Loading

0 comments on commit 99c8c08

Please sign in to comment.