Closed zxdawn closed 2 years ago
Hey there,
There are many reasons why the performance may not be as good as you expected. Off the top of my head:
qshift3
?baseline_dwt
instead? If it performs better with the discrete wavelet transform, that might be an indication that something is going wrong.Let me know, Laurent
Hi @LaurentRDC,
Thanks for your suggestions! Here's the new test_data.zip.
import numpy as np
import skued
from skued import baseline_dt, baseline_dwt
import matplotlib.pyplot as plt
def plot_data_wavelet(data, wavelet, level, title, method='baseline_dt'):
if method == 'baseline_dt':
baseline = baseline_dt(data, wavelet=wavelet, level=level, max_iter = 150)
elif method == 'baseline_dwt':
baseline = baseline_dwt(data, wavelet=wavelet, level=level, max_iter = 150)
# plot
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(12, 6))
m1 = ax1.imshow(data, vmin=-1e-5, vmax=4e-5)
m2 = ax2.imshow(baseline, vmin=-5e-6)
m3 = ax3.imshow(data-baseline, vmin=-1e-5, vmax=4e-5)
plt.colorbar(m1, ax=ax1, shrink=0.5)
plt.colorbar(m2, ax=ax2, shrink=0.5, extend='min')
plt.colorbar(m3, ax=ax3, shrink=0.5)
plt.suptitle(title)
plt.tight_layout()
data = np.load('test_baseline_dt.npy')
# test wavelet
for wavelet in skued.available_dt_filters():
level = 10
plot_data_wavelet(data, wavelet, level=level, title=f'wavelet={wavelet} with level={level}')
baseline_dwt
based on different wavelet. It seems baseline_dwt
is not suitable
BTW, how about fourier transform? Is that better for this case? I can try that if so.
I'm sorry, I can't help you further. It may be that your data cannot be decomposed well with the dual-tree wavelets that are included in scikit-ued
. You could try designing your own wavelet based on the references in the scikit-ued
documentation.
As for the Fourier transform: best thing you can do is try! In my use-case, it didn't work very well... but it might work for you
Thanks for your help! Because my goal is to subtract the background from the high spots, I'm also trying to fit the lognorm distribution and adjust the alpha to get the background value ;)
Version / Platform Info
Expected Behavior
Remove the noisy background and subtract it from the three high spots.
Something like this, but only three high spots:
Actual Behavior
Only quite low values are detected as the baseline.
Minimal Example of Issue
Data
test_baseline_dt.zip