pygmi 2.2.7__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. pygmi-2.2.7/LICENSE.txt +623 -0
  2. pygmi-2.2.7/MANIFEST.in +7 -0
  3. pygmi-2.2.7/PKG-INFO +47 -0
  4. pygmi-2.2.7/README.md +55 -0
  5. pygmi-2.2.7/README.rst +20 -0
  6. pygmi-2.2.7/log.txt +242 -0
  7. pygmi-2.2.7/pygmi/__init__.py +22 -0
  8. pygmi-2.2.7/pygmi/clust/__init__.py +4 -0
  9. pygmi-2.2.7/pygmi/clust/crisp_clust.py +708 -0
  10. pygmi-2.2.7/pygmi/clust/datatypes.py +65 -0
  11. pygmi-2.2.7/pygmi/clust/fuzzy_clust.py +906 -0
  12. pygmi-2.2.7/pygmi/clust/graphs.py +421 -0
  13. pygmi-2.2.7/pygmi/clust/graphtool.py +667 -0
  14. pygmi-2.2.7/pygmi/clust/menu.py +139 -0
  15. pygmi-2.2.7/pygmi/clust/var_ratio.py +92 -0
  16. pygmi-2.2.7/pygmi/clust/xie_beni.py +93 -0
  17. pygmi-2.2.7/pygmi/helpdocs/linepointer.png +0 -0
  18. pygmi-2.2.7/pygmi/helpdocs/pygmi.main.html +31 -0
  19. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.ddisp.html +15 -0
  20. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.iodefs.exportkmz.html +13 -0
  21. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.iodefs.importpicture.html +16 -0
  22. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.layer.html +17 -0
  23. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.mext.html +44 -0
  24. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.misc.rangedcopy.html +16 -0
  25. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.param.html +37 -0
  26. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.prof.html +32 -0
  27. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.pview.html +26 -0
  28. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.gradients.html +14 -0
  29. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.tilt.html +14 -0
  30. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.visibility.html +14 -0
  31. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datagrid.html +13 -0
  32. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datamerge.html +11 -0
  33. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datareproj.html +11 -0
  34. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.rtp.html +14 -0
  35. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.ginterp.html +31 -0
  36. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.igrf.html +20 -0
  37. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.normalisation.html +14 -0
  38. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.smooth.html +22 -0
  39. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.tiltdepth.html +20 -0
  40. pygmi-2.2.7/pygmi/images/Help.png +0 -0
  41. pygmi-2.2.7/pygmi/images/bringtofront.png +0 -0
  42. pygmi-2.2.7/pygmi/images/cgs2.emf +0 -0
  43. pygmi-2.2.7/pygmi/images/delete.png +0 -0
  44. pygmi-2.2.7/pygmi/images/linepointer.png +0 -0
  45. pygmi-2.2.7/pygmi/images/logo256.ico +0 -0
  46. pygmi-2.2.7/pygmi/images/logo256.png +0 -0
  47. pygmi-2.2.7/pygmi/images/pointer.png +0 -0
  48. pygmi-2.2.7/pygmi/images/pygmi.png +0 -0
  49. pygmi-2.2.7/pygmi/images/sendtoback.png +0 -0
  50. pygmi-2.2.7/pygmi/main.py +1037 -0
  51. pygmi-2.2.7/pygmi/menu_default.py +327 -0
  52. pygmi-2.2.7/pygmi/misc.py +147 -0
  53. pygmi-2.2.7/pygmi/pfmod/__init__.py +6 -0
  54. pygmi-2.2.7/pygmi/pfmod/cubes.py +1488 -0
  55. pygmi-2.2.7/pygmi/pfmod/datatypes.py +292 -0
  56. pygmi-2.2.7/pygmi/pfmod/grvmag3d.py +1265 -0
  57. pygmi-2.2.7/pygmi/pfmod/iodefs.py +1001 -0
  58. pygmi-2.2.7/pygmi/pfmod/menu.py +107 -0
  59. pygmi-2.2.7/pygmi/pfmod/misc.py +301 -0
  60. pygmi-2.2.7/pygmi/pfmod/pfmod.py +248 -0
  61. pygmi-2.2.7/pygmi/pfmod/tab_ddisp.py +425 -0
  62. pygmi-2.2.7/pygmi/pfmod/tab_layer.py +490 -0
  63. pygmi-2.2.7/pygmi/pfmod/tab_mext.py +544 -0
  64. pygmi-2.2.7/pygmi/pfmod/tab_param.py +548 -0
  65. pygmi-2.2.7/pygmi/pfmod/tab_prof.py +946 -0
  66. pygmi-2.2.7/pygmi/pfmod/tab_pview.py +740 -0
  67. pygmi-2.2.7/pygmi/raster/IGRF11.COF +1635 -0
  68. pygmi-2.2.7/pygmi/raster/__init__.py +14 -0
  69. pygmi-2.2.7/pygmi/raster/cooper.py +718 -0
  70. pygmi-2.2.7/pygmi/raster/dataprep.py +1640 -0
  71. pygmi-2.2.7/pygmi/raster/datatypes.py +123 -0
  72. pygmi-2.2.7/pygmi/raster/equation_editor.py +256 -0
  73. pygmi-2.2.7/pygmi/raster/ginterp.py +1901 -0
  74. pygmi-2.2.7/pygmi/raster/graphs.py +531 -0
  75. pygmi-2.2.7/pygmi/raster/igrf.py +860 -0
  76. pygmi-2.2.7/pygmi/raster/iodefs.py +813 -0
  77. pygmi-2.2.7/pygmi/raster/menu.py +307 -0
  78. pygmi-2.2.7/pygmi/raster/normalisation.py +187 -0
  79. pygmi-2.2.7/pygmi/raster/show_table.py +245 -0
  80. pygmi-2.2.7/pygmi/raster/smooth.py +406 -0
  81. pygmi-2.2.7/pygmi/raster/tiltdepth.py +590 -0
  82. pygmi-2.2.7/pygmi/seis/__init__.py +0 -0
  83. pygmi-2.2.7/pygmi/seis/beachball.py +751 -0
  84. pygmi-2.2.7/pygmi/seis/datatypes.py +605 -0
  85. pygmi-2.2.7/pygmi/seis/del_rec.py +410 -0
  86. pygmi-2.2.7/pygmi/seis/iodefs.py +1261 -0
  87. pygmi-2.2.7/pygmi/seis/menu.py +136 -0
  88. pygmi-2.2.7/pygmi/seis/scan_imp.py +795 -0
  89. pygmi-2.2.7/pygmi/test/__init__.py +6 -0
  90. pygmi-2.2.7/pygmi/test/pfmod.py +212 -0
  91. pygmi-2.2.7/pygmi/test/tests.py +39 -0
  92. pygmi-2.2.7/pygmi/vector/__init__.py +7 -0
  93. pygmi-2.2.7/pygmi/vector/datatypes.py +74 -0
  94. pygmi-2.2.7/pygmi/vector/graphs.py +443 -0
  95. pygmi-2.2.7/pygmi/vector/iodefs.py +345 -0
  96. pygmi-2.2.7/pygmi/vector/menu.py +127 -0
  97. pygmi-2.2.7/pygmi.egg-info/PKG-INFO +47 -0
  98. pygmi-2.2.7/pygmi.egg-info/SOURCES.txt +105 -0
  99. pygmi-2.2.7/pygmi.egg-info/dependency_links.txt +1 -0
  100. pygmi-2.2.7/pygmi.egg-info/entry_points.txt +3 -0
  101. pygmi-2.2.7/pygmi.egg-info/not-zip-safe +1 -0
  102. pygmi-2.2.7/pygmi.egg-info/requires.txt +7 -0
  103. pygmi-2.2.7/pygmi.egg-info/top_level.txt +1 -0
  104. pygmi-2.2.7/quickstart.py +35 -0
  105. pygmi-2.2.7/setup.cfg +8 -0
  106. pygmi-2.2.7/setup.py +80 -0
@@ -0,0 +1,410 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Name: del_rec.py (part of PyGMI)
3
+ #
4
+ # Author: Patrick Cole
5
+ # E-Mail: pcole@geoscience.org.za
6
+ #
7
+ # Copyright: (c) 2013 Council for Geoscience
8
+ # Licence: GPL-3.0
9
+ #
10
+ # This file is part of PyGMI
11
+ #
12
+ # PyGMI is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # PyGMI is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU General Public License
23
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ # -----------------------------------------------------------------------------
25
+ """ This program deletes seisan records """
26
+
27
+ import numpy as np
28
+ from PyQt4 import QtGui
29
+ import os
30
+ import matplotlib.pyplot as plt
31
+
32
+
33
+ class DeleteRecord(object):
34
+ """ Main form which does the GUI and the program """
35
+ def __init__(self, parent=None):
36
+ # Initialize Variables
37
+ self.parent = parent
38
+ self.indata = {'tmp': True}
39
+ self.outdata = {}
40
+ self.showtext = self.parent.showprocesslog
41
+
42
+ self.settings()
43
+
44
+ def settings(self):
45
+ """ Settings """
46
+ self.showtext('Delete Rows starting')
47
+
48
+ ifile = QtGui.QFileDialog.getOpenFileName()[0]
49
+ if ifile == '':
50
+ return
51
+ os.chdir(ifile.rpartition('/')[0])
52
+
53
+ self.delrec(ifile)
54
+
55
+ return True
56
+
57
+ def delrec(self, ifile):
58
+ """ Deletes record """
59
+
60
+ ofile = ifile[:-4]+'_new.out'
61
+
62
+ self.showtext('Input Filename: '+ifile)
63
+ self.showtext('Output Filename: '+ofile)
64
+
65
+ outputf = open(ofile, 'w')
66
+ inputf = open(ifile)
67
+
68
+ skey = QtGui.QInputDialog.getText(
69
+ self.parent, 'Delete Criteria',
70
+ 'Please input the terms used to decide on lines to delete',
71
+ QtGui.QLineEdit.Normal, 'AML, IAML')[0]
72
+
73
+ skey = str(skey).upper()
74
+
75
+ self.showtext('Delete Criteria: '+skey)
76
+ self.showtext('Working...')
77
+
78
+ skey = skey.replace(' ', '')
79
+ skey = skey.split(',')
80
+
81
+ idata = inputf.readlines()
82
+ odata = idata
83
+ for j in skey:
84
+ odata = [i for i in odata if i.find(j) < 0]
85
+
86
+ outputf.writelines(odata) # Insert a blank line
87
+
88
+ # Close files
89
+ inputf.close()
90
+ outputf.close()
91
+
92
+ self.showtext('Completed!')
93
+
94
+
95
+ class Quarry(object):
96
+ """ Main form which does the GUI and the program """
97
+ def __init__(self, parent=None):
98
+ # Initialize Variables
99
+ self.parent = parent
100
+ self.indata = {'tmp': True}
101
+ self.outdata = {}
102
+ self.showtext = self.parent.showprocesslog
103
+
104
+ self.settings()
105
+
106
+ def settings(self):
107
+ """ Settings """
108
+ self.showtext('Delete quarry events starting')
109
+
110
+ ifile = QtGui.QFileDialog.getOpenFileName()[0]
111
+ if ifile == '':
112
+ return
113
+
114
+ os.chdir(ifile.rpartition('/')[0])
115
+
116
+ self.calcrq2(ifile)
117
+
118
+ return True
119
+
120
+ def calcrq2(self, ifile):
121
+ """ Calculates the Rq value """
122
+ ofile = ifile[:-4]+'_new.out'
123
+ ofile2 = ifile[:-4]+'_del.out'
124
+
125
+ inputf = open(ifile)
126
+
127
+ self.showtext('Working...')
128
+
129
+ idata = inputf.readlines()
130
+ date = []
131
+ hour = []
132
+ lat = []
133
+ lon = []
134
+ for i in idata:
135
+ date.append(i[0:21])
136
+ hour.append(int(i[17:19]))
137
+ lat.append(float(i[29:36]))
138
+ lon.append(float(i[38:44]))
139
+
140
+ day = [6, 19]
141
+ hour = np.array(hour)
142
+ hour[hour < day[0]] = -99
143
+ hour[hour > day[1]] = -99
144
+ hour[hour != -99] = True
145
+ hour[hour == -99] = False
146
+ idata = np.array(idata)
147
+
148
+ lon = np.array(lon)
149
+ lat = np.array(lat)
150
+ ld = day[1]-day[0]
151
+ ln = 24-ld
152
+ rdist = 0.2
153
+ nmin = 50
154
+ nmax = 400
155
+ nstep = 50
156
+ nrange = list(range(nmin, nmax+nstep, nstep))
157
+ rlyrs = len(nrange)
158
+ stayinloop = True
159
+
160
+ ilat = []
161
+ ilon = []
162
+ ihour = []
163
+ iidata = []
164
+
165
+ rperc = self.randrq(nmax, nstep, nrange, day)
166
+ self.showtext('Calculating Rq values')
167
+
168
+ while stayinloop:
169
+ cnt = hour.shape[0]
170
+ nd = np.zeros([cnt, rlyrs])
171
+ nn = np.zeros([cnt, rlyrs])
172
+ mask = np.ones(cnt).astype(bool)
173
+
174
+ for i in range(cnt):
175
+ londiff = lon-lon[i]
176
+ latdiff = lat-lat[i]
177
+ r = np.sqrt(londiff**2+latdiff**2)
178
+ if r.min() > rdist:
179
+ nn[i] = 1.
180
+ continue
181
+ rs = np.argsort(r)
182
+ rs = rs[:nmax]
183
+ r = r[rs]
184
+ rs = rs[r < rdist]
185
+ hrs = hour[rs]
186
+ for N in nrange:
187
+ ndx = N/nstep-1
188
+ nd[i, ndx] = hrs[:N].sum()
189
+ nn[i, ndx] = N-nd[i, ndx]
190
+ if nn[i, ndx] == 0:
191
+ mask[i] = False
192
+ nn[i, ndx] = N
193
+ nd[i, ndx] = 0
194
+
195
+ rq = (nd*ln)/(nn*ld)
196
+
197
+ for ndx in range(len(nrange)):
198
+ rq[:, ndx][rq[:, ndx] > rperc[ndx][1]] = rperc[ndx][1]
199
+ rq[:, ndx] -= rperc[ndx][0]
200
+ rq[:, ndx] /= (rperc[ndx][1]-rperc[ndx][0])
201
+ rq[:, ndx] *= 100.
202
+
203
+ tmpcnt = []
204
+ for i in range(rlyrs):
205
+ tmpcnt.append(np.where(rq[:, i] > 99.)[0].shape[0])
206
+
207
+ self.showtext(str(tmpcnt)+' possible eliminations in '
208
+ + ' event groups: ' + str(nrange), True)
209
+
210
+ tmax = np.transpose(np.where(rq == rq.max()))[0]
211
+ i, ndx = tmax
212
+
213
+ if rq[i, ndx] > 99.:
214
+ londiff = lon-lon[i]
215
+ latdiff = lat-lat[i]
216
+ r = np.sqrt(londiff**2+latdiff**2)
217
+ rs = np.argsort(r)
218
+ rs = rs[:(ndx+1)*nstep]
219
+ r = r[rs]
220
+ rs = rs[r < rdist]
221
+
222
+ mask[rs] = False
223
+ ilat += lat[np.logical_not(mask)].tolist()
224
+ ilon += lon[np.logical_not(mask)].tolist()
225
+ ihour += hour[np.logical_not(mask)].tolist()
226
+ iidata += idata[np.logical_not(mask)].tolist()
227
+ lat = lat[mask]
228
+ lon = lon[mask]
229
+ hour = hour[mask]
230
+ idata = idata[mask]
231
+ else:
232
+ stayinloop = False
233
+
234
+ plt.plot(lon, lat, 'r.')
235
+ plt.plot(ilon, ilat, 'b.')
236
+ plt.show()
237
+
238
+ outputf2 = open(ofile2, 'w')
239
+ outputf = open(ofile, 'w')
240
+
241
+ outputf2.writelines(iidata)
242
+ outputf.writelines(idata)
243
+
244
+ inputf.close()
245
+ outputf.close()
246
+ outputf2.close()
247
+
248
+ self.showtext('Completed!')
249
+
250
+ # def calcrq(self, ifile):
251
+ # """ Calculates the Rq value """
252
+ # ofile = ifile[:-4]+'_new.out'
253
+ #
254
+ # outputf = open(ofile, 'w')
255
+ # inputf = open(ifile)
256
+ #
257
+ # self.showtext('Working...')
258
+ #
259
+ # idata = inputf.readlines()
260
+ # ## odata = idata
261
+ # date = []
262
+ # hour = []
263
+ # lat = []
264
+ # lon = []
265
+ # for i in idata:
266
+ # date.append(i[0:21])
267
+ # hour.append(int(i[17:19]))
268
+ # lat.append(float(i[29:36]))
269
+ # lon.append(float(i[38:44]))
270
+ #
271
+ # day = [6, 19]
272
+ # hour = np.array(hour)
273
+ # hour[hour < day[0]] = -99
274
+ # hour[hour > day[1]] = -99
275
+ # hour[hour != -99] = True
276
+ # hour[hour == -99] = False
277
+ # idata = np.array(idata)
278
+ #
279
+ # lon = np.array(lon)
280
+ # lat = np.array(lat)
281
+ # ld = day[1]-day[0]
282
+ # ln = 24-ld
283
+ # dxy = 0.1
284
+ # dxyd2 = np.sqrt(2)*dxy
285
+ # lonrange = lon.max()-lon.min()+dxy
286
+ # latrange = lat.max()-lat.min()+dxy
287
+ # tlx = lon.min()
288
+ # tly = lat.max()
289
+ # rows = int(latrange/dxy)
290
+ # cols = int(lonrange/dxy)
291
+ # nmin = 50
292
+ # nmax = 400
293
+ # nstep = 50
294
+ # nrange = list(range(nmin, nmax+nstep, nstep))
295
+ # rlyrs = len(nrange)
296
+ # stayinloop = True
297
+ #
298
+ # ttt.since_last_call()
299
+ # rperc = self.randrq(nmax, nstep, nrange, day)
300
+ # self.showtext('Calculating Rq values')
301
+ #
302
+ # ttt.since_last_call('Begin of while loop')
303
+ #
304
+ # plt.figure(1)
305
+ # plt.plot(lon, lat, 'b.')
306
+ # plt.show()
307
+ # QtGui.QApplication.processEvents()
308
+ #
309
+ # while stayinloop:
310
+ # nd = np.zeros([rows, cols, rlyrs])
311
+ # nn = np.zeros([rows, cols, rlyrs])
312
+ # cnt = hour.shape[0]
313
+ # mask = np.ones(cnt).astype(bool)
314
+ #
315
+ # for i in range(cols):
316
+ # londiff = (tlx+i*dxy)-lon
317
+ # for j in range(rows):
318
+ # latdiff = (tly-j*dxy)-lat
319
+ # r = np.sqrt(londiff**2+latdiff**2)
320
+ # if r.min() > dxyd2:
321
+ # nn[j, i] = 1.
322
+ # continue
323
+ # rs = np.argsort(r)
324
+ # rs = rs[:nmax]
325
+ # r = r[rs]
326
+ # rs = rs[r < dxyd2]
327
+ # hrs = hour[rs]
328
+ # for N in nrange:
329
+ # ndx = N/nstep-1
330
+ # nd[j, i, ndx] = hrs[:N].sum()
331
+ # nn[j, i, ndx] = N-nd[j, i, ndx]
332
+ # if nn[j, i, ndx] == 0:
333
+ # mask[rs[:N]] = False
334
+ # nn[j, i, ndx] = N
335
+ # nd[j, i, ndx] = 0
336
+ #
337
+ # rq = (nd*ln)/(nn*ld)
338
+ # ## rq[rq == np.inf] = max(rq[rq < np.inf].max(), 100.)
339
+ #
340
+ # for ndx in range(len(nrange)):
341
+ # rq[:, :, ndx][rq[:, :, ndx] > rperc[ndx][1]] = rperc[ndx][1]
342
+ # rq[:, :, ndx] -= rperc[ndx][0]
343
+ # rq[:, :, ndx] /= (rperc[ndx][1]-rperc[ndx][0])
344
+ # rq[:, :, ndx] *= 100.
345
+ #
346
+ # tmax = np.transpose(np.where(rq == rq.max()))[0]
347
+ # j, i, ndx = tmax
348
+ # self.showtext('Rq percentile:'+str(rq[j, i, ndx]), True)
349
+ #
350
+ # ttt.since_last_call('section 2')
351
+ #
352
+ # if rq[j, i, ndx] > 99.:
353
+ # londiff = (tlx+i*dxy)-lon
354
+ # latdiff = (tly-j*dxy)-lat
355
+ # r = np.sqrt(londiff**2+latdiff**2)
356
+ # rs = np.argsort(r)
357
+ # rs = rs[:(ndx+1)*nstep]
358
+ # r = r[rs]
359
+ # rs = rs[r < dxyd2]
360
+ #
361
+ # ## cnt = hour.shape[0]
362
+ # ## mask = np.ones(cnt).astype(bool)
363
+ # mask[rs] = False
364
+ # lat = lat[mask]
365
+ # lon = lon[mask]
366
+ # hour = hour[mask]
367
+ # idata = idata[mask]
368
+ # else:
369
+ # stayinloop = False
370
+ # ttt.since_last_call('section 3')
371
+ #
372
+ # ttt.since_first_call('end')
373
+ #
374
+ # plt.figure(1)
375
+ # plt.plot(lon, lat, 'r.')
376
+ # plt.show()
377
+ #
378
+ # outputf.writelines(idata)
379
+ #
380
+ # # Close files
381
+ #
382
+ # inputf.close()
383
+ # outputf.close()
384
+ #
385
+ # self.showtext('Completed!')
386
+
387
+ def randrq(self, nmax, nstep, nrange, day):
388
+ """ Calculates random Rq values """
389
+
390
+ self.showtext('Calculating random Rq values for calibration')
391
+ rperc = []
392
+ nd = 0
393
+ ld = day[1]-day[0]
394
+ ln = 24-ld
395
+
396
+ for N in nrange:
397
+ self.showtext(str(N)+' of '+str(nmax), True)
398
+ tmp = np.random.rand(1000000, nstep)
399
+ tmp *= 24
400
+ tmp[tmp < day[0]] = -99
401
+ tmp[tmp > day[1]] = -99
402
+ tmp[tmp != -99] = True
403
+ tmp[tmp == -99] = False
404
+
405
+ nd += tmp.sum(1)
406
+ nn = N-nd
407
+ rq = (nd*ln)/(nn*ld)
408
+ rperc.append(np.percentile(rq, [99, 100]))
409
+
410
+ return rperc