@@ -0,0 +1,34 | |||
|
1 | from schainpy.controller import Project | |
|
2 | ||
|
3 | desc = "asdasddsad" | |
|
4 | ||
|
5 | controller = Project() | |
|
6 | controller.setup(id='191', name="asdasd", description=desc) | |
|
7 | ||
|
8 | readUnitConf = controller.addReadUnit(datatype='VoltageReader', | |
|
9 | path="/home/nanosat/schain/schain-cli", | |
|
10 | startDate="1970/01/01", | |
|
11 | endDate="2017/12/31", | |
|
12 | startTime="00:00:00", | |
|
13 | endTime="23:59:59", | |
|
14 | online=0, | |
|
15 | verbose=1, | |
|
16 | walk=1, | |
|
17 | ) | |
|
18 | ||
|
19 | procUnitConf1 = controller.addProcUnit(datatype='VoltageProc', inputId=readUnitConf.getId()) | |
|
20 | ||
|
21 | opObj11 = procUnitConf1.addOperation(name='ProfileSelector', optype='other') | |
|
22 | opObj11.addParameter(name='profileRangeList', value='120,183', format='intlist') | |
|
23 | ||
|
24 | opObj11 = procUnitConf1.addOperation(name='RTIPlot', optype='other') | |
|
25 | opObj11.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str') | |
|
26 | opObj11.addParameter(name='showprofile', value='0', format='int') | |
|
27 | opObj11.addParameter(name='xmin', value='0', format='int') | |
|
28 | opObj11.addParameter(name='xmax', value='24', format='int') | |
|
29 | opObj11.addParameter(name='figpath', value="/home/nanosat/schain/schain-cli/figs", format='str') | |
|
30 | opObj11.addParameter(name='wr_period', value='5', format='int') | |
|
31 | opObj11.addParameter(name='exp_code', value='22', format='int') | |
|
32 | ||
|
33 | ||
|
34 | controller.start() |
@@ -0,0 +1,33 | |||
|
1 | from schainpy.controller import Project | |
|
2 | ||
|
3 | desc = "A schain project" | |
|
4 | ||
|
5 | controller = Project() | |
|
6 | controller.setup(id='191', name="project", description=desc) | |
|
7 | ||
|
8 | readUnitConf = controller.addReadUnit(datatype='VoltageReader', | |
|
9 | path="/home/nanosat/schain/schainpy/scripts", | |
|
10 | startDate="1970/01/01", | |
|
11 | endDate="2017/12/31", | |
|
12 | startTime="00:00:00", | |
|
13 | endTime="23:59:59", | |
|
14 | online=0, | |
|
15 | walk=1, | |
|
16 | ) | |
|
17 | ||
|
18 | procUnitConf1 = controller.addProcUnit(datatype='VoltageProc', inputId=readUnitConf.getId()) | |
|
19 | ||
|
20 | opObj11 = procUnitConf1.addOperation(name='ProfileSelector', optype='other') | |
|
21 | opObj11.addParameter(name='profileRangeList', value='120,183', format='intlist') | |
|
22 | ||
|
23 | opObj11 = procUnitConf1.addOperation(name='RTIPlot', optype='other') | |
|
24 | opObj11.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str') | |
|
25 | opObj11.addParameter(name='showprofile', value='0', format='int') | |
|
26 | opObj11.addParameter(name='xmin', value='0', format='int') | |
|
27 | opObj11.addParameter(name='xmax', value='24', format='int') | |
|
28 | opObj11.addParameter(name='figpath', value="/home/nanosat/schain/schainpy/scripts/figs", format='str') | |
|
29 | opObj11.addParameter(name='wr_period', value='5', format='int') | |
|
30 | opObj11.addParameter(name='exp_code', value='22', format='int') | |
|
31 | ||
|
32 | ||
|
33 | controller.start() |
@@ -1,1 +1,1 | |||
|
1 | <Project description="A schain project" id="191" name="project"><ReadUnit datatype="VoltageReader" id="1911" inputId="0" name="VoltageReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="VoltageReader" /><Parameter format="str" id="191112" name="path" value="/home/nanosat/schain/schain-cli" /><Parameter format="date" id="191113" name="startDate" value="1970/01/01" /><Parameter format="date" id="191114" name="endDate" value="2017/12/31" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="online" value="0" /><Parameter format="int" id="191119" name="walk" value="1" /></Operation></ReadUnit><ProcUnit datatype="SpectraProc" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="ProfileSelector" priority="2" type="other"><Parameter format="intlist" id="191221" name="profileRangeList" value="120,183" /></Operation><Operation id="19123" name="RTIPlot" priority="3" type="other"><Parameter format="int" id="191231" name="id" value="101" /><Parameter format="str" id="191232" name="wintitle" value="Jicamarca Radio Observatory" /><Parameter format="int" id="191233" name="showprofile" value="0" /><Parameter format="int" id="191234" name="xmin" value="0" /><Parameter format="int" id="191235" name="xmax" value="24" /><Parameter format="str" id="191236" name="figpath" value="/home/nanosat/schain/schain-cli/figs" /><Parameter format="int" id="191237" name="wr_period" value="5" /><Parameter format="int" id="191238" name="exp_code" value="22" /></Operation></ProcUnit></Project> No newline at end of file | |
|
1 | <Project description="A schain project" id="191" name="project"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/home/nanosat/schain/schain-cli" /><Parameter format="date" id="191113" name="startDate" value="1970/01/01" /><Parameter format="date" id="191114" name="endDate" value="1970/01/01" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="cursor" value="0" /><Parameter format="int" id="191119" name="skip" value="0" /><Parameter format="int" id="191120" name="walk" value="1" /><Parameter format="int" id="191121" name="verbose" value="1" /><Parameter format="int" id="191122" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="ParametersProc" id="1913" inputId="1911" name="ParametersProc"><Operation id="19131" name="run" priority="1" type="self" /><Operation id="19132" name="SpectralMoments" priority="2" type="other" /><Operation id="19133" name="PublishData" priority="3" type="other"><Parameter format="int" id="191331" name="zeromq" value="1" /><Parameter format="bool" id="191332" name="verbose" value="0" /></Operation></ProcUnit><ProcUnit datatype="Spectra" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /></ProcUnit></Project> No newline at end of file |
@@ -3,7 +3,9 import schainpy | |||
|
3 | 3 | import subprocess |
|
4 | 4 | from multiprocessing import cpu_count |
|
5 | 5 | from schaincli import templates |
|
6 |
import os |
|
|
6 | import os | |
|
7 | import sys | |
|
8 | import glob | |
|
7 | 9 | |
|
8 | 10 | def print_version(ctx, param, value): |
|
9 | 11 | if not value or ctx.resilient_parsing: |
@@ -14,9 +16,10 def print_version(ctx, param, value): | |||
|
14 | 16 | |
|
15 | 17 | @click.command() |
|
16 | 18 | @click.option('--version', '-v', is_flag=True, callback=print_version, help='SChain version', type=str) |
|
17 |
@click.option('--xml', '-x', default=None, help=' |
|
|
19 | @click.option('--xml', '-x', default=None, help='run an XML file', type=click.Path(exists=True, resolve_path=True)) | |
|
18 | 20 | @click.argument('command', default='run', required=True) |
|
19 | def main(command, version, xml): | |
|
21 | @click.argument('nextcommand', default=None, required=False, type=click.Path(exists=True, resolve_path=True)) | |
|
22 | def main(command, nextcommand, version, xml): | |
|
20 | 23 | """COMMAND LINE INTERFACE FOR SIGNAL CHAIN - JICAMARCA RADIO OBSERVATORY""" |
|
21 | 24 | if xml is not None: |
|
22 | 25 | subprocess.call(['schain --file=' + xml], shell=True) |
@@ -24,8 +27,21 def main(command, version, xml): | |||
|
24 | 27 | generate() |
|
25 | 28 | elif command == 'test': |
|
26 | 29 | test() |
|
30 | elif command == 'run': | |
|
31 | if nextcommand is None: | |
|
32 | currentfiles = glob.glob('./*.py') | |
|
33 | numberfiles = len(currentfiles) | |
|
34 | print currentfiles | |
|
35 | if numberfiles > 1: | |
|
36 | click.echo('\x1b[6;37;41m[ERROR] - There is more than one file to run\x1b[0m') | |
|
37 | elif numberfiles == 1: | |
|
38 | subprocess.call(['python ' + currentfiles[0]], shell=True) | |
|
27 | 39 | else: |
|
28 |
click.echo('\x1b[ |
|
|
40 | click.echo('\x1b[6;37;41m[ERROR] - There is no file to run.\x1b[0m') | |
|
41 | else: | |
|
42 | subprocess.call(['python ' + nextcommand], shell=True) | |
|
43 | else: | |
|
44 | click.echo('\x1b[6;37;41m[ERROR] - Command is not defined.\x1b[0m') | |
|
29 | 45 | |
|
30 | 46 | def basicInputs(): |
|
31 | 47 | inputs = {} |
@@ -51,9 +67,9 def generate(): | |||
|
51 | 67 | script = open(scriptname, 'w') |
|
52 | 68 | try: |
|
53 | 69 | script.write(current) |
|
54 |
click.echo('\x1b[ |
|
|
70 | click.echo('\x1b[6;37;42m[SUCCESS] Script {file} generated\x1b[0m'.format(file=scriptname)) | |
|
55 | 71 | except Exception as e: |
|
56 |
click.echo('\x1b[ |
|
|
72 | click.echo('\x1b[6;37;41m[ERROR] I cannot create the file. Do you have writing permissions?\x1b[0m') | |
|
57 | 73 | |
|
58 | 74 | |
|
59 | 75 | def test(): |
General Comments 0
You need to be logged in to leave comments.
Login now