-
Notifications
You must be signed in to change notification settings - Fork 13
Development #14
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
Development #14
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
dfb5780
Update for new version of hydra
gjbex 0b60599
Add trivial debug script
gjbex a6aad48
Fix command
gjbex 9cff20a
Add hydra to environment
gjbex 119d626
Fix hydra version issue for pretty-printing
gjbex 8ca42d6
Fix logging
gjbex b6a759e
Remove verbose flag
gjbex d2c7d99
Add alternative configuration file
gjbex 577de8f
Add example of multirun
gjbex b279646
Add example of showing configuration settings
gjbex b8a45e5
Improve formatting
gjbex 9b41ab4
Eliminate exception at process end
gjbex bc741b9
Various fixes
gjbex c485d5b
Merge branch 'development' of github.com:gjbex/Python-for-systems-pro…
gjbex b3c336c
Add branding
gjbex fe15fc1
Update for sh 2.x
gjbex 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
Binary file not shown.
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 | ||||
---|---|---|---|---|---|---|
|
@@ -6,6 +6,7 @@ in the context of scientific software. | |||||
It support configuration file handling, command line arguments, logging, | ||||||
multiruns and so on. | ||||||
|
||||||
|
||||||
## What is it? | ||||||
|
||||||
1. `gen_rand.py`: Python script to write random numbers to standard | ||||||
|
@@ -14,23 +15,50 @@ multiruns and so on. | |||||
1. `config.yaml`: configuration file with the defaults. | ||||||
1. `distr/gauss.yaml`: configuration file for the Gaussian distirubtion. | ||||||
1. `distr/uniform.yaml`: configuration file for the uniform distirubtion. | ||||||
1. `file_config.yaml`: configuration file with the output file name. | ||||||
1. `debug.py`: Python script that simply prints the configuration settings for | ||||||
debugging purposes. | ||||||
|
||||||
|
||||||
## How to use it? | ||||||
|
||||||
Run with configuratino file settings: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (typo): Typo: "configuratino" should be "configuration"
Suggested change
|
||||||
```bash | ||||||
$ ./gen_rand.py | ||||||
``` | ||||||
|
||||||
To increase the number of random values: | ||||||
```bash | ||||||
$ ./gen_rand.py 10 | ||||||
$ ./gen_rand.py n=10 | ||||||
``` | ||||||
|
||||||
To use a uniform distribution: | ||||||
```bash | ||||||
$ ./gen_rand.py distr=uniform | ||||||
$ ./gen_rand.py distr=uniform | ||||||
``` | ||||||
|
||||||
To use a uniform distribution between -1 and 0: | ||||||
```bash | ||||||
$ ./gen_rand.py distr=uniform distr.a=-1.0 distr.b=0.0 | ||||||
$ ./gen_rand.py distr=uniform distr.a=-1.0 distr.b=0.0 | ||||||
``` | ||||||
|
||||||
To use a different configuration file: | ||||||
```bash | ||||||
$ ./gen_rand.py -cn file_config.yaml | ||||||
``` | ||||||
or | ||||||
```bash | ||||||
$ ./gen_rand.py --config-name=file_config.yaml | ||||||
``` | ||||||
|
||||||
To perform multiple runs with different parameter values: | ||||||
```bash | ||||||
$ ./gen_rand.py -m distr=uniform,gauss | ||||||
``` | ||||||
Note that if multiple parameters are to be varied, the Cartesian product of | ||||||
the values will be used. | ||||||
|
||||||
To view the configuration settings, e.g., for debugging: | ||||||
```bash | ||||||
$ ./gen_rand.py --cfg=job distr=uniform | ||||||
``` |
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,4 +1,5 @@ | ||
verbose: False | ||
n: 1 | ||
file: false | ||
defaults: | ||
- distr: gauss | ||
- distr: gauss | ||
- _self_ |
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,4 +1,3 @@ | ||
distr: | ||
name: gauss | ||
mu: 0.0 | ||
sigma: 1.0 | ||
name: gauss | ||
mu: 0.0 | ||
sigma: 1.0 |
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,4 +1,3 @@ | ||
distr: | ||
name: uniform | ||
a: 0.0 | ||
b: 1.0 | ||
name: uniform | ||
a: 0.0 | ||
b: 1.0 |
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,8 @@ | ||
hydra: | ||
job: | ||
chdir: true | ||
n: 1 | ||
file: output.txt | ||
defaults: | ||
- distr: gauss | ||
- _self_ |
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,11 @@ | ||
#!/usr/bin/env python | ||
|
||
from omegaconf import DictConfig, OmegaConf | ||
import hydra | ||
|
||
@hydra.main(version_base=None, config_path='conf/', config_name='config') | ||
def my_app(cfg): | ||
print(OmegaConf.to_yaml(cfg)) | ||
|
||
if __name__ == '__main__': | ||
my_app() |
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
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.
issue (typo): Typo: "distirubtion" should be "distribution"
Suggested implementation: