From 16056ee075111b5451ca9152fa1d5d7f1e2b4731 2020-08-25 07:20:57 From: Juan C. Espinoza Date: 2020-08-25 07:20:57 Subject: [PATCH] Add license, update setup and changelog --- diff --git a/.gitignore b/.gitignore index e0bc00e..c31424d 100644 --- a/.gitignore +++ b/.gitignore @@ -100,15 +100,3 @@ ENV/ # eclipse .project .pydevproject -# vscode - -.vscode - -schaingui/node_modules/ -schainpy/scripts/ -.svn/ -*.png -*.pyc -.vscode -trash -*.log diff --git a/CHANGELOG.md b/CHANGELOG.md index ab3a8ca..b3230cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,19 @@ -# CHANGELOG: +# CHANGELOG + +## 3.0.0 -## 3.0 * Python 3.x & 2.X compatible * New architecture with multiprocessing support * Add @MPDecorator for multiprocessing Operations (Plots, Writers and Publishers) * Added new type of operation `external` for non-locking operations * New plotting architecture with buffering/throttle capabilities to speed up plots * Clean controller to optimize scripts (format & optype are no longer required) +* Replace ParamReader and ParamWriter with new flexible HDFReader and HDFWriter * New GUI with dinamic load of Units and operations (use Kivy framework) +* Clean code ## 2.3 + * Added support for Madrigal formats (reading/writing). * Added support for reading BLTR parameters (*.sswma). * Added support for reading Julia format (*.dat). @@ -17,11 +21,11 @@ * Added two new Processing Units `PublishData` and `ReceiverData` for receiving and sending dataOut through multiple ways (tcp, ipc, inproc). * Added a new graphics Processing Unit `PlotterReceiver`. It is decoupled from normal processing sequence with support for data generated by multiprocessing scripts. * Added support for sending realtime graphic to web server. -* GUI command `schain` is now `schainGUI`. -* Added a CLI tool named `schain`. - * Scripts templates can be now generated with `schain generate`. - * Now it is possible to search Processing Units and Operations with `schain search [module]` to get the right name and its allowed parameters. - * `schain xml` to run xml scripts. +* GUI command `schain` is now `schainGUI`. +* Added a CLI tool named `schain`. + * Scripts templates can be now generated with `schain generate`. + * Now it is possible to search Processing Units and Operations with `schain search [module]` to get the right name and its allowed parameters. + * `schain xml` to run xml scripts. * Added suggestions when parameters are poorly written. * `Controller.start()` now runs in a different process than the process calling it. * Added `schainpy.utils.log` for log standarization. @@ -31,6 +35,7 @@ * Setup now installs numpy. ## 2.2.6 + * Graphics generated by the GUI are now the same as generated by scripts. Issue #1074. * Added support for C extensions. * Function `hildebrand_sehkon` optimized with a C wrapper. @@ -38,27 +43,32 @@ * Migration to GIT. ## 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 * script "schain" was added to Signal Chain installer ## 2.2.4.1: + * jroIO_usrp.py is update to read Sandra's data * decimation in Spectra and RTI plots is always enabled. * time* window option added to GUI ## 2.2.4: + * jroproc_spectra_lags.py added to schainpy * Bug fixed in schainGUI: ProcUnit was created with the same id in some cases. * Bug fixed in jroHeaderIO: Header size validation. ## 2.2.3.1: + * Filtering block by time has been added. * Bug fixed plotting RTI, CoherenceMap and others using xmin and xmax parameters. The first day worked properly but the next days did not. ## 2.2.3: + * Bug fixed in GUI: Error getting(reading) Code value * Bug fixed in GUI: Flip option always needs channelList field * Bug fixed in jrodata: when one branch modified a value in "dataOut" (example: dataOut.code) this value @@ -66,10 +76,12 @@ was modified for every branch (because this was a reference). It was modified in * Bug fixed in jroproc_voltage.profileSelector(): rangeList replaces to profileRangeList. ## 2.2.2: + * VoltageProc: ProfileSelector, Reshape, Decoder with nTxs!=1 and getblock=True was tested * Rawdata and testRawdata.py added to Signal Chain project ## 2.2.1: + * Bugs fixed in GUI * Views were improved in GUI * Support to MST* ISR experiments @@ -77,36 +89,45 @@ was modified for every branch (because this was a reference). It was modified in * handleError added to jroplotter.py ## 2.2.0: + * GUI: use of external plotter * Compatible with matplotlib 1.5.0 ## 2.1.5: + * serializer module added to Signal Chain * jroplotter.py added to Signal Chain ## 2.1.4.2: + * A new Plotter Class was added * Project.start() does not accept filename as a parameter anymore ## 2.1.4.1: + * Send notifications when an error different to ValueError is detected ## 2.1.4: + * Sending error notifications to signal chain administrator * Login to email server added ## 2.1.3.3: + * Colored Button Icons were added to GUI ## 2.1.3.2: + * GUI: user interaction enhanced * controller_api.py: Safe access to ControllerThead ## 2.1.3.1: + * GUI: every icon were resized * jroproc_voltage.py: Print a message when "Read from code" option is selected and the code is not defined inside data file ## 2.1.3: + * jroplot_heispectra.py: SpectraHeisScope was not showing the right channels * jroproc_voltage.py: Bug fixed selecting profiles (self.nProfiles took a wrong value), Bug fixed selecting heights by block (selecting profiles instead heights) @@ -115,6 +136,7 @@ was modified for every branch (because this was a reference). It was modified in * jroIO_heispectra.py: Channel index list does not exist. ## 2.1.2: + * jroutils_ftp.py: Bug fixed, Any error sending file stopped the Server Thread Server thread opens and closes remote server each time file list is sent * jroplot_spectra.py: Noise path was not being created when noise data is saved. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..79238d9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,28 @@ +This software, unless otherwise noted, is licensed under the BSD 3-clause. + +Copyright (c) 2012-2020 Jicamarca Radio Observatory + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 6d25e2d..a9de87c 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,50 @@ # Signal Chain -## Introduction +Signal Chain is a radar data processing library wich includes modules to read, +and write different files formats, besides modules to process and visualize the +data. -Signal Chain (SCh) is a radar data processing library developed using [Python](www.python.org) at JRO. SCh provides modules to read, write, process and plot data. +## Dependencies -## Installation - -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, we strongly recommend to use Anaconda or a virtual environment for the installation. - -### Dependencies - GCC (gcc or gfortran) - Python.h (python-dev or python-devel) - Python-TK (python-tk) - HDF5 libraries (libhdf5-dev) -### Linux based system (e.g. ubuntu) -``` -$ git clone http://jro-dev.igp.gob.pe/rhodecode/schain/ -$ cd schain -$ git checkout `schain-branch` (optional) -$ sudo pip install ./ -``` +## Installation -### MAC Os -``` -$ brew install python -$ git clone http://jro-dev.igp.gob.pe/rhodecode/schain/ -$ cd schain -$ git checkout `schain-branch` (optional) -$ sudo pip install ./ +To get started the easiest way to install it is through [PyPI](https://pypi.org/project/schainpy/) with pip: + +```bash +pip install schainpy ``` -### Docker +### From source -Download Dockerfile from the repository, and create a docker image +First, ensure that you have the above-listed dependencies installed, then clone +the repository and install as normal python package: +```bash +git clone https://github.com/JRO-Peru/schain.git +cd schain +git checkout `branch-name` (optional) +sudo pip install ./ ``` -$ 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 +### Using Docker + +Download Dockerfile from the repository, and create a docker image: + +```bash +docker build -t schain . ``` -$ 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 /urs/local/bin/python schain /data/test.py + +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: + +```bash +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 /urs/local/bin/python schain /data/test.py ``` ## CLI (command line interface) @@ -52,12 +54,10 @@ Signal Chain provides the following commands: - schainGUI: Open the GUI - schain: Signal chain command line +## Example -## First Script - -Here you can find an script to read Spectra data (.pdata), remove dc and plot spectra & RTI - -First import SCh and creating a project +Here you can find an script to read Spectra data (.pdata), remove dc and plot +self-spectra & RTI: ```python #!/usr/bin/python @@ -65,16 +65,7 @@ First import SCh and creating a project from schainpy.controller import Project prj = Project() -prj.setup( - id = '100', - name='test', - description='Basic experiment' - ) -``` -Add read unit and operations - -```python read_unit = prj.addReadUnit( datatype='Spectra', path='/path/to/pdata/', @@ -86,57 +77,10 @@ read_unit = prj.addReadUnit( walk=0 ) -proc_unit = prj.addProcUnit(datatype='Spectra', inputId=read_unit.getId()) - -op = proc_unit.addOperation(name='selectChannels') -op.addParameter(name='channelList', value='0,1') - -op = proc_unit.addOperation(name='selectHeights') -op.addParameter(name='minHei', value='80') -op.addParameter(name='maxHei', value='200') - -op = proc_unit.addOperation(name='removeDC') - -``` - -Plot data & start project - -```python -op = proc_unit.addOperation(name='SpectraPlot') -op.addParameter(name='id', value='1') -op.addParameter(name='wintitle', value='Spectra') - -op = procUnitConfObj1.addOperation(name='RTIPlot') -op.addParameter(name='id', value='2') -op.addParameter(name='wintitle', value='RTI') - -prj.start() - -``` - -Full script - - -```python -#!/usr/bin/python - -from schainpy.prj import Project - -prj = Project() -prj.setup(id = '100', - name='test', - description='Basic experiment') -read_unit = prj.addReadUnit(datatype='Spectra', - path='/path/to/pdata/', - startDate='2014/01/31', - endDate='2014/03/31', - startTime='00:00:00', - endTime='23:59:59', - online=0, - walk=0) - -proc_unit = prj.addProcUnit(datatype='Spectra', - inputId=read_unit.getId()) +proc_unit = prj.addProcUnit( + datatype='Spectra', + inputId=read_unit.getId() + ) op = proc_unit.addOperation(name='selectChannels') op.addParameter(name='channelList', value='0,1') @@ -155,4 +99,4 @@ op.addParameter(name='wintitle', value='RTI', format='str') prj.start() -``` \ No newline at end of file +``` diff --git a/schainpy/__init__.py b/schainpy/__init__.py index d51d41f..862c806 100644 --- a/schainpy/__init__.py +++ b/schainpy/__init__.py @@ -1,7 +1,5 @@ -''' -Created on Jul 3, 2018 +"""Signal chain python package""" -@author $Author$ -@version $Id$ -''' -__version__ = '3.0' +from .controller import Project + +__version__ = '3.0.0' diff --git a/schainpy/controller.py b/schainpy/controller.py index 3bbf5f4..c11c6f2 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -1,6 +1,11 @@ -''' -Main routines to create a Signal Chain project -''' +# Copyright (c) 2012-2020 Jicamarca Radio Observatory +# All rights reserved. +# +# Distributed under the terms of the BSD 3-clause license. +"""API to create signal chain projects + +The API is provide through class: Project +""" import re import sys @@ -312,13 +317,16 @@ class ReadUnitConf(ProcUnitConf): class Project(Process): + """API to create signal chain projects""" ELEMENTNAME = 'Project' def __init__(self): - Process.__init__(self) - self.id = None + Process.__init__(self, name='') + self.id = '1' + if name: + self.name = '{} ({})'.format(Process.__name__, name) self.filename = None self.description = None self.email = None diff --git a/setup.py b/setup.py index 0518d4d..74eb5fc 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,21 @@ -''' -Created on Jul 16, 2014 +# Copyright (c) 2012-2020 Jicamarca Radio Observatory +# All rights reserved. +# +# Distributed under the terms of the BSD 3-clause license. +"""schainpy is an open source library to read, write and process radar data -@author: Miguel Urco -@author: Juan C. Espinoza -''' +Signal Chain is a radar data processing library wich includes modules to read, +and write different files formats, besides modules to process and visualize the +data. +""" import os from setuptools import setup, Extension from setuptools.command.build_ext import build_ext as _build_ext from schainpy import __version__ +DOCLINES = __doc__.split("\n") + class build_ext(_build_ext): def finalize_options(self): _build_ext.finalize_options(self) @@ -21,10 +27,27 @@ class build_ext(_build_ext): setup( name = "schainpy", version = __version__, - description = "Python tools to read, write and process Jicamarca data", - author = "Miguel Urco, Juan C. Espinoza", - author_email = "juan.espinoza@jro.igp.gob.pe", - url = "http://jro-dev.igp.gob.pe/rhodecode/schain", + description = DOCLINES[0], + long_description = "\n".join(DOCLINES[2:]), + url = "https://github.com/JRO-Peru/schain", + author = "Jicamarca Radio Observatory", + author_email = "jro-developers@igp.gob.pe", + license="BSD-3-Clause", + classifiers=[ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Topic :: Scientific/Engineering", + ], packages = { 'schainpy', 'schainpy.model',