README.md
155 lines
| 4.6 KiB
| text/x-minidsrc
|
MarkdownLexer
r887 | # Signal Chain | |||
## Introduction | ||||
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. | ||||
## Installation | ||||
|
r1110 | 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. | ||
r887 | ||||
|
r1029 | ### Linux based system | ||
r887 | ``` | |||
$ 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 | ||||
|
r1000 | $ git clone http://jro-dev.igp.gob.pe/rhodecode/schain/ | ||
$ cd schain | ||||
r887 | $ sudo pip install ./ | |||
``` | ||||
|
r1029 | ### MAC Os | ||
``` | ||||
|
r1110 | $ brew install python | ||
|
r1029 | $ brew install cartr/qt4/pyqt | ||
$ git clone http://jro-dev.igp.gob.pe/rhodecode/schain/ | ||||
$ cd schain | ||||
$ pip install ./ | ||||
``` | ||||
|
r1110 | **It is recommended to install schain in a virtual environment** | ||
|
r1102 | ``` | ||
|
r1110 | $ virtualenv /path/to/virtual | ||
$ source /path/to/virtual/bin/activate | ||||
(virtual) $ cd schain | ||||
(virtual) $ pip install ./ | ||||
(virtual) $ bash link_PyQt4.sh | ||||
|
r1102 | ``` | ||
|
r1118 | ### Docker | ||
Download Dockerfile from the repository, and create a docker image | ||||
``` | ||||
$ 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 | ||||
|
r1210 | $ docker run -it --rm --volume /path/to/host/data:/data --entrypoint /urs/local/bin/python schain /data/test.py | ||
|
r1118 | ``` | ||
r887 | ## First Script | |||
Read Spectra data (.pdata) - remove dc - plot spectra & RTI | ||||
Import SCh and creating a project | ||||
```python | ||||
#!/usr/bin/python | ||||
from schainpy.controller import Project | ||||
controller = Project() | ||||
controller.setup(id = '100', | ||||
name='test', | ||||
description='Basic experiment') | ||||
``` | ||||
Adding read unit and operations | ||||
```python | ||||
read_unit = controller.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 = controller.addProcUnit(datatype='Spectra', | ||||
inputId=read_unit.getId()) | ||||
op = proc_unit.addOperation(name='selectChannels') | ||||
op.addParameter(name='channelList', value='0,1', format='intlist') | ||||
op = proc_unit.addOperation(name='selectHeights') | ||||
op.addParameter(name='minHei', value='80', format='float') | ||||
op.addParameter(name='maxHei', value='200', format='float') | ||||
op = proc_unit.addOperation(name='removeDC') | ||||
``` | ||||
Plotting data & start project | ||||
```python | ||||
op = proc_unit.addOperation(name='SpectraPlot', optype='other') | ||||
op.addParameter(name='id', value='1', format='int') | ||||
op.addParameter(name='wintitle', value='Spectra', format='str') | ||||
op = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | ||||
op.addParameter(name='id', value='2', format='int') | ||||
op.addParameter(name='wintitle', value='RTI', format='str') | ||||
controller.start() | ||||
``` | ||||
Full script | ||||
```python | ||||
#!/usr/bin/python | ||||
from schainpy.controller import Project | ||||
controller = Project() | ||||
controller.setup(id = '100', | ||||
name='test', | ||||
description='Basic experiment') | ||||
read_unit = controller.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 = controller.addProcUnit(datatype='Spectra', | ||||
inputId=read_unit.getId()) | ||||
op = proc_unit.addOperation(name='selectChannels') | ||||
op.addParameter(name='channelList', value='0,1', format='intlist') | ||||
op = proc_unit.addOperation(name='selectHeights') | ||||
op.addParameter(name='minHei', value='80', format='float') | ||||
op.addParameter(name='maxHei', value='200', format='float') | ||||
op = proc_unit.addOperation(name='removeDC') | ||||
op = proc_unit.addOperation(name='SpectraPlot', optype='other') | ||||
op.addParameter(name='id', value='6', format='int') | ||||
op.addParameter(name='wintitle', value='Spectra', format='str') | ||||
op = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | ||||
op.addParameter(name='id', value='2', format='int') | ||||
op.addParameter(name='wintitle', value='RTI', format='str') | ||||
controller.start() | ||||
r1222 | ``` | |||