-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtlseparation.utility.html
More file actions
1359 lines (1218 loc) · 72.3 KB
/
tlseparation.utility.html
File metadata and controls
1359 lines (1218 loc) · 72.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tlseparation.utility package — TLSeparation documentation</title>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="CHANGELOG" href="changelog.html" />
<link rel="prev" title="tlseparation.scripts package" href="tlseparation.scripts.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> TLSeparation
</a>
<div class="version">
1.3.2
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Table of Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="tlseparation.html">tlseparation package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="tlseparation.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="tlseparation.classification.html">tlseparation.classification package</a></li>
<li class="toctree-l3"><a class="reference internal" href="tlseparation.scripts.html">tlseparation.scripts package</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">tlseparation.utility package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.cloud_analysis">tlseparation.utility.cloud_analysis module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.clustering">tlseparation.utility.clustering module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.data_utils">tlseparation.utility.data_utils module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.downsampling">tlseparation.utility.downsampling module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.filtering">tlseparation.utility.filtering module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.knnsearch">tlseparation.utility.knnsearch module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.peakdetect">tlseparation.utility.peakdetect module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.shortpath">tlseparation.utility.shortpath module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility.voxels">tlseparation.utility.voxels module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-tlseparation.utility">Module contents</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="tlseparation.html#module-tlseparation">Module contents</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">CHANGELOG</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">TLSeparation</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li><a href="tlseparation.html">tlseparation package</a> »</li>
<li>tlseparation.utility package</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/tlseparation.utility.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="tlseparation-utility-package">
<h1>tlseparation.utility package<a class="headerlink" href="#tlseparation-utility-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-tlseparation.utility.cloud_analysis">
<span id="tlseparation-utility-cloud-analysis-module"></span><h2>tlseparation.utility.cloud_analysis module<a class="headerlink" href="#module-tlseparation.utility.cloud_analysis" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="tlseparation.utility.cloud_analysis.detect_nn_dist">
<code class="descclassname">tlseparation.utility.cloud_analysis.</code><code class="descname">detect_nn_dist</code><span class="sig-paren">(</span><em>arr</em>, <em>knn</em>, <em>sigma=1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/cloud_analysis.html#detect_nn_dist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.cloud_analysis.detect_nn_dist" title="Permalink to this definition">¶</a></dt>
<dd><p>Calcuates the optimum distance among neighboring points.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">N-dimensional array (m x n) containing a set of parameters (n) over
a set of observations (m).</p>
</dd>
<dt><strong>knn</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first last">Number of nearest neighbors to search to constitue the local subset
of points around each point in ‘arr’.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>dist</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Optimal distance among neighboring points.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.cloud_analysis.detect_optimal_knn">
<code class="descclassname">tlseparation.utility.cloud_analysis.</code><code class="descname">detect_optimal_knn</code><span class="sig-paren">(</span><em>arr, rad_lst=[0.1, 0.2, 0.3], sample_size=10000</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/cloud_analysis.html#detect_optimal_knn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.cloud_analysis.detect_optimal_knn" title="Permalink to this definition">¶</a></dt>
<dd><p>Detects optimal values for knn in order to facilitate material separation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr: array</strong></dt>
<dd><p class="first last">Set of 3D points.</p>
</dd>
<dt><strong>rad_lst: list</strong></dt>
<dd><p class="first last">Set of radius values to generate samples of neighborhoods. This is
used to select points to calculate a number of neighboring points
distribution from the point cloud.</p>
</dd>
<dt><strong>sample_size: int</strong></dt>
<dd><p class="first last">Number of points in arr to process in order to genrate a distribution.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>knn_lst: list</strong></dt>
<dd><p class="first last">Set of k-nearest neighbors values.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.cloud_analysis.detect_rad_nn">
<code class="descclassname">tlseparation.utility.cloud_analysis.</code><code class="descname">detect_rad_nn</code><span class="sig-paren">(</span><em>arr</em>, <em>rad</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/cloud_analysis.html#detect_rad_nn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.cloud_analysis.detect_rad_nn" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculates an average of number of neighbors based on a fixed radius
around each point in a point cloud.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Three-dimensional (m x n) array of a point cloud, where the
coordinates are represented in the columns (n) and the points are
represented in the rows (m).</p>
</dd>
<dt><strong>rad</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Radius distance to select neighboring points.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>mean_knn</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first last">Average number of points inside a radius ‘rad’ around each point in
‘arr’.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-tlseparation.utility.clustering">
<span id="tlseparation-utility-clustering-module"></span><h2>tlseparation.utility.clustering module<a class="headerlink" href="#module-tlseparation.utility.clustering" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="tlseparation.utility.clustering.connected_component">
<code class="descclassname">tlseparation.utility.clustering.</code><code class="descname">connected_component</code><span class="sig-paren">(</span><em>arr</em>, <em>voxel_size</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/clustering.html#connected_component"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.clustering.connected_component" title="Permalink to this definition">¶</a></dt>
<dd><p>Performs a connected component analysis to cluster points from a point
cloud.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Three-dimensional (m x n) array of a point cloud, where the
coordinates are represented in the columns (n) and the points are
represented in the rows (m).</p>
</dd>
<dt><strong>voxel_size: float</strong></dt>
<dd><p class="first last">Distance used to generate voxels from point cloud in order to
perform the connected component analysis in 3D space.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>point_labels</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">1D array with cluster labels assigned to each point from the input
point cloud.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-tlseparation.utility.data_utils">
<span id="tlseparation-utility-data-utils-module"></span><h2>tlseparation.utility.data_utils module<a class="headerlink" href="#module-tlseparation.utility.data_utils" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="tlseparation.utility.data_utils.apply_nn_value">
<code class="descclassname">tlseparation.utility.data_utils.</code><code class="descname">apply_nn_value</code><span class="sig-paren">(</span><em>base</em>, <em>arr</em>, <em>attr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/data_utils.html#apply_nn_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.data_utils.apply_nn_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Upscales a set of attributes from a base array to another denser array.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>base</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Base array to which the attributes to upscale were originaly matched.</p>
</dd>
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Target array to which the attributes will be upscaled.</p>
</dd>
<dt><strong>attr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Attributes to upscale.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first docutils">
<dt><strong>new_attr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Upscales attributes.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>AssertionError:</strong></dt>
<dd><p class="first last">length (number of samples) of “base” and “attr” must be equal.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.data_utils.entries_to_remove">
<code class="descclassname">tlseparation.utility.data_utils.</code><code class="descname">entries_to_remove</code><span class="sig-paren">(</span><em>entries</em>, <em>d</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/data_utils.html#entries_to_remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.data_utils.entries_to_remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to remove selected entries (key and respective values) from
a given dict.
Based on a reply from the user mattbornski <a class="footnote-reference" href="#id2" id="id1">[1]</a> at stackoverflow.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>entries</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Set of entried to be removed.</p>
</dd>
<dt><strong>d</strong> <span class="classifier-delimiter">:</span> <span class="classifier">dict</span></dt>
<dd><p class="first last">Dictionary to apply the entried removal.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<p class="rubric">References</p>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>mattbornski, 2012. <a class="reference external" href="http://stackoverflow.com/questions/8995611/removing-multiple-keys-from-a-dictionary-safely">http://stackoverflow.com/questions/8995611/removing-multiple-keys-from-a-dictionary-safely</a></td></tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.data_utils.get_diff">
<code class="descclassname">tlseparation.utility.data_utils.</code><code class="descname">get_diff</code><span class="sig-paren">(</span><em>arr1</em>, <em>arr2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/data_utils.html#get_diff"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.data_utils.get_diff" title="Permalink to this definition">¶</a></dt>
<dd><p>Performs the intersection of two arrays, returning the entries not
intersected between arr1 and arr2.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr1</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">N-dimensional array of points to intersect.</p>
</dd>
<dt><strong>arr2</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">N-dimensional array of points to intersect.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Difference array between ‘arr1’ and ‘arr2’.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.data_utils.remove_duplicates">
<code class="descclassname">tlseparation.utility.data_utils.</code><code class="descname">remove_duplicates</code><span class="sig-paren">(</span><em>arr</em>, <em>return_ids=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/data_utils.html#remove_duplicates"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.data_utils.remove_duplicates" title="Permalink to this definition">¶</a></dt>
<dd><p>Removes duplicated rows from an array.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">N-dimensional array (m x n) containing a set of parameters (n) over
a set of observations (m).</p>
</dd>
<dt><strong>return_ids: bool</strong></dt>
<dd><p class="first last">Option to return indices of duplicated entries instead of new array
with unique entries.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>unique</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">N-dimensional array (m* x n) containing a set of unique parameters (n)
over a set of unique observations (m*).</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-tlseparation.utility.downsampling">
<span id="tlseparation-utility-downsampling-module"></span><h2>tlseparation.utility.downsampling module<a class="headerlink" href="#module-tlseparation.utility.downsampling" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="tlseparation.utility.downsampling.downsample_cloud">
<code class="descclassname">tlseparation.utility.downsampling.</code><code class="descname">downsample_cloud</code><span class="sig-paren">(</span><em>point_cloud</em>, <em>downsample_size</em>, <em>return_indices=False</em>, <em>return_neighbors=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/downsampling.html#downsample_cloud"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.downsampling.downsample_cloud" title="Permalink to this definition">¶</a></dt>
<dd><p>Downsamples a point cloud by voxelizing it and selecting points closest
to the median coordinate of all points inside each voxel. The remaining
points can be stored and returned as a dictrionary for later
use in upsampling back to original input data.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>point_cloud</strong> <span class="classifier-delimiter">:</span> <span class="classifier">numpy.ndarray</span></dt>
<dd><p class="first last">Three-dimensional (m x n) array of a point cloud, where the
coordinates are represented in the columns (n) and the points are
represented in the rows (m).</p>
</dd>
<dt><strong>downsample_size</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Size of the voxels used to sample points into groups and select the
most central point from. Note that this will not be the final points
distance from each other, but an approximation.</p>
</dd>
<dt><strong>return_indices</strong> <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd><p class="first last">Option to return results as downsampled array (False) or the
indices of downsampled points from original point cloud (True).</p>
</dd>
<dt><strong>return_neighbors</strong> <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd><p class="first last">Option to return original neighbors of downsampled points (True) or
not (False). This information can be used to upsample back the
downsampled indices.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.downsampling.upsample_cloud">
<code class="descclassname">tlseparation.utility.downsampling.</code><code class="descname">upsample_cloud</code><span class="sig-paren">(</span><em>upsample_ids</em>, <em>neighbors_dict</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/downsampling.html#upsample_cloud"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.downsampling.upsample_cloud" title="Permalink to this definition">¶</a></dt>
<dd><p>Upsample cloud based on downsampling information from ‘downsample_cloud’.
This function will loop over each ‘upsample_ids’ and retrieve its
original neighboring points stored in ‘neighbors_dict’.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>upsample_ids</strong> <span class="classifier-delimiter">:</span> <span class="classifier">list</span></dt>
<dd><p class="first last">List of indices in ‘neighbors_dict’ to upsample.</p>
</dd>
<dt><strong>neighbors_dict</strong> <span class="classifier-delimiter">:</span> <span class="classifier">dict</span></dt>
<dd><p class="first last">Neighbors information provided by ‘downsample_cloud’ containing
all the original neighboring points to each point in the downsampled
cloud.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>upsampled_indices</strong> <span class="classifier-delimiter">:</span> <span class="classifier">numpy.ndarray</span></dt>
<dd><p class="first last">Upsampled points from original point cloud.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-tlseparation.utility.filtering">
<span id="tlseparation-utility-filtering-module"></span><h2>tlseparation.utility.filtering module<a class="headerlink" href="#module-tlseparation.utility.filtering" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="tlseparation.utility.filtering.array_majority">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">array_majority</code><span class="sig-paren">(</span><em>arr_1</em>, <em>arr_2</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#array_majority"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.array_majority" title="Permalink to this definition">¶</a></dt>
<dd><p>Applies majority filter on two arrays.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr_1</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">n-dimensional array of points to filter.</p>
</dd>
<dt><strong>arr_2</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">n-dimensional array of points to filter.</p>
</dd>
<dt><strong>**knn</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int or float</span></dt>
<dd><p class="first last">Number neighbors to select around each point in arr in order to apply
the majority criteria.</p>
</dd>
<dt><strong>**rad</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int or float</span></dt>
<dd><p class="first last">Search radius arount each point in arr to select neighbors in order
to apply the majority criteria.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first docutils">
<dt><strong>c_maj_1</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Boolean mask of filtered entries of same class as input ‘arr_1’.</p>
</dd>
<dt><strong>c_maj_2</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Boolean mask of filtered entries of same class as input ‘arr_2’.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>AssertionError:</strong></dt>
<dd><p class="first last">Raised if neither ‘knn’ or ‘rad’ arguments are passed with valid
values (int or float).</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.class_filter">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">class_filter</code><span class="sig-paren">(</span><em>arr_1</em>, <em>arr_2</em>, <em>target</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#class_filter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.class_filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to apply class filter on an array based on the combination of
classed from both arrays (arr_1 and arr_2). Which array gets filtered
is defined by ‘’target’‘.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr_1</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">n-dimensional array of points to filter.</p>
</dd>
<dt><strong>arr_2</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">n-dimensional array of points to filter.</p>
</dd>
<dt><strong>target</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int or float</span></dt>
<dd><p class="first last">Number of the input array to filter. Valid values are 0 or 1.</p>
</dd>
<dt><strong>**knn</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int or float</span></dt>
<dd><p class="first last">Number neighbors to select around each point in arr in order to apply
the majority criteria.</p>
</dd>
<dt><strong>**rad</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int or float</span></dt>
<dd><p class="first last">Search radius arount each point in arr to select neighbors in order
to apply the majority criteria.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first docutils">
<dt><strong>c_maj_1</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Boolean mask of filtered entries of same class as input ‘arr_1’.</p>
</dd>
<dt><strong>c_maj_2</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Boolean mask of filtered entries of same class as input ‘arr_2’.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>AssertionError:</strong></dt>
<dd><p class="first last">Raised if neither ‘knn’ or ‘rad’ arguments are passed with valid
values (int or float).</p>
</dd>
<dt><strong>AssertionError:</strong></dt>
<dd><p class="first last">Raised if ‘target’ variable is not an int or float with value 0 or 1.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.cluster_features">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">cluster_features</code><span class="sig-paren">(</span><em>arr</em>, <em>labels</em>, <em>feature_threshold</em>, <em>min_pts=10</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#cluster_features"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.cluster_features" title="Permalink to this definition">¶</a></dt>
<dd><p>Filters a set of connected components by a geometric feature threshold.
This feature (n 2 in the separation methodology) is used to describe
elongated shapes. If the shape of the cluster is elongated enough
(i.e. feature value larger than threshold) the points belonging to this
cluster are masked as True.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Three-dimensional (m x n) array of a point cloud, where the
coordinates are represented in the columns (n) and the points are
represented in the rows (m).</p>
</dd>
<dt><strong>labels</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">1D array with cluster labels assigned to each point from the input
point cloud.</p>
</dd>
<dt><strong>feature_threshold</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Minimum feature value for the cluster to be set as elongated (True).</p>
</dd>
<dt><strong>min_pts</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first last">Minimum number of points for the cluster to be set as valid (True).</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>filter_mask</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">1D mask array setting True for valid poins in ‘arr’ and False
otherwise.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.cluster_filter">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">cluster_filter</code><span class="sig-paren">(</span><em>arr</em>, <em>max_dist</em>, <em>eval_threshold</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#cluster_filter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.cluster_filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Applies a cluster filter to a point cloud ‘arr’. This filter aims to
remove small, isolated, clusters of points.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Point cloud of shape n points x m dimensions to be filtered.</p>
</dd>
<dt><strong>max_dist</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Maximum distance between points to considered part of the same
cluster.</p>
</dd>
<dt><strong>eval_threshold</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Minimum value for largest eigenvalue for a valid cluster. This value
is an indication of cluster shape, in which the higher the eigenvalue,
more elongated is the cluster. Points from clusters that have
eigenvalue smaller then eval_threshold are filtered out.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>mask</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Boolean mask of filtered points. Entries are set as True if belonging
to a valid cluster and False otherwise.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.cluster_size">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">cluster_size</code><span class="sig-paren">(</span><em>arr</em>, <em>labels</em>, <em>min_size</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#cluster_size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.cluster_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Filters a set of connected components by maximum size on any dimension.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Three-dimensional (m x n) array of a point cloud, where the
coordinates are represented in the columns (n) and the points are
represented in the rows (m).</p>
</dd>
<dt><strong>labels</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">1D array with cluster labels assigned to each point from the input
point cloud.</p>
</dd>
<dt><strong>min_size</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int/float</span></dt>
<dd><p class="first last">Minimum size, on any dimension, for a cluster to be set as
valid (True)</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>filter_mask</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">1D mask array setting True for valid poins in ‘arr’ and False
otherwise.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.continuity_filter">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">continuity_filter</code><span class="sig-paren">(</span><em>wood</em>, <em>leaf</em>, <em>rad=0.05</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#continuity_filter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.continuity_filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to apply a continuity filter to a point cloud that contains gaps
defined as points from a second point cloud.
This function works assuming that the continuous variable is the
wood portion of a tree point cloud and the gaps in it are empty space
or missclassified leaf data. In this sense, this function tries to correct
gaps where leaf points are present.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>wood</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Wood point cloud to be filtered.</p>
</dd>
<dt><strong>leaf</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Leaf point cloud, with points that may be causing discontinuities in
the wood point cloud.</p>
</dd>
<dt><strong>rad</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Radius to search for neighboring points in the iterative process.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>wood</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Filtered wood point cloud.</p>
</dd>
<dt><strong>not_wood</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Remaining point clouds after the filtering.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.dist_majority">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">dist_majority</code><span class="sig-paren">(</span><em>arr_1</em>, <em>arr_2</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#dist_majority"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.dist_majority" title="Permalink to this definition">¶</a></dt>
<dd><p>Applies majority filter on two arrays.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr_1</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">n-dimensional array of points to filter.</p>
</dd>
<dt><strong>arr_2</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">n-dimensional array of points to filter.</p>
</dd>
<dt><strong>**knn</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int or float</span></dt>
<dd><p class="first last">Number neighbors to select around each point in arr in order to apply
the majority criteria.</p>
</dd>
<dt><strong>**rad</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int or float</span></dt>
<dd><p class="first last">Search radius arount each point in arr to select neighbors in order to
apply the majority criteria.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>c_maj_1</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Boolean mask of filtered entries of same class as input ‘arr_1’.</p>
</dd>
<dt><strong>c_maj_2</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Boolean mask of filtered entries of same class as input ‘arr_2’.</p>
</dd>
<dt><strong>Raises:</strong></dt>
<dd></dd>
<dt><strong>AssertionError:</strong></dt>
<dd><p class="first last">Raised if neither ‘knn’ or ‘rad’ arguments are passed with valid
values (int or float).</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.feature_filter">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">feature_filter</code><span class="sig-paren">(</span><em>arr</em>, <em>feature_id</em>, <em>threshold</em>, <em>knn</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#feature_filter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.feature_filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Filters a point cloud based on a given feature threshold. Only points
with selected feature values higher than threshold are kept as valid.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Three-dimensional (m x n) array of a point cloud, where the
coordinates are represented in the columns (n) and the points are
represented in the rows (m).</p>
</dd>
<dt><strong>feature_id</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first last">Column index of feature selected as criteria to filter. Column
indices follow Python notation [0 - (n_columns - 1)].</p>
</dd>
<dt><strong>threshold</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Minimum feature value for valid points.</p>
</dd>
<dt><strong>knn</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first last">Number of neighbors to select around each point. Used to describe
local point arrangement.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>mask_feature</strong> <span class="classifier-delimiter">:</span> <span class="classifier">numpy.ndarray</span></dt>
<dd><p class="first last">Boolean mask with valid points entries set as True.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.plane_filter">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">plane_filter</code><span class="sig-paren">(</span><em>arr</em>, <em>rad</em>, <em>threshold</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#plane_filter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.plane_filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Filters a point cloud based on its points planicity. Removes points that
are part of a neighbohood with planar spatial arrangement (low curvature).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Three-dimensional (m x n) array of a point cloud, where the
coordinates are represented in the columns (n) and the points are
represented in the rows (m).</p>
</dd>
<dt><strong>rad</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Search radius distance around each point. Used to describe
local point arrangement.</p>
</dd>
<dt><strong>threshold</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Minimum curvature value for valid points.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>mask_plane</strong> <span class="classifier-delimiter">:</span> <span class="classifier">numpy.ndarray</span></dt>
<dd><p class="first last">Boolean mask with valid points entries set as True.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="tlseparation.utility.filtering.radius_filter">
<code class="descclassname">tlseparation.utility.filtering.</code><code class="descname">radius_filter</code><span class="sig-paren">(</span><em>arr</em>, <em>radius</em>, <em>min_points</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/filtering.html#radius_filter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.filtering.radius_filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Applies a radius search filter, which remove isolated points/clusters of
points.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Point cloud of shape n points x m dimensions to be filtered.</p>
</dd>
<dt><strong>radius</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
<dd><p class="first last">Search radius around each point to form a neighborhood.</p>
</dd>
<dt><strong>min_point</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first last">Minimum number of points in a neighborhood for it to be considered
valid, i.e not filtered out.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>mask</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Array of bools masking valid points as True and “noise” points as
False.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-tlseparation.utility.knnsearch">
<span id="tlseparation-utility-knnsearch-module"></span><h2>tlseparation.utility.knnsearch module<a class="headerlink" href="#module-tlseparation.utility.knnsearch" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="tlseparation.utility.knnsearch.set_nbrs_knn">
<code class="descclassname">tlseparation.utility.knnsearch.</code><code class="descname">set_nbrs_knn</code><span class="sig-paren">(</span><em>arr</em>, <em>pts</em>, <em>knn</em>, <em>return_dist=True</em>, <em>block_size=100000</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/tlseparation/utility/knnsearch.html#set_nbrs_knn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#tlseparation.utility.knnsearch.set_nbrs_knn" title="Permalink to this definition">¶</a></dt>
<dd><p>Function to create a set of nearest neighbors indices and their respective
distances for a set of points. This function uses a knn search and sets a
limit size for a block of points to query. This makes it less efficient in
terms of processing time, but avoids running out of memory in cases of
very dense/large arrays/queries.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils">
<dt><strong>arr</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">N-dimensional array to perform the knn search on.</p>
</dd>
<dt><strong>pts</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">N-dimensional array to search for on the knn search.</p>
</dd>
<dt><strong>knn</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first last">Number of nearest neighbors to search for.</p>
</dd>
<dt><strong>return_dist</strong> <span class="classifier-delimiter">:</span> <span class="classifier">boolean</span></dt>
<dd><p class="first last">Option to return or not the distances of each neighbor.</p>
</dd>
<dt><strong>block_size</strong> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
<dd><p class="first last">Limit of points to query. The variable ‘pts’ will be subdivided in n
blocks of size block_size to perform query.</p>
</dd>
</dl>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first last docutils">
<dt><strong>indices</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Set of neighbors indices from ‘arr’ for each entry in ‘pts’.</p>
</dd>
<dt><strong>distance</strong> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd><p class="first last">Distances from each neighbor to each central point in ‘pts’.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>