##// END OF EJS Templates
Update setup and README
Juan C. Espinoza -
r1000:7e21d40a79b3 v2.2.5
parent child
Show More
@@ -0,0 +1,113
1 import h5py
2 import numpy
3 import matplotlib.pyplot as plt
4 import glob
5 import os
6
7 #---------------------- Functions ---------------------
8
9 def findFiles(path):
10
11 dirList = []
12 fileList = []
13
14 for thisPath in os.listdir(path):
15 dirList.append(os.path.join(path,thisPath))
16 dirList.sort()
17
18 for thisDirectory in dirList:
19 files = glob.glob1(thisDirectory, "*.hdf5")
20 files.sort()
21 for thisFile in files:
22 fileList.append(os.path.join(thisDirectory,thisFile))
23
24 return fileList
25
26 def readFiles(fileList):
27
28 meteors_array = numpy.zeros((1,4))
29
30 for thisFile in fileList:
31
32 #Leer
33 f1 = h5py.File(thisFile,'r')
34 grp1 = f1['Data']
35 grp2 = grp1['data_output']
36 meteors1 = grp2['table0'][:]
37 meteors_array = numpy.vstack((meteors_array,meteors1))
38 #cerrar
39 f1.close()
40
41 meteors_array = numpy.delete(meteors_array, 0, axis=0)
42 meteors_list = [meteors_array[:,0],meteors_array[:,1],meteors_array[:,2],meteors_array[:,3]]
43 return meteors_list
44
45 def estimateMean(offset_list):
46
47 mean_off = []
48 axisY_off = []
49 axisX_off = []
50
51 for thisOffset in offset_list:
52 mean_aux = numpy.mean(thisOffset, axis = 0)
53 mean_off.append(mean_aux)
54 axisX_off.append(numpy.array([0,numpy.size(thisOffset)]))
55 axisY_off.append(numpy.array([mean_aux,mean_aux]))
56
57 return mean_off, axisY_off, axisX_off
58
59 def plotPhases(offset0, axisY0, axisX0, title):
60 f, axarr = plt.subplots(4, sharey=True)
61 color = ['b','g','r','c']
62 # plt.grid()
63 for i in range(len(offset0)):
64 thisMeteor = offset0[i]
65 thisY = axisY0[i]
66 thisX = axisX0[i]
67 thisColor = color[i]
68
69 opt = thisColor + 'o'
70 axarr[i].plot(thisMeteor,opt)
71 axarr[i].plot(thisX, thisY, thisColor)
72 axarr[i].set_ylabel('Offset ' + str(i))
73
74 plt.ylim((-180,180))
75 axarr[0].set_title(title + ' Offsets')
76 axarr[3].set_xlabel('Number of estimations')
77
78 return
79
80 def filterOffsets(offsets0, stdvLimit):
81 offsets1 = []
82
83 for thisOffset in offsets0:
84 pstd = numpy.std(thisOffset)*stdvLimit
85 pmean = numpy.mean(thisOffset)
86 outlier1 = thisOffset > pmean - pstd
87 outlier2 = thisOffset < pmean + pstd
88 not_outlier = numpy.logical_and(outlier1,outlier2)
89 thisOffset1 = thisOffset[not_outlier]
90 offsets1.append(thisOffset1)
91
92 return offsets1
93
94 #---------------------- Setup ---------------------------
95
96 path = '/home/jespinoza/Pictures/JASMET30/201608/phase'
97 stdvLimit = 0.5
98
99 #---------------------- Script ---------------------------
100
101 fileList = findFiles(path)
102 offsets0 = readFiles(fileList)
103 mean0, axisY0, axisX0 = estimateMean(offsets0)
104 plotPhases(offsets0, axisY0, axisX0, 'Original')
105
106 offsets1 = filterOffsets(offsets0, stdvLimit)
107 mean1, axisY1, axisX1 = estimateMean(offsets1)
108 plotPhases(offsets1, axisY1, axisX1, 'Filtered')
109
110 print "Original Offsets: %.2f, %.2f, %.2f, %.2f" % (mean0[0],mean0[1],mean0[2],mean0[3])
111 print "Filtered Offsets: %.2f, %.2f, %.2f, %.2f" % (mean1[0],mean1[1],mean1[2],mean1[3])
112
113 plt.show()
@@ -3,4 +3,11
3 build/
3 build/
4 *.pyc
4 *.pyc
5 *.so
5 *.so
6 *.egg-info/ No newline at end of file
6 *.egg-info/
7
8 # eclipse
9 .project
10 .pydevproject
11
12 # vscode
13 .vscode No newline at end of file
@@ -6,12 +6,13 Signal Chain (SCh) is a radar data processing library developed using [Python](w
6
6
7 ## Installation
7 ## Installation
8
8
9 Install system dependencies, download the latest stable release from [svn](http://jro-dev.igp.gob.pe/svn/jro_soft/schain/Releases/) e.g. schainpy-2.2.5.tar.gz. and install it as a normal python package.
9 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.
10
10
11 ```
11 ```
12 $ 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
12 $ 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
13 $ tar xvzf schainpy-2.2.5.tar.gz
13 $ sudo pip install numpy
14 $ cd schainpy-2.2.5
14 $ git clone http://jro-dev.igp.gob.pe/rhodecode/schain/
15 $ cd schain
15 $ sudo pip install ./
16 $ sudo pip install ./
16 ```
17 ```
17
18
@@ -21,7 +22,7 $ sudo pip install ./
21 $ sudo pip install virtualenv
22 $ sudo pip install virtualenv
22 $ virtualenv /path/to/virtual --system-site-packages
23 $ virtualenv /path/to/virtual --system-site-packages
23 $ source /path/to/virtual/bin/activate
24 $ source /path/to/virtual/bin/activate
24 (virtual) $ cd schainpy-2.2.5
25 (virtual) $ cd schain
25 (virtual) $ pip install ./
26 (virtual) $ pip install ./
26 ```
27 ```
27
28
@@ -128,4 +129,4 op.addParameter(name='wintitle', value='RTI', format='str')
128
129
129 controller.start()
130 controller.start()
130
131
131 ```
132 ``` No newline at end of file
@@ -3,9 +3,9 Created on Jul 16, 2014
3
3
4 @author: Miguel Urco
4 @author: Miguel Urco
5 '''
5 '''
6
6 import numpy
7 from schainpy import __version__
8 from setuptools import setup, Extension
7 from setuptools import setup, Extension
8 from schainpy import __version__
9
9
10 setup(name="schainpy",
10 setup(name="schainpy",
11 version=__version__,
11 version=__version__,
@@ -34,7 +34,7 setup(name="schainpy",
34 include_package_data=False,
34 include_package_data=False,
35 scripts =['schainpy/gui/schainGUI',
35 scripts =['schainpy/gui/schainGUI',
36 'schainpy/scripts/schain'],
36 'schainpy/scripts/schain'],
37 ext_modules=[Extension("cSchain", ["schainpy/model/proc/extensions.c"])],
37 ext_modules=[Extension("cSchain", ["schainpy/model/proc/extensions.c"], include_dirs=[numpy.get_include()])],
38 install_requires=[
38 install_requires=[
39 "scipy >= 0.14.0",
39 "scipy >= 0.14.0",
40 "h5py >= 2.2.1",
40 "h5py >= 2.2.1",
General Comments 0
You need to be logged in to leave comments. Login now