diff --git a/experiment_project.py b/experiment_project.py
new file mode 100644
index 0000000..5bb268a
--- /dev/null
+++ b/experiment_project.py
@@ -0,0 +1,34 @@
+from schainpy.controller import Project
+
+desc = "A schain project"
+
+controller = Project()
+controller.setup(id='191', name="project", description=desc)
+
+readUnitConf = controller.addReadUnit(datatype='VoltageReader',
+ path="/home/nanosat/schain",
+ startDate="1970/01/01",
+ endDate="2017/12/31",
+ startTime="00:00:00",
+ endTime="23:59:59",
+ online=0,
+ verbose=1,
+ walk=1,
+ )
+
+procUnitConf1 = controller.addProcUnit(datatype='VoltageProc', inputId=readUnitConf.getId())
+
+opObj11 = procUnitConf1.addOperation(name='ProfileSelector', optype='other')
+opObj11.addParameter(name='profileRangeList', value='120,183', format='intlist')
+
+opObj11 = procUnitConf1.addOperation(name='RTIPlot', optype='other')
+opObj11.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str')
+opObj11.addParameter(name='showprofile', value='0', format='int')
+opObj11.addParameter(name='xmin', value='0', format='int')
+opObj11.addParameter(name='xmax', value='24', format='int')
+opObj11.addParameter(name='figpath', value="/home/nanosat/schain/figs", format='str')
+opObj11.addParameter(name='wr_period', value='5', format='int')
+opObj11.addParameter(name='exp_code', value='22', format='int')
+
+
+controller.start()
diff --git a/schain.xml b/schain.xml
new file mode 100644
index 0000000..b67ac71
--- /dev/null
+++ b/schain.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/schaincli/README.md b/schaincli/README.md
new file mode 100644
index 0000000..ced14bb
--- /dev/null
+++ b/schaincli/README.md
@@ -0,0 +1,9 @@
+# schaing
+
+Command Line Interface for SIGNAL CHAIN - jro
+
+# Usage
+
+To use it:
+
+ $ schain-cli --help
diff --git a/schaincli/__init__.py b/schaincli/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/schaincli/__init__.py
diff --git a/schaincli/asdasd.py b/schaincli/asdasd.py
new file mode 100644
index 0000000..ca5629d
--- /dev/null
+++ b/schaincli/asdasd.py
@@ -0,0 +1,34 @@
+from schainpy.controller import Project
+
+desc = "asdasddsad"
+
+controller = Project()
+controller.setup(id='191', name="asdasd", description=desc)
+
+readUnitConf = controller.addReadUnit(datatype='VoltageReader',
+ path="/home/nanosat/schain/schain-cli",
+ startDate="1970/01/01",
+ endDate="2017/12/31",
+ startTime="00:00:00",
+ endTime="23:59:59",
+ online=0,
+ verbose=1,
+ walk=1,
+ )
+
+procUnitConf1 = controller.addProcUnit(datatype='VoltageProc', inputId=readUnitConf.getId())
+
+opObj11 = procUnitConf1.addOperation(name='ProfileSelector', optype='other')
+opObj11.addParameter(name='profileRangeList', value='120,183', format='intlist')
+
+opObj11 = procUnitConf1.addOperation(name='RTIPlot', optype='other')
+opObj11.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str')
+opObj11.addParameter(name='showprofile', value='0', format='int')
+opObj11.addParameter(name='xmin', value='0', format='int')
+opObj11.addParameter(name='xmax', value='24', format='int')
+opObj11.addParameter(name='figpath', value="/home/nanosat/schain/schain-cli/figs", format='str')
+opObj11.addParameter(name='wr_period', value='5', format='int')
+opObj11.addParameter(name='exp_code', value='22', format='int')
+
+
+controller.start()
diff --git a/schaincli/cli.py b/schaincli/cli.py
new file mode 100644
index 0000000..fdf7531
--- /dev/null
+++ b/schaincli/cli.py
@@ -0,0 +1,188 @@
+import click
+import schainpy
+import subprocess
+import os
+import sys
+import glob
+save_stdout = sys.stdout
+sys.stdout = open('trash', 'w')
+from multiprocessing import cpu_count
+from schaincli import templates
+from schainpy import controller_api
+from schainpy.model import Operation, ProcessingUnit
+from schainpy.utils import log
+from importlib import import_module
+from pydoc import locate
+from fuzzywuzzy import process
+sys.stdout = save_stdout
+
+
+def print_version(ctx, param, value):
+ if not value or ctx.resilient_parsing:
+ return
+ click.echo(schainpy.__version__)
+ ctx.exit()
+
+
+cliLogger = log.makelogger('schain cli')
+PREFIX = 'experiment'
+
+
+@click.command()
+@click.option('--version', '-v', is_flag=True, callback=print_version, help='SChain version', type=str)
+@click.option('--xml', '-x', default=None, help='run an XML file', type=click.Path(exists=True, resolve_path=True))
+@click.argument('command', default='run', required=True)
+@click.argument('nextcommand', default=None, required=False, type=str)
+def main(command, nextcommand, version, xml):
+ """COMMAND LINE INTERFACE FOR SIGNAL CHAIN - JICAMARCA RADIO OBSERVATORY \n
+ Available commands.\n
+ --xml: runs a schain XML generated file\n
+ run: runs any python script starting 'experiment_'\n
+ generate: generates a template schain script\n
+ search: return avilable operations, procs or arguments of the give operation/proc\n"""
+ if xml is not None:
+ runFromXML(xml)
+ elif command == 'generate':
+ generate()
+ elif command == 'test':
+ test()
+ elif command == 'run':
+ runschain(nextcommand)
+ elif command == 'search':
+ search(nextcommand)
+ else:
+ log.error('Command {} is not defined'.format(command))
+
+def check_module(possible, instance):
+ def check(x):
+ try:
+ instancia = locate('schainpy.model.{}'.format(x))
+ return isinstance(instancia(), instance)
+ except Exception as e:
+ return False
+ clean = clean_modules(possible)
+ return [x for x in clean if check(x)]
+
+
+def clean_modules(module):
+ noEndsUnder = [x for x in module if not x.endswith('__')]
+ noStartUnder = [x for x in noEndsUnder if not x.startswith('__')]
+ noFullUpper = [x for x in noStartUnder if not x.isupper()]
+ return noFullUpper
+
+
+def search(nextcommand):
+ if nextcommand is None:
+ log.error('There is no Operation/ProcessingUnit to search')
+ elif nextcommand == 'procs':
+ module = dir(import_module('schainpy.model'))
+ procs = check_module(module, ProcessingUnit)
+ try:
+ procs.remove('ProcessingUnit')
+ except Exception as e:
+ pass
+ log.success('Current ProcessingUnits are:\n\033[1m{}\033[0m'.format('\n'.join(procs)))
+
+ elif nextcommand == 'operations':
+ module = dir(import_module('schainpy.model'))
+ noProcs = [x for x in module if not x.endswith('Proc')]
+ operations = check_module(noProcs, Operation)
+ try:
+ operations.remove('Operation')
+ except Exception as e:
+ pass
+ log.success('Current Operations are:\n\033[1m{}\033[0m'.format('\n'.join(operations)))
+ else:
+ try:
+ module = locate('schainpy.model.{}'.format(nextcommand))
+ args = module().getAllowedArgs()
+ log.warning('Use this feature with caution. It may not return all the allowed arguments')
+ try:
+ args.remove('self')
+ except Exception as e:
+ pass
+ try:
+ args.remove('dataOut')
+ except Exception as e:
+ pass
+ if len(args) == 0:
+ log.success('{} has no arguments'.format(nextcommand))
+ else:
+ log.success('Showing arguments of {} are:\n\033[1m{}\033[0m'.format(nextcommand, '\n'.join(args)))
+ except Exception as e:
+ log.error('Module {} does not exists'.format(nextcommand))
+ allModules = dir(import_module('schainpy.model'))
+ module = check_module(allModules, Operation)
+ module.extend(check_module(allModules, ProcessingUnit))
+ similar = process.extractOne(nextcommand, module)[0]
+ log.success('Searching {} instead'.format(similar))
+ search(similar)
+
+
+def runschain(nextcommand):
+ if nextcommand is None:
+ currentfiles = glob.glob('./{}_*.py'.format(PREFIX))
+ numberfiles = len(currentfiles)
+ if numberfiles > 1:
+ log.error('There is more than one file to run')
+ elif numberfiles == 1:
+ subprocess.call(['python ' + currentfiles[0]], shell=True)
+ else:
+ log.error('There is no file to run')
+ else:
+ try:
+ subprocess.call(['python ' + nextcommand], shell=True)
+ except Exception as e:
+ log.error("I cannot run the file. Does it exists?")
+
+
+def basicInputs():
+ inputs = {}
+ inputs['desc'] = click.prompt('Enter a description', default="A schain project", type=str)
+ inputs['name'] = click.prompt('Name of the project', default="project", type=str)
+ inputs['path'] = click.prompt('Data path', default=os.getcwd(), type=click.Path(exists=True, resolve_path=True))
+ inputs['startDate'] = click.prompt('Start date', default='1970/01/01', type=str)
+ inputs['endDate'] = click.prompt('End date', default='2017/12/31', type=str)
+ inputs['startHour'] = click.prompt('Start hour', default='00:00:00', type=str)
+ inputs['endHour'] = click.prompt('End hour', default='23:59:59', type=str)
+ inputs['figpath'] = inputs['path'] + '/figs'
+ return inputs
+
+
+def generate():
+ inputs = basicInputs()
+ inputs['multiprocess'] = click.confirm('Is this a multiprocess script?')
+ if inputs['multiprocess']:
+ inputs['nProcess'] = click.prompt('How many process?', default=cpu_count(), type=int)
+ current = templates.multiprocess.format(**inputs)
+ else:
+ current = templates.basic.format(**inputs)
+ scriptname = '{}_{}.py'.format(PREFIX, inputs['name'])
+ script = open(scriptname, 'w')
+ try:
+ script.write(current)
+ log.success('Script {} generated'.format(scriptname))
+ except Exception as e:
+ log.error('I cannot create the file. Do you have writing permissions?')
+
+
+def test():
+ log.warning('testing')
+
+
+def runFromXML(filename):
+ controller = controller_api.ControllerThread()
+ if not controller.readXml(filename):
+ return
+
+ plotterObj = controller.useExternalPlotter()
+
+ controller.start()
+ plotterObj.start()
+
+ cliLogger("Finishing all processes")
+
+ controller.join(5)
+
+ cliLogger("End of script")
+ return
diff --git a/schaincli/templates.py b/schaincli/templates.py
new file mode 100644
index 0000000..ce08f4c
--- /dev/null
+++ b/schaincli/templates.py
@@ -0,0 +1,75 @@
+basic = '''from schainpy.controller import Project
+
+desc = "{desc}"
+
+controller = Project()
+controller.setup(id='191', name="{name}", description=desc)
+
+readUnitConf = controller.addReadUnit(datatype='VoltageReader',
+ path="{path}",
+ startDate="{startDate}",
+ endDate="{endDate}",
+ startTime="{startHour}",
+ endTime="{endHour}",
+ online=0,
+ verbose=1,
+ walk=1,
+ )
+
+procUnitConf1 = controller.addProcUnit(datatype='VoltageProc', inputId=readUnitConf.getId())
+
+opObj11 = procUnitConf1.addOperation(name='ProfileSelector', optype='other')
+opObj11.addParameter(name='profileRangeList', value='120,183', format='intlist')
+
+opObj11 = procUnitConf1.addOperation(name='RTIPlot', optype='other')
+opObj11.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str')
+opObj11.addParameter(name='showprofile', value='0', format='int')
+opObj11.addParameter(name='xmin', value='0', format='int')
+opObj11.addParameter(name='xmax', value='24', format='int')
+opObj11.addParameter(name='figpath', value="{figpath}", format='str')
+opObj11.addParameter(name='wr_period', value='5', format='int')
+opObj11.addParameter(name='exp_code', value='22', format='int')
+
+
+controller.start()
+'''
+
+multiprocess = '''from schainpy.controller import Project, multiSchain
+
+desc = "{desc}"
+
+def fiber(cursor, skip, q, day):
+ controller = Project()
+ controller.setup(id='191', name="{name}", description=desc)
+
+ readUnitConf = controller.addReadUnit(datatype='SpectraReader',
+ path="{path}",
+ startDate=day,
+ endDate=day,
+ startTime="{startHour}",
+ endTime="{endHour}",
+ online=0,
+ queue=q,
+ cursor=cursor,
+ skip=skip,
+ verbose=1,
+ walk=1,
+ )
+
+ procUnitConf1 = controller.addProcUnit(datatype='Spectra', inputId=readUnitConf.getId())
+
+ procUnitConf2 = controller.addProcUnit(datatype='ParametersProc', inputId=readUnitConf.getId())
+ opObj11 = procUnitConf2.addOperation(name='SpectralMoments', optype='other')
+
+ opObj12 = procUnitConf2.addOperation(name='PublishData', optype='other')
+ opObj12.addParameter(name='zeromq', value=1, format='int')
+ opObj12.addParameter(name='verbose', value=0, format='bool')
+
+ controller.start()
+
+
+if __name__ == '__main__':
+ multiSchain(fiber, nProcess={nProcess}, startDate="{startDate}", endDate="{endDate}")
+
+
+'''
diff --git a/schaincli/tests/__init__.py b/schaincli/tests/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/schaincli/tests/__init__.py
@@ -0,0 +1 @@
+
diff --git a/schaincli/tests/test_cli.py b/schaincli/tests/test_cli.py
new file mode 100644
index 0000000..62e4f30
--- /dev/null
+++ b/schaincli/tests/test_cli.py
@@ -0,0 +1,29 @@
+import pytest
+from click.testing import CliRunner
+from schaincli import cli
+
+
+@pytest.fixture
+def runner():
+ return CliRunner()
+
+
+def test_cli(runner):
+ result = runner.invoke(cli.main)
+ assert result.exit_code == 0
+ assert not result.exception
+ assert result.output.strip() == 'Hello, world.'
+
+
+def test_cli_with_option(runner):
+ result = runner.invoke(cli.main, ['--as-cowboy'])
+ assert not result.exception
+ assert result.exit_code == 0
+ assert result.output.strip() == 'Howdy, world.'
+
+
+def test_cli_with_arg(runner):
+ result = runner.invoke(cli.main, ['Jicamarca'])
+ assert result.exit_code == 0
+ assert not result.exception
+ assert result.output.strip() == 'Hello, Jicamarca.'
diff --git a/schainpy/controller.py b/schainpy/controller.py
index 200da90..5a73b70 100644
--- a/schainpy/controller.py
+++ b/schainpy/controller.py
@@ -1313,9 +1313,9 @@ class Project():
print "Process finished"
- def start(self):
+ def start(self, filename=None):
- self.writeXml()
+ self.writeXml(filename)
self.createObjects()
self.connectObjects()
self.run()
diff --git a/schainpy/controller_api.py b/schainpy/controller_api.py
index 2c9efd1..d8d87b9 100644
--- a/schainpy/controller_api.py
+++ b/schainpy/controller_api.py
@@ -5,175 +5,175 @@ from schainpy.controller import Project
from schainpy.model.graphics.jroplotter import PlotManager
class ControllerThread(threading.Thread, Project):
-
+
def __init__(self, plotter_queue=None):
-
+
threading.Thread.__init__(self)
Project.__init__(self, plotter_queue)
-
+
self.setDaemon(True)
-
+
self.lock = threading.Lock()
self.control = {'stop':False, 'pause':False}
-
+
def __del__(self):
-
+
self.control['stop'] = True
-
+
def stop(self):
-
+
self.lock.acquire()
-
+
self.control['stop'] = True
-
+
self.lock.release()
-
+
def pause(self):
-
+
self.lock.acquire()
-
+
self.control['pause'] = not(self.control['pause'])
paused = self.control['pause']
-
+
self.lock.release()
-
+
return paused
-
+
def isPaused(self):
-
+
self.lock.acquire()
paused = self.control['pause']
self.lock.release()
-
+
return paused
-
+
def isStopped(self):
-
+
self.lock.acquire()
stopped = self.control['stop']
self.lock.release()
-
+
return stopped
-
+
def run(self):
self.control['stop'] = False
self.control['pause'] = False
-
+
self.writeXml()
-
+
self.createObjects()
self.connectObjects()
Project.run(self)
-
+
def isRunning(self):
-
+
return self.is_alive()
-
+
def isFinished(self):
-
+
return not self.is_alive()
def setPlotters(self):
-
+
plotterList = PlotManager.plotterList
-
+
for thisPUConfObj in self.procUnitConfObjDict.values():
-
+
inputId = thisPUConfObj.getInputId()
-
+
if int(inputId) == 0:
continue
-
+
for thisOpObj in thisPUConfObj.getOperationObjList():
-
+
if thisOpObj.type == "self":
continue
-
+
if thisOpObj.name in plotterList:
thisOpObj.type = "plotter"
def setPlotterQueue(self, plotter_queue):
-
+
self.plotterQueue = plotter_queue
-
+
def getPlotterQueue(self):
-
+
return self.plotterQueue
def useExternalPlotter(self):
-
+
self.plotterQueue = Queue(10)
self.setPlotters()
-
+
plotManagerObj = PlotManager(self.plotterQueue)
plotManagerObj.setController(self)
-
+
return plotManagerObj
-
+
# from PyQt4 import QtCore
# from PyQt4.QtCore import SIGNAL
-#
+#
# class ControllerQThread(QtCore.QThread, Project):
-#
+#
# def __init__(self, filename):
-#
+#
# QtCore.QThread.__init__(self)
# Project.__init__(self)
-#
+#
# self.filename = filename
-#
+#
# self.lock = threading.Lock()
# self.control = {'stop':False, 'pause':False}
-#
+#
# def __del__(self):
-#
+#
# self.control['stop'] = True
# self.wait()
-#
+#
# def stop(self):
-#
+#
# self.lock.acquire()
-#
+#
# self.control['stop'] = True
-#
+#
# self.lock.release()
-#
+#
# def pause(self):
-#
+#
# self.lock.acquire()
-#
+#
# self.control['pause'] = not(self.control['pause'])
# paused = self.control['pause']
-#
+#
# self.lock.release()
-#
+#
# return paused
-#
+#
# def isPaused(self):
-#
+#
# self.lock.acquire()
# paused = self.control['pause']
# self.lock.release()
-#
+#
# return paused
-#
+#
# def isStopped(self):
-#
+#
# self.lock.acquire()
# stopped = self.control['stop']
# self.lock.release()
-#
+#
# return stopped
-#
+#
# def run(self):
-#
+#
# self.control['stop'] = False
# self.control['pause'] = False
-#
+#
# self.readXml(self.filename)
# self.createObjects()
# self.connectObjects()
# self.emit( SIGNAL( "jobStarted( PyQt_PyObject )" ), 1)
# Project.run(self)
# self.emit( SIGNAL( "jobFinished( PyQt_PyObject )" ), 1)
-#
\ No newline at end of file
+#
diff --git a/schainpy/model/io/jroIO_base.py b/schainpy/model/io/jroIO_base.py
index a9b38a1..30a6f83 100644
--- a/schainpy/model/io/jroIO_base.py
+++ b/schainpy/model/io/jroIO_base.py
@@ -9,6 +9,7 @@ import glob
import time
import numpy
import fnmatch
+import inspect
import time, datetime
#import h5py
import traceback
@@ -536,6 +537,9 @@ class JRODataIO:
return dtype_width
+ def getAllowedArgs(self):
+ return inspect.getargspec(self.run).args
+
class JRODataReader(JRODataIO):
@@ -1432,12 +1436,52 @@ class JRODataReader(JRODataIO):
self.__printInfo = False
- def run(self, **kwargs):
+ def run(self,
+ path=None,
+ startDate=None,
+ endDate=None,
+ startTime=datetime.time(0,0,0),
+ endTime=datetime.time(23,59,59),
+ set=None,
+ expLabel = "",
+ ext = None,
+ online = False,
+ delay = 60,
+ walk = True,
+ getblock = False,
+ nTxs = 1,
+ realtime=False,
+ blocksize=None,
+ blocktime=None,
+ queue=None,
+ skip=None,
+ cursor=None,
+ warnings=True,
+ verbose=True, **kwargs):
if not(self.isConfig):
-
# self.dataOut = dataOut
- self.setup(**kwargs)
+ self.setup( path=path,
+ startDate=startDate,
+ endDate=endDate,
+ startTime=startTime,
+ endTime=endTime,
+ set=set,
+ expLabel=expLabel,
+ ext=ext,
+ online=online,
+ delay=delay,
+ walk=walk,
+ getblock=getblock,
+ nTxs=nTxs,
+ realtime=realtime,
+ blocksize=blocksize,
+ blocktime=blocktime,
+ queue=queue,
+ skip=skip,
+ cursor=cursor,
+ warnings=warnings,
+ verbose=verbose)
self.isConfig = True
self.getData()
@@ -1740,11 +1784,11 @@ class JRODataWriter(JRODataIO):
return 1
- def run(self, dataOut, **kwargs):
+ def run(self, dataOut, path, blocksPerFile, profilesPerBlock=64, set=None, ext=None, datatype=4, **kwargs):
if not(self.isConfig):
- self.setup(dataOut, **kwargs)
+ self.setup(dataOut, path, blocksPerFile, profilesPerBlock=profilesPerBlock, set=set, ext=ext, datatype=datatype, **kwargs)
self.isConfig = True
self.putData()
diff --git a/schainpy/project.py b/schainpy/project.py
new file mode 100644
index 0000000..bdea4c3
--- /dev/null
+++ b/schainpy/project.py
@@ -0,0 +1,34 @@
+from schainpy.controller import Project
+
+desc = "A schain project"
+
+controller = Project()
+controller.setup(id='191', name="project", description=desc)
+
+readUnitConf = controller.addReadUnit(datatype='VoltageReader',
+ path="/home/nanosat/schain/schainpy",
+ startDate="1970/01/01",
+ endDate="2017/12/31",
+ startTime="00:00:00",
+ endTime="23:59:59",
+ online=0,
+ verbose=1,
+ walk=1,
+ )
+
+procUnitConf1 = controller.addProcUnit(datatype='VoltageProc', inputId=readUnitConf.getId())
+
+opObj11 = procUnitConf1.addOperation(name='ProfileSelector', optype='other')
+opObj11.addParameter(name='profileRangeList', value='120,183', format='intlist')
+
+opObj11 = procUnitConf1.addOperation(name='RTIPlot', optype='other')
+opObj11.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str')
+opObj11.addParameter(name='showprofile', value='0', format='int')
+opObj11.addParameter(name='xmin', value='0', format='int')
+opObj11.addParameter(name='xmax', value='24', format='int')
+opObj11.addParameter(name='figpath', value="/home/nanosat/schain/schainpy/figs", format='str')
+opObj11.addParameter(name='wr_period', value='5', format='int')
+opObj11.addParameter(name='exp_code', value='22', format='int')
+
+
+controller.start()
diff --git a/schainpy/scripts/project.py b/schainpy/scripts/project.py
new file mode 100644
index 0000000..17237bd
--- /dev/null
+++ b/schainpy/scripts/project.py
@@ -0,0 +1,33 @@
+from schainpy.controller import Project
+
+desc = "A schain project"
+
+controller = Project()
+controller.setup(id='191', name="project", description=desc)
+
+readUnitConf = controller.addReadUnit(datatype='VoltageReader',
+ path="/home/nanosat/schain/schainpy/scripts",
+ startDate="1970/01/01",
+ endDate="2017/12/31",
+ startTime="00:00:00",
+ endTime="23:59:59",
+ online=0,
+ walk=1,
+ )
+
+procUnitConf1 = controller.addProcUnit(datatype='VoltageProc', inputId=readUnitConf.getId())
+
+opObj11 = procUnitConf1.addOperation(name='ProfileSelector', optype='other')
+opObj11.addParameter(name='profileRangeList', value='120,183', format='intlist')
+
+opObj11 = procUnitConf1.addOperation(name='RTIPlot', optype='other')
+opObj11.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str')
+opObj11.addParameter(name='showprofile', value='0', format='int')
+opObj11.addParameter(name='xmin', value='0', format='int')
+opObj11.addParameter(name='xmax', value='24', format='int')
+opObj11.addParameter(name='figpath', value="/home/nanosat/schain/schainpy/scripts/figs", format='str')
+opObj11.addParameter(name='wr_period', value='5', format='int')
+opObj11.addParameter(name='exp_code', value='22', format='int')
+
+
+controller.start()
diff --git a/schainpy/scripts/schain.xml b/schainpy/scripts/schain.xml
index a2ccb6f..bd5200e 100644
--- a/schainpy/scripts/schain.xml
+++ b/schainpy/scripts/schain.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/schainpy/utils/__init__.py b/schainpy/utils/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/schainpy/utils/__init__.py
diff --git a/schainpy/utils/log.py b/schainpy/utils/log.py
new file mode 100644
index 0000000..85f1489
--- /dev/null
+++ b/schainpy/utils/log.py
@@ -0,0 +1,45 @@
+""".
+SCHAINPY - LOG
+ Simple helper for log standarization
+ Usage:
+ from schainpy.utils import log
+ log.error('A kitten died beacuse of you')
+ log.warning('You are doing it wrong but what the heck, I'll allow it)
+ log.succes('YOU ROCK!')
+ To create your own logger inside your class do it like this:
+ from schainpy.utils import log
+ awesomeLogger = log.makelogger("never gonna", bg="red", fg="white")
+ awesomeLogger('give you up')
+ which will look like this:
+ [NEVER GONNA] - give you up
+ with color red as background and white as foreground.
+"""
+
+import click
+
+
+def warning(message):
+ click.echo(click.style('[WARNING] - ' + message, fg='yellow'))
+ pass
+
+
+def error(message):
+ click.echo(click.style('[ERROR] - ' + message, fg='red'))
+ pass
+
+
+def success(message):
+ click.echo(click.style(message, fg='green'))
+ pass
+
+
+def log(message):
+ click.echo('[LOG] - ' + message)
+ pass
+
+
+def makelogger(topic, bg='reset', fg='reset'):
+ def func(message):
+ click.echo(click.style('[{}] - '.format(topic.upper()) + message,
+ bg=bg, fg=fg))
+ return func
diff --git a/setup.py b/setup.py
index 3fe773f..dcee0b2 100644
--- a/setup.py
+++ b/setup.py
@@ -1,49 +1,57 @@
-'''
+""".
+
Created on Jul 16, 2014
@author: Miguel Urco
-'''
+"""
from schainpy import __version__
from setuptools import setup, Extension
setup(name="schainpy",
- version=__version__,
- description="Python tools to read, write and process Jicamarca data",
- author="Miguel Urco",
- author_email="miguel.urco@jro.igp.gob.pe",
- url="http://jro.igp.gob.pe",
- packages = {'schainpy',
- 'schainpy.model',
- 'schainpy.model.data',
- 'schainpy.model.graphics',
- 'schainpy.model.io',
- 'schainpy.model.proc',
- 'schainpy.model.serializer',
- 'schainpy.model.utils',
- 'schainpy.gui',
- 'schainpy.gui.figures',
- 'schainpy.gui.viewcontroller',
- 'schainpy.gui.viewer',
- 'schainpy.gui.viewer.windows'},
- ext_package='schainpy',
- py_modules=[''],
- package_data={'': ['schain.conf.template'],
- 'schainpy.gui.figures': ['*.png','*.jpg'],
- },
- include_package_data=False,
- scripts =['schainpy/gui/schainGUI',
- 'schainpy/scripts/schain'],
- ext_modules=[Extension("cSchain", ["schainpy/model/proc/extensions.c"])],
- install_requires=[
- "scipy >= 0.14.0",
- "h5py >= 2.2.1",
- "matplotlib >= 1.4.2",
- "pyfits >= 3.4",
- "numpy >= 1.11.2",
- "paramiko >= 2.1.2",
- "paho-mqtt >= 1.2",
- "zmq",
- "fuzzywuzzy"
- ],
+ version=__version__,
+ description="Python tools to read, write and process Jicamarca data",
+ author="Miguel Urco",
+ author_email="miguel.urco@jro.igp.gob.pe",
+ url="http://jro.igp.gob.pe",
+ packages={'schainpy',
+ 'schainpy.model',
+ 'schainpy.model.data',
+ 'schainpy.model.graphics',
+ 'schainpy.model.io',
+ 'schainpy.model.proc',
+ 'schainpy.model.serializer',
+ 'schainpy.model.utils',
+ 'schainpy.gui',
+ 'schainpy.gui.figures',
+ 'schainpy.gui.viewcontroller',
+ 'schainpy.gui.viewer',
+ 'schainpy.gui.viewer.windows'},
+ ext_package='schainpy',
+ py_modules=[''],
+ package_data={'': ['schain.conf.template'],
+ 'schainpy.gui.figures': ['*.png', '*.jpg'],
+ },
+ include_package_data=False,
+ entry_points={
+ 'console_scripts': [
+ 'schain = schaincli.cli:main',
+ ],
+ },
+ scripts=['schainpy/gui/schainGUI'],
+ ext_modules=[Extension("cSchain", ["schainpy/model/proc/extensions.c"])],
+ install_requires=[
+ "scipy >= 0.14.0",
+ "h5py >= 2.2.1",
+ "matplotlib >= 1.4.2",
+ "pyfits >= 3.4",
+ "numpy >= 1.11.2",
+ "paramiko >= 2.1.2",
+ "paho-mqtt >= 1.2",
+ "zmq",
+ "fuzzywuzzy",
+ "click",
+ "colorama",
+ "python-Levenshtein"
+ ],
)
diff --git a/trash b/trash
new file mode 100644
index 0000000..384299d
--- /dev/null
+++ b/trash
@@ -0,0 +1 @@
+You should install "digital_rf_hdf5" module if you want to read USRP data