From ba0b6ae662be579d68988b950fdf324fce56b9ed 2017-11-28 19:31:21 From: José Chávez Date: 2017-11-28 19:31:21 Subject: [PATCH] merge 2.3 --- diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7c27fc1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM python:2.7-slim + +RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends \ + git \ + gcc \ + libpng-dev \ + libfreetype6-dev \ + libopenblas-dev \ + liblapack-dev \ + libatlas-base-dev \ + libssl-dev \ + libhdf5-dev \ + && git clone --branch v2.3 --depth 1 \ + http://jro-dev.igp.gob.pe/rhodecode/schain \ + && pip install numpy \ + && cd schain \ + && pip install . \ + && rm -rf * \ + && apt-get purge -y --auto-remove git gcc \ + && rm -rf /var/lib/apt/lists/* + +ENV BACKEND="Agg" + +VOLUME /data + +ENTRYPOINT ["schain"] diff --git a/README.md b/README.md index 98574b8..a04a8a8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Signal Chain (SCh) is a radar data processing library developed using [Python](w ## Installation -Install system dependencies, clone the latest version from [git](http://jro-dev.igp.gob.pe/rhodecode/schain/) and install it as a normal python package. +Install system dependencies, clone the latest version from [here](http://jro-dev.igp.gob.pe/rhodecode/schain/) and install it as a normal python package. ### Linux based system ``` @@ -16,36 +16,38 @@ $ cd schain $ sudo pip install ./ ``` -**It is recommended to install schain in a virtual environment** -``` -$ sudo pip install virtualenv -$ virtualenv /path/to/virtual --system-site-packages -$ source /path/to/virtual/bin/activate -(virtual) $ cd schain -(virtual) $ pip install ./ - -``` ### MAC Os ``` +$ brew install python $ brew install cartr/qt4/pyqt $ git clone http://jro-dev.igp.gob.pe/rhodecode/schain/ $ cd schain $ pip install ./ ``` -if ```pip install ./``` does not work, install a proper python enviroment, and repeat the steps. +**It is recommended to install schain in a virtual environment** ``` -$ brew install python +$ virtualenv /path/to/virtual +$ source /path/to/virtual/bin/activate +(virtual) $ cd schain +(virtual) $ pip install ./ +(virtual) $ bash link_PyQt4.sh ``` -### GUI Installation +### Docker + +Download Dockerfile from the repository, and create a docker image ``` -$ sudo apt-get install python-pip python-dev gfortran libpng-dev freetype* libblas-dev liblapack-dev libatlas-base-dev python-qt4 python-tk libssl-dev libhdf5-dev -$ (virtual) bash link_PyQt4.sh +$ docker build -t schain . ``` +You can run a container using an xml file or a schain script also you need to mount a volume for the data input and for the output files/plots +``` +$ docker run -it --rm --volume /path/to/host/data:/data schain xml /data/test.xml +$ docker run -it --rm --volume /path/to/host/data:/data --entrypoint=/bin/python schain /data/test.py +``` ## First Script diff --git a/link_PyQt4.sh b/link_PyQt4.sh index d5d44cb..bc9f852 100755 --- a/link_PyQt4.sh +++ b/link_PyQt4.sh @@ -1,8 +1,5 @@ #!/bin/bash # This hook is run after a new virtualenv is activated. -# ~/.virtualenvs/postmkvirtualenv - -libs=( PyQt4 sip.so ) python_version=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))") var=( $(which -a $python_version) ) @@ -10,8 +7,9 @@ var=( $(which -a $python_version) ) get_python_lib_cmd="from distutils.sysconfig import get_python_lib; print (get_python_lib())" lib_virtualenv_path=$(python -c "$get_python_lib_cmd") lib_system_path=$(${var[-1]} -c "$get_python_lib_cmd") +sip_path=$(ls $lib_system_path/sip*.so) -for lib in ${libs[@]} -do - ln -s $lib_system_path/$lib $lib_virtualenv_path/$lib -done +echo "Linking Qt4..." +ln -s $lib_system_path/PyQt4 $lib_virtualenv_path/PyQt4 +echo "Linking SIP..." +ln -s $sip_path $lib_virtualenv_path/sip.so diff --git a/schaincli/README.md b/schainpy/cli/README.md similarity index 100% rename from schaincli/README.md rename to schainpy/cli/README.md diff --git a/schaincli/__init__.py b/schainpy/cli/__init__.py similarity index 100% rename from schaincli/__init__.py rename to schainpy/cli/__init__.py diff --git a/schaincli/cli.py b/schainpy/cli/cli.py similarity index 99% rename from schaincli/cli.py rename to schainpy/cli/cli.py index 46e2cbb..9480dfc 100644 --- a/schaincli/cli.py +++ b/schainpy/cli/cli.py @@ -7,7 +7,6 @@ import glob save_stdout = sys.stdout sys.stdout = open('trash', 'w') from multiprocessing import cpu_count -from schaincli import templates from schainpy.controller import Project from schainpy.model import Operation, ProcessingUnit from schainpy.utils import log @@ -15,6 +14,7 @@ from importlib import import_module from pydoc import locate from fuzzywuzzy import process from schainpy.utils import paramsFinder +import templates sys.stdout = save_stdout diff --git a/schaincli/templates.py b/schainpy/cli/templates.py similarity index 100% rename from schaincli/templates.py rename to schainpy/cli/templates.py diff --git a/schaincli/tests/__init__.py b/schainpy/cli/tests/__init__.py similarity index 100% rename from schaincli/tests/__init__.py rename to schainpy/cli/tests/__init__.py diff --git a/schaincli/tests/test_cli.py b/schainpy/cli/tests/test_cli.py similarity index 95% rename from schaincli/tests/test_cli.py rename to schainpy/cli/tests/test_cli.py index 62e4f30..7af3a6f 100644 --- a/schaincli/tests/test_cli.py +++ b/schainpy/cli/tests/test_cli.py @@ -1,6 +1,6 @@ import pytest from click.testing import CliRunner -from schaincli import cli +from schainpy.cli import cli @pytest.fixture diff --git a/schainpy/controller.py b/schainpy/controller.py index 4b3039e..a34b86b 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -34,6 +34,8 @@ def MPProject(project, n=cpu_count()): op = rconf.getOperationObj('run') dt1 = op.getParameterValue('startDate') dt2 = op.getParameterValue('endDate') + tm1 = op.getParameterValue('startTime') + tm2 = op.getParameterValue('endTime') days = (dt2 - dt1).days for day in range(days + 1): @@ -46,11 +48,13 @@ def MPProject(project, n=cpu_count()): paths, files = reader.searchFilesOffLine(path=rconf.path, startDate=dt, endDate=dt, + startTime=tm1, + endTime=tm2, ext=DTYPES[rconf.datatype]) nFiles = len(files) if nFiles == 0: continue - skip = int(math.ceil(nFiles / n)) + skip = int(math.ceil(nFiles / n)) while nFiles > cursor * skip: rconf.update(startDate=dt_str, endDate=dt_str, cursor=cursor, skip=skip) @@ -962,7 +966,7 @@ class Project(Process): print '*' * 60 print self.id = str(id) - self.description = description + self.description = description def update(self, name, description): @@ -1270,7 +1274,7 @@ class Project(Process): def run(self): log.success('Starting {}'.format(self.name)) - + self.start_time = time.time() self.createObjects() self.connectObjects() @@ -1314,4 +1318,6 @@ class Project(Process): procUnitConfObj = self.procUnitConfObjDict[procKey] procUnitConfObj.close() - log.success('{} finished'.format(self.name)) + log.success('{} finished (time: {}s)'.format( + self.name, + time.time()-self.start_time)) diff --git a/schainpy/gui/schainGUI b/schainpy/gui/schainGUI index 0fb14e7..6532eee 100644 --- a/schainpy/gui/schainGUI +++ b/schainpy/gui/schainGUI @@ -8,10 +8,9 @@ try: from PyQt4.QtGui import QApplication except: log.error( - 'You should install PtQt4 module in order to run the GUI. See the README.') + 'You should install PyQt4 module in order to run the GUI. See the README.') sys.exit() - from schainpy.gui.viewcontroller.initwindow import InitWindow from schainpy.gui.viewcontroller.basicwindow import BasicWindow from schainpy.gui.viewcontroller.workspace import Workspace diff --git a/schainpy/model/data/jroheaderIO.py b/schainpy/model/data/jroheaderIO.py index c24b9c2..2f0b4f9 100644 --- a/schainpy/model/data/jroheaderIO.py +++ b/schainpy/model/data/jroheaderIO.py @@ -507,7 +507,7 @@ class RadarControllerHeader(Header): code1 = (self.code + 1.0) / 2. for ic in range(self.nCode): - tempx = numpy.zeros(int(self.nBaud / 32.)) + tempx = numpy.zeros(int(numpy.ceil(self.nBaud / 32.))) start = 0 end = 32 for i in range(len(tempx)): diff --git a/schainpy/model/graphics/jroplot_data.py b/schainpy/model/graphics/jroplot_data.py index dccdf06..261792b 100644 --- a/schainpy/model/graphics/jroplot_data.py +++ b/schainpy/model/graphics/jroplot_data.py @@ -22,7 +22,7 @@ ncmap = matplotlib.colors.LinearSegmentedColormap.from_list( 'jro', numpy.vstack((blu_values, jet_values))) matplotlib.pyplot.register_cmap(cmap=ncmap) -CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'RdBu_r', 'seismic')] +CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'viridis', 'plasma', 'inferno', 'Greys', 'seismic', 'bwr', 'coolwarm')] def figpause(interval): @@ -45,8 +45,7 @@ class PlotData(Operation, Process): CODE = 'Figure' colormap = 'jro' bgcolor = 'white' - CONFLATE = False - __MAXNUMX = 80 + CONFLATE = False __missing = 1E30 __attrs__ = ['show', 'save', 'xmin', 'xmax', 'ymin', 'ymax', 'zmin', 'zmax', @@ -88,7 +87,7 @@ class PlotData(Operation, Process): self.ymin = kwargs.get('ymin', None) self.ymax = kwargs.get('ymax', None) self.xlabel = kwargs.get('xlabel', None) - self.__MAXNUMY = kwargs.get('decimation', 200) + self.decimation = kwargs.get('decimation', None) self.showSNR = kwargs.get('showSNR', False) self.oneFigure = kwargs.get('oneFigure', True) self.width = kwargs.get('width', None) @@ -328,7 +327,7 @@ class PlotData(Operation, Process): def decimate(self): # dx = int(len(self.x)/self.__MAXNUMX) + 1 - dy = int(len(self.y) / self.__MAXNUMY) + 1 + dy = int(len(self.y) / self.decimation) + 1 # x = self.x[::dx] x = self.x @@ -369,7 +368,7 @@ class PlotData(Operation, Process): ymin = self.ymin if self.ymin else numpy.nanmin(self.y) ymax = self.ymax if self.ymax else numpy.nanmax(self.y) - Y = numpy.array([10, 20, 50, 100, 200, 500, 1000, 2000]) + Y = numpy.array([5, 10, 20, 50, 100, 200, 500, 1000, 2000]) i = 1 if numpy.where(ymax-ymin < Y)[0][0] < 0 else numpy.where(ymax-ymin < Y)[0][0] ystep = Y[i] / 5 @@ -422,8 +421,11 @@ class PlotData(Operation, Process): ''' log.success('Plotting', self.name) - self.plot() - self.format() + try: + self.plot() + self.format() + except: + log.warning('{} Plot could not be updated... check data'.format(self.CODE), self.name) for n, fig in enumerate(self.figures): if self.nrows == 0 or self.nplots == 0: @@ -449,7 +451,7 @@ class PlotData(Operation, Process): self.CODE, label, self.getDateTime(self.saveTime).strftime( - '%y%m%d_%H%M%S'), + '%Y%m%d_%H%M%S'), ) ) log.log('Saving figure: {}'.format(figname), self.name) @@ -526,7 +528,7 @@ class PlotSpectraData(PlotData): if self.showprofile: self.width += 0.8 * self.ncols - self.ylabel = 'Range [Km]' + self.ylabel = 'Range [km]' def plot(self): if self.xaxis == "frequency": @@ -598,7 +600,7 @@ class PlotCrossSpectraData(PlotData): self.nplots = self.nrows * 4 self.width = 3.4 * self.ncols self.height = 3 * self.nrows - self.ylabel = 'Range [Km]' + self.ylabel = 'Range [km]' self.showprofile = False def plot(self): @@ -701,7 +703,7 @@ class PlotRTIData(PlotData): self.ncols = 1 self.nrows = len(self.data.channels) self.nplots = len(self.data.channels) - self.ylabel = 'Range [Km]' + self.ylabel = 'Range [km]' self.cb_label = 'dB' self.titles = ['{} Channel {}'.format( self.CODE.upper(), x) for x in range(self.nrows)] @@ -712,8 +714,12 @@ class PlotRTIData(PlotData): self.z = self.data[self.CODE] self.z = numpy.ma.masked_invalid(self.z) - for n, ax in enumerate(self.axes): + if self.decimation is None: + x, y, z = self.fill_gaps(self.x, self.y, self.z) + else: x, y, z = self.fill_gaps(*self.decimate()) + + for n, ax in enumerate(self.axes): self.zmin = self.zmin if self.zmin else numpy.min(self.z) self.zmax = self.zmax if self.zmax else numpy.max(self.z) if ax.firsttime: @@ -754,7 +760,7 @@ class PlotCOHData(PlotRTIData): self.ncols = 1 self.nrows = len(self.data.pairs) self.nplots = len(self.data.pairs) - self.ylabel = 'Range [Km]' + self.ylabel = 'Range [km]' if self.CODE == 'coh': self.cb_label = '' self.titles = [ @@ -896,7 +902,7 @@ class PlotParamData(PlotRTIData): self.nrows += 1 self.nplots += 1 - self.ylabel = 'Height [Km]' + self.ylabel = 'Height [km]' if not self.titles: self.titles = self.data.parameters \ if self.data.parameters else ['Param {}'.format(x) for x in xrange(self.nrows)] @@ -916,9 +922,13 @@ class PlotParamData(PlotRTIData): self.z = numpy.ma.masked_invalid(self.z) - for n, ax in enumerate(self.axes): - + if self.decimation is None: + x, y, z = self.fill_gaps(self.x, self.y, self.z) + else: x, y, z = self.fill_gaps(*self.decimate()) + + for n, ax in enumerate(self.axes): + self.zmax = self.zmax if self.zmax is not None else numpy.max( self.z[n]) self.zmin = self.zmin if self.zmin is not None else numpy.min( diff --git a/schainpy/model/graphics/mpldriver.py b/schainpy/model/graphics/mpldriver.py index c1e31ac..6173cd6 100644 --- a/schainpy/model/graphics/mpldriver.py +++ b/schainpy/model/graphics/mpldriver.py @@ -1,13 +1,19 @@ -import numpy -import datetime +import os import sys +import datetime +import numpy import matplotlib -if 'linux' in sys.platform: +if 'BACKEND' in os.environ: + matplotlib.use(os.environ['BACKEND']) +elif 'linux' in sys.platform: matplotlib.use("TkAgg") - -if 'darwin' in sys.platform: - matplotlib.use('TKAgg') +elif 'darwin' in sys.platform: + matplotlib.use('TkAgg') +else: + from schainpy.utils import log + log.warning('Using default Backend="Agg"', 'INFO') + matplotlib.use('Agg') # Qt4Agg', 'GTK', 'GTKAgg', 'ps', 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg', 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX' import matplotlib.pyplot diff --git a/schainpy/model/io/jroIO_base.py b/schainpy/model/io/jroIO_base.py index 90aab67..04e9232 100644 --- a/schainpy/model/io/jroIO_base.py +++ b/schainpy/model/io/jroIO_base.py @@ -22,6 +22,7 @@ except: from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader from schainpy.model.data.jroheaderIO import get_dtype_index, get_numpy_dtype, get_procflag_dtype, get_dtype_width +from schainpy.utils import log LOCALTIME = True @@ -440,7 +441,7 @@ def isRadarFolder(folder): def isRadarFile(file): - try: + try: year = int(file[1:5]) doy = int(file[5:8]) set = int(file[8:11]) @@ -451,10 +452,10 @@ def isRadarFile(file): def getDateFromRadarFile(file): - try: + try: year = int(file[1:5]) doy = int(file[5:8]) - set = int(file[8:11]) + set = int(file[8:11]) except: return None @@ -649,26 +650,13 @@ class JRODataReader(JRODataIO): filenameList = [] datetimeList = [] - + for thisPath in pathList: fileList = glob.glob1(thisPath, "*%s" % ext) fileList.sort() - skippedFileList = [] - - if cursor is not None and skip is not None: - - if skip == 0: - skippedFileList = [] - else: - skippedFileList = fileList[cursor * - skip: cursor * skip + skip] - - else: - skippedFileList = fileList - - for file in skippedFileList: + for file in fileList: filename = os.path.join(thisPath, file) @@ -684,12 +672,15 @@ class JRODataReader(JRODataIO): filenameList.append(filename) datetimeList.append(thisDatetime) + if cursor is not None and skip is not None: + filenameList = filenameList[cursor * skip:cursor * skip + skip] + datetimeList = datetimeList[cursor * skip:cursor * skip + skip] + if not(filenameList): print "[Reading] Time range selected invalid [%s - %s]: No *%s files in %s)" % (startTime, endTime, ext, path) return [], [] - print "[Reading] %d file(s) was(were) found in time range: %s - %s" % (len(filenameList), startTime, endTime) - print + print "[Reading] %d file(s) was(were) found in time range: %s - %s" % (len(filenameList), startTime, endTime) # for i in range(len(filenameList)): # print "[Reading] %s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) @@ -1743,9 +1734,9 @@ class JRODataWriter(JRODataIO): if self.dataOut.datatime.date() > self.fileDate: setFile = 0 self.nTotalBlocks = 0 - - filen = '%s%4.4d%3.3d%3.3d%s' % ( - self.optchar, timeTuple.tm_year, timeTuple.tm_yday, setFile, ext) + + filen = '{}{:04d}{:03d}{:03d}{}'.format( + self.optchar, timeTuple.tm_year, timeTuple.tm_yday, setFile, ext) filename = os.path.join(path, subfolder, filen) @@ -1796,11 +1787,11 @@ class JRODataWriter(JRODataIO): self.ext = ext.lower() self.path = path - + if set is None: self.setFile = -1 else: - self.setFile = set - 1 + self.setFile = set - 1 self.blocksPerFile = blocksPerFile diff --git a/schainpy/model/utils/jroutils_publish.py b/schainpy/model/utils/jroutils_publish.py index a1236e6..9ce28d9 100644 --- a/schainpy/model/utils/jroutils_publish.py +++ b/schainpy/model/utils/jroutils_publish.py @@ -82,9 +82,10 @@ class Data(object): Object to hold data to be plotted ''' - def __init__(self, plottypes, throttle_value): + def __init__(self, plottypes, throttle_value, exp_code): self.plottypes = plottypes self.throttle = throttle_value + self.exp_code = exp_code self.ended = False self.localtime = False self.__times = [] @@ -147,7 +148,8 @@ class Data(object): return self.parameters = getattr(dataOut, 'parameters', []) - self.pairs = dataOut.pairsList + if hasattr(dataOut, 'pairsList'): + self.pairs = dataOut.pairsList self.channels = dataOut.channelList self.interval = dataOut.getTimeInterval() self.localtime = dataOut.useLocalTime @@ -214,17 +216,28 @@ class Data(object): Convert data to json ''' - ret = {} + data = {} tm = self.times[-1] - - for key, value in self.data: + + for key in self.data: if key in ('spc', 'cspc'): - ret[key] = roundFloats(self.data[key].to_list()) + dx = int(self.data[key].shape[1]/MAXNUMX) + 1 + dy = int(self.data[key].shape[2]/MAXNUMY) + 1 + data[key] = roundFloats(self.data[key][::, ::dx, ::dy].tolist()) else: - ret[key] = roundFloats(self.data[key][tm].to_list()) + data[key] = roundFloats(self.data[key][tm].tolist()) - ret['timestamp'] = tm + ret = {'data': data} + ret['exp_code'] = self.exp_code + ret['time'] = tm ret['interval'] = self.interval + ret['localtime'] = self.localtime + ret['yrange'] = roundFloats(self.heights.tolist()) + if key in ('spc', 'cspc'): + ret['xrange'] = roundFloats(self.xrange[2][::dx].tolist()) + if hasattr(self, 'pairs'): + ret['pairs'] = self.pairs + return json.dumps(ret) @property def times(self): @@ -475,7 +488,8 @@ class ReceiverData(ProcessingUnit): class PlotterReceiver(ProcessingUnit, Process): throttle_value = 5 - __attrs__ = ['server', 'plottypes', 'realtime', 'localtime', 'throttle'] + __attrs__ = ['server', 'plottypes', 'realtime', 'localtime', 'throttle', + 'exp_code', 'web_server'] def __init__(self, **kwargs): @@ -486,30 +500,25 @@ class PlotterReceiver(ProcessingUnit, Process): self.isWebConfig = False self.connections = 0 server = kwargs.get('server', 'zmq.pipe') - plot_server = kwargs.get('plot_server', 'zmq.web') + web_server = kwargs.get('web_server', None) if 'tcp://' in server: address = server else: address = 'ipc:///tmp/%s' % server - - if 'tcp://' in plot_server: - plot_address = plot_server - else: - plot_address = 'ipc:///tmp/%s' % plot_server - self.address = address - self.plot_address = plot_address + self.web_address = web_server self.plottypes = [s.strip() for s in kwargs.get('plottypes', 'rti').split(',')] self.realtime = kwargs.get('realtime', False) self.localtime = kwargs.get('localtime', True) self.throttle_value = kwargs.get('throttle', 5) + self.exp_code = kwargs.get('exp_code', None) self.sendData = self.initThrottle(self.throttle_value) self.dates = [] self.setup() def setup(self): - self.data = Data(self.plottypes, self.throttle_value) + self.data = Data(self.plottypes, self.throttle_value, self.exp_code) self.isConfig = True def event_monitor(self, monitor): @@ -559,9 +568,13 @@ class PlotterReceiver(ProcessingUnit, Process): self.receiver.bind(self.address) monitor = self.receiver.get_monitor_socket() self.sender = self.context.socket(zmq.PUB) - if self.realtime: + if self.web_address: + log.success( + 'Sending to web: {}'.format(self.web_address), + self.name + ) self.sender_web = self.context.socket(zmq.PUB) - self.sender_web.connect(self.plot_address) + self.sender_web.connect(self.web_address) time.sleep(1) if 'server' in self.kwargs: @@ -609,27 +622,10 @@ class PlotterReceiver(ProcessingUnit, Process): else: if self.realtime: self.send(self.data) - # self.sender_web.send_string(self.data.jsonify()) + if self.web_address: + self.sender_web.send(self.data.jsonify()) else: self.sendData(self.send, self.data, coerce=coerce) coerce = False return - - def sendToWeb(self): - - if not self.isWebConfig: - context = zmq.Context() - sender_web_config = context.socket(zmq.PUB) - if 'tcp://' in self.plot_address: - dum, address, port = self.plot_address.split(':') - conf_address = '{}:{}:{}'.format(dum, address, int(port)+1) - else: - conf_address = self.plot_address + '.config' - sender_web_config.bind(conf_address) - time.sleep(1) - for kwargs in self.operationKwargs.values(): - if 'plot' in kwargs: - log.success('[Sending] Config data to web for {}'.format(kwargs['code'].upper())) - sender_web_config.send_string(json.dumps(kwargs)) - self.isWebConfig = True diff --git a/setup.py b/setup.py index 341f7ce..3631dcc 100644 --- a/setup.py +++ b/setup.py @@ -8,8 +8,6 @@ import os from setuptools import setup, Extension from setuptools.command.build_ext import build_ext as _build_ext from schainpy import __version__ -from schainpy.utils import log - class build_ext(_build_ext): def finalize_options(self): @@ -19,22 +17,13 @@ class build_ext(_build_ext): import numpy self.include_dirs.append(numpy.get_include()) - -try: - from PyQt4 import QtCore, QtGui - from PyQt4.QtGui import QApplication -except: - log.warning( - 'You should install PyQt4 module in order to run the GUI. See the README.') - - -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', +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', @@ -42,32 +31,33 @@ setup(name="schainpy", 'schainpy.model.proc', 'schainpy.model.serializer', 'schainpy.model.utils', + 'schainpy.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'], - ext_modules=[ - Extension("cSchain", ["schainpy/model/proc/extensions.c"] - )], - entry_points={ + 'schainpy.gui.viewer.windows', + 'schainpy.cli'}, + ext_package = 'schainpy', + package_data = {'': ['schain.conf.template'], + 'schainpy.gui.figures': ['*.png', '*.jpg'], + }, + include_package_data = False, + scripts = ['schainpy/gui/schainGUI'], + ext_modules = [ + Extension("cSchain", ["schainpy/model/proc/extensions.c"]) + ], + entry_points = { 'console_scripts': [ - 'schain = schaincli.cli:main', + 'schain = schainpy.cli.cli:main', ], }, - cmdclass={'build_ext': build_ext}, - setup_requires=["numpy >= 1.11.2"], - install_requires=[ + cmdclass = {'build_ext': build_ext}, + setup_requires = ["numpy >= 1.11.2"], + install_requires = [ "scipy >= 0.14.0", "h5py >= 2.2.1", - "matplotlib >= 1.4.2", + "matplotlib >= 2.0.0", "pyfits >= 3.4", "paramiko >= 2.1.2", "paho-mqtt >= 1.2", @@ -75,5 +65,5 @@ setup(name="schainpy", "fuzzywuzzy", "click", "python-Levenshtein" - ], - ) + ], +)