Skip to content

Commit

Permalink
Maybe fix history - result reconstruction mismatch (#902)
Browse files Browse the repository at this point in the history
* tidy up .flake8

* tidy up tox.ini

* add none-ness and close-ness utility functions

* extend constants file

* simplify+doc test/base/test_store

* simplify pypest/optimize: suffixes, error types

* declare history error types

* add typehints to fun/res conversion functions

* minor edits pypest/objective/base

* fix history/optimizer result mismatch

* fixup

* python 3.8 does not conform

* Update pypesto/objective/util.py

Co-authored-by: Fabian Fröhlich <fabian_froehlich@hms.harvard.edu>

* Update pypesto/objective/util.py

Co-authored-by: Fabian Fröhlich <fabian_froehlich@hms.harvard.edu>

* apply suggestions from code review

* increase timeout

* flake8 seems to be tmp slow

Co-authored-by: Fabian Fröhlich <fabian_froehlich@hms.harvard.edu>
  • Loading branch information
yannikschaelte and Fabian Fröhlich authored Aug 1, 2022
1 parent 6529d4d commit cdb6d28
Show file tree
Hide file tree
Showing 13 changed files with 589 additions and 376 deletions.
12 changes: 8 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ extend-ignore =
E203
# Don't be crazy if line too long
E501
# Missing docstring in public module
D100
# Missing docstring in public method
# D102
# Missing docstring in magic method
D105
# Missing docstring in __init__
D107

per-file-ignores =
# Imported but unused
Expand All @@ -20,7 +28,3 @@ per-file-ignores =
pypesto/problem.py:D400,D205,D107
pypesto/util.py:D400,D205,D107
pypesto/C.py:D400,D205,D107
pypesto/version.py:D
# ignore D100='Missing docstring in public module',
# D105='Missing docstring in magic method' and D107='Missing docstring in __init__'.
*:D100,D105,D107
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: .github/workflows/install_deps.sh amici

- name: Run tests
timeout-minutes: 12
timeout-minutes: 15
run: tox -e base

- name: Coverage
Expand Down Expand Up @@ -176,7 +176,7 @@ jobs:
run: tox -e size

- name: Run quality checks
timeout-minutes: 1
timeout-minutes: 5
run: tox -e project,flake8

- name: Run pre-commit hooks
Expand Down
19 changes: 16 additions & 3 deletions pypesto/C.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,21 @@
X0 = 'x0'
ID = 'id'

EXITFLAG = 'exitflag'
MESSAGE = 'message'

###############################################################################
# HISTORY

HISTORY = "history"
TRACE = "trace"
N_ITERATIONS = "n_iterations"
MESSAGES = "messages"
MESSAGE = "message"
EXITFLAG = "exitflag"
TRACE_SAVE_ITER = "trace_save_iter"

SUFFIXES_CSV = ["csv"]
SUFFIXES_HDF5 = ["hdf5", "h5"]
SUFFIXES = SUFFIXES_CSV + SUFFIXES_HDF5


###############################################################################
Expand Down Expand Up @@ -166,7 +179,7 @@ class EnsembleType(Enum):


###############################################################################
# Environment variables
# ENVIRONMENT VARIABLES

PYPESTO_MAX_N_STARTS: str = "PYPESTO_MAX_N_STARTS"
PYPESTO_MAX_N_SAMPLES: str = "PYPESTO_MAX_N_SAMPLES"
2 changes: 2 additions & 0 deletions pypesto/objective/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
from .function import Objective
from .history import (
CsvHistory,
CsvHistoryTemplateError,
Hdf5History,
History,
HistoryBase,
HistoryOptions,
HistoryTypeError,
MemoryHistory,
OptimizerHistory,
)
Expand Down
5 changes: 1 addition & 4 deletions pypesto/objective/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ def call_unprocessed(
result:
A dict containing the results.
"""
raise NotImplementedError()

def check_mode(self, mode: ModeType) -> bool:
"""
Expand Down Expand Up @@ -405,15 +404,13 @@ def update_from_problem(
Vector of the same length as x_fixed_indices, containing the values
of the fixed parameters.
"""
pre_post_processor = FixedParametersProcessor(
self.pre_post_processor = FixedParametersProcessor(
dim_full=dim_full,
x_free_indices=x_free_indices,
x_fixed_indices=x_fixed_indices,
x_fixed_vals=x_fixed_vals,
)

self.pre_post_processor = pre_post_processor

def check_grad_multi_eps(
self,
*args,
Expand Down
Loading

0 comments on commit cdb6d28

Please sign in to comment.