-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create test/tutorial via cli, always install tests
- Loading branch information
Sergey Yakubov
committed
Apr 27, 2016
1 parent
6bf7556
commit ffc08df
Showing
12 changed files
with
100 additions
and
37 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
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,10 +1,12 @@ | ||
from project_commands import create_project | ||
from project_commands import create_project,create_test_project | ||
|
||
|
||
def set_arguments(parser): | ||
subparsers = parser.add_subparsers(title='project commands',help='') | ||
parser = subparsers.add_parser('create', help='create project') | ||
parser.add_argument('name',metavar='<name>',nargs=1,help='Project name') | ||
parser.set_defaults(func=create_project.process_args) | ||
parser = subparsers.add_parser('create-test', help='create test project') | ||
parser.set_defaults(func=create_test_project.process_args) | ||
|
||
|
62 changes: 62 additions & 0 deletions
62
Sources/python/SimEx/CLI/commands/project_commands/create_test_project.py
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,62 @@ | ||
|
||
import json | ||
import os | ||
|
||
import create_project | ||
|
||
|
||
def process_args(args): | ||
create_test_project() | ||
|
||
def prGreen(prt,newline=True): | ||
if (newline): | ||
print("\033[92m{}\033[00m" .format(prt)) | ||
else: | ||
print("\033[92m{}\033[00m" .format(prt)), | ||
|
||
def prCyan(prt,newline=True): | ||
if (newline): | ||
print("\033[96m{}\033[00m" .format(prt)) | ||
else: | ||
print("\033[96m{}\033[00m" .format(prt)), | ||
|
||
|
||
def runCommented(cmd,comment): | ||
prCyan('*'*80) | ||
prCyan(comment+':') | ||
prGreen(cmd) | ||
prCyan('*'*80) | ||
os.system(cmd) | ||
|
||
|
||
def create_test_project(): | ||
if os.listdir('.'): | ||
print('Cannot create test project, directory is not empty') | ||
return | ||
|
||
modules_to_test = ["XFELPhotonSource","XFELPhotonPropagator","XMDYNDemoPhotonMatterInteractor", | ||
"SingFELPhotonDiffractor","PerfectPhotonDetector","S2EReconstruction"] | ||
|
||
filestocopy = ["$SIMEX_TESTS/python/unittest/TestFiles/s2e.*","$SIMEX_TESTS/python/unittest/TestFiles/sample.h5", | ||
"$SIMEX_TESTS/python/unittest/TestFiles/FELsource_out.h5"] | ||
|
||
commands = [ | ||
["create project","simex project create test"], | ||
["print available modules","simex module avail"], | ||
["add modules to the project","simex module add "+' '.join(modules_to_test)], | ||
["print project modules","simex module list"], | ||
["make input dir and copy necessary files (not simex command)", | ||
"mkdir -p input/FELsource && cp "+ ' '.join(filestocopy)+" input" + \ | ||
" && mv input/FELsource_out.h5 input/FELsource"], | ||
["set module parameter","simex module set XFELPhotonSource input_path=input/FELsource"], | ||
["set another module parameter","simex module set S2EReconstruction EMC_Parameters:max_number_of_iterations=2"], | ||
] | ||
|
||
for cmd in commands: | ||
runCommented(cmd[1],cmd[0]) | ||
|
||
prCyan("Type",False),prGreen("simex run",False),prCyan("to start simulations") | ||
|
||
if __name__ == "__main__": | ||
import sys | ||
create_test_project() |
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
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