scottstanie / troposim

Simulate InSAR tropospheric noise
MIT License
7 stars 4 forks source link

troposim

Simulate tropospheric noise for InSAR data

Installation

pip install troposim

To make an editable installation

git clone https://github.com/scottstanie/troposim && cd troposim
pip install -e .

Usage

To simulate one turbulence image, you can specify the shape:

from troposim import turbulence
noise = turbulence.simulate(shape=(500, 500))

or add a 3rd dimension to simulate a stack of images

noise = turbulence.simulate(shape=(10, 500, 500))

The beta argument is the slope of the log10(power) vs log10(frequency) graph. The default is to use a single linear slope of $\beta = 8 / 3$:

$$ P(f) \propto \frac{1}{f^\beta} $$

For smaller-scale turbulence, you can use a different beta:

flatter_noise = turbulence.simulate(beta=2.2)

Since real InSAR data typically have a power spectrum that is not a single slope, you can estimate the spectrum from an image and use that to simulate new data:

from troposim.turbulence import Psd
psd = Psd.from_image(noise)
new_noise = psd.simulate()

Here the psd object has attributes

# assuming maptlotlib is installed
psd.plot()

# Or, to plot a side-by-side of image and 1D PSD
from troposim import plotting 
plotting.plot_psd(noise, freq=freq, psd1d=psd1d)
# Or just the PSD plot, no image
plotting.plot_psd1d(psd.freq, psd.psd1d)

To simulate a stack of new values from the PSD of one image, you simply pass in a new shape argument to .simulate:

psd.simulate(shape=(10, 400, 400))

Note that the default fit will use a cubic polynomial. To request only a linear fit,

psd = Psd.from_image(noise, deg=1)

You can also save the PSD parameters for later use:

psd.save(outfile="my_psd.npz")
# Later, reload from this file
psd = Psd.load(outfile)

Citation

Staniewicz, Scott; Chen, Jingyi (2022): Automatic Detection of InSAR Surface Deformation Signals in the Presence of Severe Tropospheric Noise. TechRxiv. Preprint. https://doi.org/10.36227/techrxiv.20128406.v1