I have a time-domain signal and the samples size is 80000. I want to divide these samples into equal sizes of segments and want to apply wavelet transform to them. How I can do this step. please guide me. Thank you
Asked
Active
Viewed 232 times
0
-
Welcome to SO, Tariq. Your question is too vague for us to help you. What have you tried so far? What type of wavelet transform do you want to apply: DWT or CWT? What language are you planning on using? – Sheldon Nov 26 '21 at 02:42
-
If you are working under Python, I would suggest checking out `pywt`. This is a great place where to start. – Sheldon Nov 26 '21 at 02:42
-
I am using python and i check the pywt, i have tried to study about it but the main problem i am facing is dividing of signal into different segment. – Tariq Nov 26 '21 at 09:01
-
You question is unclear: is it 1. a signal processing question, *e.g.* are you trying to figure how many windows to use? 2. a coding question, *e.g.* you would like to know how to split your original time series in different segments using Python? – Sheldon Nov 28 '21 at 19:28
-
My question is related to signal segmentation, how we can segment our original signal into different segments. – Tariq Nov 28 '21 at 21:48
1 Answers
0
One way to segment your original data is simply to use numpy's reshape function. Assuming that you want to reshape your data into 2000 samples long segments:
import numpy as np
original_time_series = np.random.random(80000)
window_size = 2000
reshaped_time_series = original_time_series.reshape((window_size,-1))
Of course, you will need to ensure that the total number of samples in your time series is a multiple of the window_size
. Otherwise, you can trim your input time series to match this requirement.
You can then apply your wavelet transform to each and every segment in your reshaped array.
The previous answer assumes that you want non-overlapping segments. Depending on what you are trying to achieve, you may prefer using a striding -or sliding- window (e.g. with a 50% overlap). This questions is already covered in detail here.

Sheldon
- 4,084
- 3
- 20
- 41