epfl-lts2 / pygsp

Graph Signal Processing in Python
https://pygsp.rtfd.io
BSD 3-Clause "New" or "Revised" License
483 stars 93 forks source link

How to keep the signal values of a heat diffusion higher #89

Closed StefanBloemheuvel closed 3 years ago

StefanBloemheuvel commented 3 years ago

Hi developers of Pygsp,

After playing around with some heat diffusion code in your package, I was wondering how I could tweak the settings of:

G = graphs.Grid2d(10,10)
G.estimate_lmax()
taus = [0,1,2,3]
print(len(taus))
g = filters.Heat(G, taus)
DELTA = 25
s = np.zeros(G.N)
s[DELTA] = 1
s = g.filter(s, method='chebyshev', order = 10)
G.plot_signal(s[:,1], limits=[0,1])
for i in range(0,len(taus)):
    print(max(s[:,i]))

To not drop so fast in maximum values. Since the maximum value of the heat origin is dropping and reducing from the original delta 1 to [0.62, 0.41, 0.28]. Also, is there a way to create a filter that eventually fades out completely? Such that I can simulate pressure data originating from a source which then completely disappears after N tau values? That would be great for simulating training data for my machine learning model, which works with pressure sensors that can detect events. Hopefully my explanation is clear enough!

mdeff commented 3 years ago

The value of tau controls the amount of heat diffusion. tau=0 is diffusion at time 0, i.e., no diffusion (a delta stays a delta). On the other extreme, as tau goes to infinity, heat diffuses to a constant value.

For the simulation of a system, a filter kernel is the fundamental solution of the PDE that governs the system (e.g., filters.Heat is the solution to heat diffusion, filters.Wave is the solution to the propagation of waves). If your pressure system behaves like heat diffusion, then you can use the heat kernel.