-
Notifications
You must be signed in to change notification settings - Fork 9
Develop: update to result folder naming #53
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5a917e0
Updated Linux version for testing
ThomasReisser90 0812ad6
Removed older Python versions for testing that are not supported anymore
ThomasReisser90 7d3388a
Corrected typo in warning messages
ThomasReisser90 c0e476f
Added microseconds to result folder name to avoid name duplicates and…
ThomasReisser90 e1dacef
Added timeout to join of thread
ThomasReisser90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,3 +1,3 @@ | ||
| from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
|
||
| __VERSION__ = "0.0.63" | ||
| __VERSION__ = "0.0.64" | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,66 @@ | ||
| from quocslib.utils.AbstractFoM import AbstractFoM | ||
| from quocslib.utils.inputoutput import readjson | ||
| from quocslib.Optimizer import Optimizer | ||
| from scipy.optimize import rosen | ||
| import numpy as np | ||
| import os | ||
| import pytest | ||
| import threading | ||
|
|
||
|
|
||
| class RosenFoM(AbstractFoM): | ||
| def __init__(self, args_dict: dict = None): | ||
| if args_dict is None: | ||
| args_dict = {} | ||
|
|
||
| self.FoM_list = [] | ||
| self.param_list = [] | ||
| self.save_path = "" | ||
|
|
||
| def save_FoM(self): | ||
| np.savetxt(os.path.join(self.save_path, 'FoM.txt'), self.FoM_list) | ||
| np.savetxt(os.path.join(self.save_path, 'params.txt'), self.param_list) | ||
|
|
||
| def set_save_path(self, save_path: str = ""): | ||
| self.save_path = save_path | ||
|
|
||
| def get_FoM(self, pulses: list = [], parameters: list = [], timegrids: list = []) -> dict: | ||
|
|
||
| FoM = rosen(np.asarray(parameters)) | ||
|
|
||
| self.FoM_list.append(FoM) | ||
| self.param_list.append(parameters) | ||
|
|
||
| return {"FoM": FoM} | ||
|
|
||
|
|
||
| def main(optimization_dictionary: dict): | ||
|
|
||
| FoM_object = RosenFoM() | ||
|
|
||
| optimization_obj = Optimizer(optimization_dictionary, FoM_object) | ||
|
|
||
| FoM_object.set_save_path(optimization_obj.results_path) | ||
|
|
||
| optimization_obj.execute() | ||
|
|
||
| FoM_object.save_FoM() | ||
|
|
||
|
|
||
| def test_parameter_optimization(): | ||
| # get the optimization settings from the json dictionary | ||
| folder = os.path.dirname(os.path.realpath(__file__)) | ||
| optimization_dictionary = readjson(os.path.join(folder, "opt_Rosen_NM.json")) | ||
| opt_dict_1 = optimization_dictionary.copy() | ||
| opt_dict_2 = optimization_dictionary.copy() | ||
| opt_dict_1["optimization_client_name"] = "Check_quick_parallel_job_1" | ||
| opt_dict_2["optimization_client_name"] = "Check_quick_parallel_job_2" | ||
|
|
||
| t1 = threading.Thread(target=main, args=(opt_dict_1, )) | ||
| t2 = threading.Thread(target=main, args=(opt_dict_2, )) | ||
|
|
||
| t1.start() | ||
| t2.start() | ||
|
|
||
| t1.join(timeout=10) | ||
| t2.join(timeout=10) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lloks good to me