File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+ import pywavemap as wave
3
+
4
+ # Load the map
5
+ user_home = os .path .expanduser ('~' )
6
+ input_map_path = os .path .join (user_home , "your_map.wvmp" )
7
+ your_map = wave .Map .load (input_map_path )
8
+
9
+ # Use the multiply method to implement exponential forgetting
10
+ decay_factor = 0.9
11
+ wave .edit .multiply (your_map , decay_factor )
12
+
13
+ # Save the map
14
+ output_map_path = os .path .join (user_home , "your_map_decayed.wvmp" )
15
+ your_map .store (output_map_path )
Original file line number Diff line number Diff line change 6
6
#include < wavemap/core/map/hashed_chunked_wavelet_octree.h>
7
7
#include < wavemap/core/map/hashed_wavelet_octree.h>
8
8
#include < wavemap/core/utils/edit/crop.h>
9
+ #include < wavemap/core/utils/edit/multiply.h>
9
10
10
11
using namespace nb ::literals; // NOLINT
11
12
@@ -28,5 +29,21 @@ void add_edit_module(nb::module_& m_edit) {
28
29
std::make_shared<ThreadPool>());
29
30
},
30
31
" map" _a, " center_point" _a, " radius" _a, " termination_height" _a = 0 );
32
+
33
+ // Map multiply methods
34
+ // NOTE: Among others, this can be used to implement exponential forgetting,
35
+ // by multiplying the map with a scalar between 0 and 1.
36
+ m_edit.def (
37
+ " multiply" ,
38
+ [](HashedWaveletOctree& map, FloatingPoint multiplier) {
39
+ edit::multiply (map, multiplier, std::make_shared<ThreadPool>());
40
+ },
41
+ " map" _a, " multiplier" _a);
42
+ m_edit.def (
43
+ " multiply" ,
44
+ [](HashedChunkedWaveletOctree& map, FloatingPoint multiplier) {
45
+ edit::multiply (map, multiplier, std::make_shared<ThreadPool>());
46
+ },
47
+ " map" _a, " multiplier" _a);
31
48
}
32
49
} // namespace wavemap
You can’t perform that action at this time.
0 commit comments