diff --git a/schainpy/VERSION b/schainpy/VERSION index a836a21..a19b1a9 100644 --- a/schainpy/VERSION +++ b/schainpy/VERSION @@ -81,4 +81,5 @@ properly but the next days did not. 2.2.5: -splitProfiles and combineProfiles modules were added to VoltageProc and Signal Chain GUI. -nProfiles of USRP data (hdf5) is the number of profiles thera are in one second. --jroPlotter works directly with data objects instead of dictionaries \ No newline at end of file +-jroPlotter works directly with data objects instead of dictionaries +-script "schain" was added to Signal Chain installer \ No newline at end of file diff --git a/schainpy/controller.py b/schainpy/controller.py index 5582929..36d8ad8 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -1000,11 +1000,15 @@ class Project(): return 1 def readXml(self, filename = None): - + + if not filename: + print "filename is not defined" + return 0 + abs_file = os.path.abspath(filename) if not os.path.isfile(abs_file): - print "%s does not exist" %abs_file + print "%s file does not exist" %abs_file return 0 self.projectElement = None diff --git a/schainpy/scripts/readSchainFile.py b/schainpy/scripts/readSchainFile.py deleted file mode 100644 index aaf825b..0000000 --- a/schainpy/scripts/readSchainFile.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python -''' -Created on Jul 7, 2014 - -@author: roj-idl71 -''' -import os, sys - -schainpy_path = os.path.dirname(os.getcwd()) -source_path = os.path.dirname(schainpy_path) -sys.path.insert(0, source_path) - -from schainpy.controller_api import ControllerThread - -def main(): - desc = "Segundo Test" - filename = "/Users/miguel/Downloads/mst_blocks.xml" - - controllerObj = ControllerThread() - controllerObj.readXml(filename) - - #Configure use of external plotter before start - plotterObj = controllerObj.useExternalPlotter() - ######################################## - - controllerObj.start() - plotterObj.start() - - -if __name__ == '__main__': - import time - start_time = time.time() - main() - print("--- %s seconds ---" % (time.time() - start_time)) \ No newline at end of file diff --git a/schainpy/scripts/schain b/schainpy/scripts/schain new file mode 100644 index 0000000..820a401 --- /dev/null +++ b/schainpy/scripts/schain @@ -0,0 +1,49 @@ +#!/usr/bin/env python +''' +Created on Jul 7, 2014 + +@author: roj-idl71 +''' +import os, sys + +from schainpy import controller_api +from optparse import OptionParser + +USAGE = """This script executes Signal Chain using parameters stored in [filename]. + +$ schain --file=[filename] +""" + +def main(filename): + + controllerObj = controller_api.ControllerThread() + if not controllerObj.readXml(filename): + return + + #Configure use of external plotter before start + plotterObj = controllerObj.useExternalPlotter() + ######################################## + + controllerObj.start() + plotterObj.start() + + print "Finishing all processes ..." + + controllerObj.join(5) + + print "End of script" + +if __name__ == '__main__': + + parser = OptionParser(usage=USAGE) + + parser.add_option("-f", "--file", type="string", default="", + help="File containing schain parameters") + + (op, args) = parser.parse_args() + + if not op.file: + parser.print_help() + sys.exit(0) + + main(op.file) \ No newline at end of file diff --git a/setup.py b/setup.py index 4ac6fcb..46a06dd 100644 --- a/setup.py +++ b/setup.py @@ -31,11 +31,10 @@ setup(name="schainpy", 'schainpy.gui.figures': ['*.png','*.jpg'], }, include_package_data=False, - scripts =['schainpy/gui/schainGUI'], + scripts =['schainpy/gui/schainGUI', + 'schainpy/scripts/schain'], install_requires=["numpy >= 1.6.0", "scipy >= 0.9.0", - "h5py >= 2.0.1", "matplotlib >= 1.0.0", -# "pyfits >= 2.0.0", ], ) \ No newline at end of file