Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added max_time to calibration settings #56

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

jkriwet
Copy link
Contributor

@jkriwet jkriwet commented Apr 5, 2024

Added functionality to set a maximum calibration time. Added general check for max_iteration and max_time and changed place of that, so that when using multiprocessing a termination is only done after the results of one multiprocessing round are evaluated, to not unnecessarily ignore finished results.

Closes #55

…r change, so that multiprocessing results are all evaluated and not unnecessarily stopped by either max_time or max_iterations
@jkriwet jkriwet requested a review from FWuellhorst April 5, 2024 15:21
@jkriwet jkriwet changed the title added max_time to calibration settings. also changed position of erro… added max_time to calibration settings Apr 5, 2024
Copy link
Collaborator

@FWuellhorst FWuellhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, only two comments. You can merge afterwards.


if time.perf_counter() - self.start_time > self.max_time:
raise MaxTimeReached(
f"Terminating calibration as the maximum time of {self.max_time}s has been "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace between number and unit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -113,6 +113,7 @@ def __init__(self,
self.perform_square_deviation = kwargs.pop("square_deviation", False)
self.result_path = kwargs.pop('result_path', None)
self.max_itercount = kwargs.pop('max_itercount', np.inf)
self.max_time = kwargs.pop('max_time', np.inf)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this to the docstring?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jkriwet jkriwet merged commit d6a2ac7 into master Apr 15, 2024
@jkriwet jkriwet deleted the 55-add-max-time-for-calibration branch April 15, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add max_time for calibration
2 participants