-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from IGITUGraz/ArbitraryOutputDirs
Make it necessary to specify the output directory to SimManager. the earlier directory name can be created using the 'make_param_string'. Additional changes: imported tools within the __init__.py of the tools package make optional arguments compulsory keyword arguments
- Loading branch information
Showing
6 changed files
with
36 additions
and
34 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import os | ||
|
||
from ._utils import make_param_string | ||
from .tools import make_param_string | ||
|
||
__author__ = 'anand' | ||
|
||
|
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,5 @@ | ||
from .timer import Timer | ||
from .stdouthandling import stdout_teed | ||
from .stdouthandling import stdout_redirected | ||
from .stdouthandling import stdout_discarded | ||
from .params import make_param_string |
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,18 @@ | ||
def make_param_string(delimiter='-', **kwargs): | ||
""" | ||
Takes a dictionary and constructs a string of the form key1-val1-key2-val2-... (denoted here as {key-val*}) | ||
The keys are alphabetically sorted | ||
:param str delimiter: Delimiter to use (default is '-') | ||
:param dict kwargs: A python dictionary | ||
:return: | ||
""" | ||
string_list = [] | ||
for key, value in sorted(kwargs.items()): | ||
string_list.append(key) | ||
if isinstance(value, float): | ||
value_string = "{:.2f}".format(value) | ||
else: | ||
value_string = "{}".format(value) | ||
string_list.append(value_string) | ||
param_string = delimiter.join(string_list) | ||
return param_string |