Questions tagged [scipy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
51 views

detrend a signal with break point but without jumps

Yesterday I asked a question and got the answer to detrend my time series which I think is really better than applying a highpass filter. So I read the description of scipy.signal.detrend and there I ...
1 vote
1 answer
44 views

filtering EEG data with scipy.signal

I have EEG data recorded with a sampling rate of 256 Hz. Each recording contains 19 EEG channels. Other channels (like ECG data) are ignored. The recordings of 10 patients are 20 minutes long each, ...
1 vote
1 answer
50 views

How to generate a first order Gauss-Markov process in Python

I would like to synthesize a first order Gauss-Markov process from a white Gaussian noise. I know from signal processing theory that it could be realized using a noise shaping filter designed properly ...
  • 11
3 votes
1 answer
250 views

How to get scipy remez to give matlab firpm answer?

If I run this in matlab: h = firpm(100,[0 0.1 0.2 1],[0 0 1 1]) and this in scipy: h = remez(100,[0, 0.05, 0.1, 0.5],[0, 1]) I ...
  • 141
0 votes
1 answer
36 views

Rolling average in pandas using a Gaussian window

I want to estimate the rolling average of a time series B using a Gaussian window. The equation to do this would correspond to $$\tilde{B_{s}}(t_{n}) = \frac{1}{A_{s}} \sum_{t_{m}= t_{n}-3s}^{t_{n}+3s}...
  • 113
0 votes
0 answers
63 views

Jerk detection in accelerometer data

I want to detect jerk from accelerator data i.e. values beyond 1.57 g, but due to the high frequency nature of the sensor (400 values per second), it gives multiple jerks instead of one. How can I ...
1 vote
2 answers
48 views

Constraints on number of taps in a FIR filter vs. FFT length

I want to implement a FIR highpass filter for acoustic signals. I generate the FIR using Python's SciPy code: ...
0 votes
1 answer
44 views

Why does Python welch give me a different answer from MATLAB's pwelch?

I am trying to implement the following line of MATLAB code: [pxx, f] = pwelch(data,[],[],4096,F_S) in Python. Knowing that MATLAB using a Hamming window type that ...
  • 3
3 votes
1 answer
83 views

How does SciPy's Welch function change the shape of the data?

I am working with some time series data with a shape of 8064. The data is actually the popular EEG data called DEAP. It basically is a 3D array of size (40, 40, 8064) and here is the link to the ...
0 votes
0 answers
44 views

Decimate a signal whose values are calculated, not stored

tl;dr I'm looking for something like Scipy's decimate function, but one that takes in a generator, rather than a Numpy array. I am turning on and off a light using ...
  • 101
0 votes
1 answer
64 views

Why changing the format of audio file from in16 to float produce some jitters?

I read an audio file ( an instrumental music file that is mono and 16000) with wav.read (read function from scipy.io.wavfile). This function gives me a data file in int16 format. When I change the ...
0 votes
0 answers
44 views

Understanding FFT bins interpretability

I am familiar with the continuous Fourier transform yet the more I try to understand FFT, the more I'm confused. If we've got a discrete N sample signal, FFT is a faster way to calculate DFT. If ...
0 votes
1 answer
103 views

(Python - Scipy - Wave files) Can a float signal be written with values higher than 1?

While developing an application, I noticed strange behaviour while using scipy.io.wavfile to write audio files. The documentation says that floating-point data is written within a range between -1 and ...
0 votes
1 answer
43 views

Simulation of Lock-In Amplification in Python makes no sense

I would like to simulate a basic lock-in amplification for post-processing some data. I wrote a basic Python script for this purpose but the output of the lock-in amplification does not seem to make ...
0 votes
0 answers
84 views

3D Convolution with sum of multiple 2D Convolution operation

Probably this is a simple question, but I quite don't understand the reasons why I can replicate a 3D convolution operation with the sum of multiple 2D convolution operations. Is it a property of ...
  • 135
1 vote
0 answers
194 views

Spectrogram of x,y,z data from accelerometer

Using scipy.signal.spectrogram for creating spectrogram and matplotlib's pcolormesh for plotting. I'm working on a project where I'm using a spectrogram to visualize the frequencies of the ...
  • 11
0 votes
1 answer
70 views

How to determine multiple Periodicities present in Timeseries data?

My objective is to detect all kinds of seasonalities and their time periods that are present in a timeseries waveform. I'm currently using the following dataset: https://www.kaggle.com/rakannimer/air-...
  • 11
0 votes
0 answers
28 views

How can to obtain the transfer function of a bandpass digital filter? [duplicate]

I've been asked to: create a bandpass filter amplifier in python, determine the transfer function, graph the bode diagram, and print the highcut frequency, lowcut frequency, the bode constant and the ...
0 votes
1 answer
59 views

Fast Fourier transformation of discrete linear line function in Python using scipy.fft [closed]

Consider a time series dataset generated by a linear function $$y = a \cdot n, \; n=0,1,...,N$$ According to this reference (entry 308 in the table for one-dimensional functions), the analytical ...
  • 31
0 votes
0 answers
13 views

Creating 60s strips from ecg signal recording ( .bat ) file and give it a label as per the datapoint present in it

I am working with https://physionet.org/content/mitdb/1.0.0/ dataset where we have 48 ecg signal files. Each recording is 30 minutes long and I Want to create 60s strips and give it a label. ie based ...
1 vote
2 answers
55 views

Scipy tf2zpk doesn't return zeros

I have the following transfer function: $$H(z) =\frac{\alpha z}{(z-(1-\alpha))}$$ I'd like to find zeros and poles of it by scipy.signal.tf2zpk: ...
  • 95
0 votes
1 answer
272 views

How to set the "widths" parameter for continuous wavelet transform using Morlet wavelets? (scipy.signal.cwt)

I'm trying to use scipy.signal.cwt() to do a time-frequency decomposition of neural data. However, I don't completely understand the "widths" parameter. I ...
1 vote
0 answers
502 views

Help on audio filter with FFT on python

I need to take a .wav audio file that's noisy and filter out some noise. I have to do it using Fourier Transform. After some days researching and experimenting, I finally made a working function, the ...
  • 11
1 vote
0 answers
39 views

`signal.periodogram` output has no frequency 0 hz point,how to solve this problem?

...
  • 175
0 votes
1 answer
142 views

Remez function equivalency between Matlab and Scipy

I've read the similar question Find the equivalent of this python remez specs in C++ remez or Matlab firpm, which describes a different problem. In Matlab, I have following ...
2 votes
2 answers
370 views

How to implement cascaded biquad transfer functions in Python/SciPy

I am trying to implement in python/Scipy the biquad filter with the following S-domain transfer function: $$ H(s)=\frac{w_0^{2N-1}(s+w_z)}{[s^2+(w_0/Q)s+w_0^2]^N} $$ My problem here is that because of ...
  • 43
2 votes
1 answer
145 views

Why the convolution of the impulse response doesn't match the system's output?

If you define an LTI system sys in scipy, you may conveniently feed an input x to it to get its output ...
  • 33
1 vote
1 answer
378 views

Can someone explain why signal.freqz() generates a different phase in the frequency fresponse than scipy.signal.dfreqresp()?

I have been using scipy to analyze filter performance for a single-pole IIR filter, and I noticed a disagreement between the phase in the outputs of the freqz() function compared to the output of the ...
0 votes
0 answers
35 views

Issues on EEG PSD feature extraction using signal.welch

I am new to EEG signal processing and I am having some issues on calculating PSD using scipy.signal.welch. I am trying to implement a function to extract PSD features. The input of this function is a ...
0 votes
1 answer
94 views

How to select parameters suitable parameters for a spectrogram

I have a limited background in DSP but I need to generate a spectrogram of an electrocardiography (ECG). I am using the scipy.signal.spectrogram and I need to set ...
5 votes
3 answers
299 views

Role of window length and overlap in uncertainty principle?

I am trying to predict epilepsy using spectrograms and a convolutional neural network. So far I have achieved a validation accuracy of 86% which i feel like is pretty good. Lots of the papers doing ...
1 vote
1 answer
121 views

Measure Frequency-Response of Sensor using a Signalsource and Reference-Sensor

Cheers, I want to measure the frequency response of an acceleration sensor. I have: A signal source (device similar to a loudspeaker that shakes the acceleration sensor), of which I do NOT know the ...
  • 111
1 vote
1 answer
178 views

Scipy FFT and Numpy FFT disagree on pulse train spectrum?

I am doing an FFT on a series of pulses. The series is one pulse of amplitude 1 every 7 days over a total of 367 days. The code below is what I run: ...
0 votes
0 answers
50 views

How to design function for Random Decrement technique in python and implement the function?

I was looking into a technique called Random decrement technique from the following links/articles: How can I use Random Decrement Method to convert a non-stationary signal into a decay function ...
0 votes
1 answer
106 views

spectrogram of a (strongly) downsampled file

I downsampled an audio file to a very low sampling rate, 48hz. This is because I stored some information in the file, that are not really audio information but the audio format was convenient to use. ...
  • 23
0 votes
0 answers
76 views

High pass filter with specific cut-off frequency

The situation I am trying to apply a high pass filter to a black&white image to enhance the texture by keeping the high frequencies. The goal is to filter from a specific frequency value obtained ...
1 vote
1 answer
144 views

IIR design: SciPy CMSIS-DSP coefficient format

How do you reconcile Scipy.signal's IIR design with CMSIS-DISP's API? Scipy.signal outputs in one of 3 forms: Numerator/denominator Pole Zero Second-Order-Sections. CMSIS requires an array of length ...
0 votes
2 answers
140 views

Find the equivalent of this python remez specs in C++ remez or Matlab firpm

I want to start with that I am quite new in this community, so if this question does not belong here, please point me to the right place. Thank you! Background I am learning and writing a half-band ...
2 votes
0 answers
40 views

Help with setting up transfer function correct format

I have a transfer function as: H(s) = R / (sRC + 1) V is the output and I is the input so we can write: V(s) = I(s)*H(s) Now the thing is that, I want to obtain I(t) for the given V(t). So I write: I(...
  • 131
0 votes
1 answer
192 views

Evaluate filter matlab function on scipy

I want to reproduce the result given by filter() MATLAB function using scipy.signal functions. The result is not consistent: Matlab example: ...
-1 votes
1 answer
356 views

How to specify parameters in scipy.stft to reproduce published analysis

I am starting a project on this Keggle dataset containing EEG registrations (sampled at 128 Hz) of several subjects. What I am really interested in is the final ...
  • 1
1 vote
0 answers
215 views

Unexpected results of deconvolution with scipy.deconvolve

Below I have plotted the signal (Lifetime decay) I am trying to deconvolve from a known impulse response function (IRF), as well as the IRF itself. I'm using scipy.signal.deconvolve. Please note for ...
0 votes
0 answers
10 views

Rectified Distribution

I have a vibration signal data with 2500 data points. I want to make a rectified distribution from this signal as appear in figure 4 here to calculate the rectified skewness of the signal. From ...
  • 1
1 vote
1 answer
2k views

How to calculate the envelope of a complex signal using python [closed]

I used the scipy hilbert function to calculate the envelope of my signal. The problem is that the signal is complex, so it throws an error when I use Hilbert function. I tried to just use the real ...
1 vote
2 answers
891 views

Are scipy second-order Gaussian derivatives correct?

For an edge detection algorithm, I need to compute second-order derivatives of an image, and I do this with use of Gaussian derivatives. I assumed that the ...
  • 145
3 votes
3 answers
587 views

scipy.signal.spectrogram() - how to handle gaps in the timeseries data

Looking at the magnitude of variable stars - the dataset is from here: https://dogwood.physics.mcmaster.ca/Cepheid/URL/MW/BD-10d4669.html The magnitude plot: ...
0 votes
1 answer
495 views

scipy.signal.spectrogram() with noverlap=nperseg-1, what are the possible side-effects?

I'm using a simulated data set which can be downloaded from the link in the fist paragraph on this page (it's an Excel file): https://www.analyticbridge.datasciencecentral.com/forum/topics/challenge-...
-1 votes
1 answer
104 views

scipy.signal.stft temporal resolution

Using the STFT function from scipy.signal has produced unexpected results for me. I am performing an STFT on 10 seconds of data, sampled at 25,000 Hz. I am using STFT settings of nperseg=256 and ...
1 vote
1 answer
864 views

scipy cross-correlation: interpretation

I want to compute the phase shift between two 1-D signals of same frequency, but before I'm trying to compute the time shift between. The cross-correlation function seems to be ideal for that but I'm ...
  • 41
2 votes
1 answer
1k views

Deconvolution with Python in real life

I have measured a signal which is convolved with the profile of the measuring apparatus. Now I want to remove this contribution to get the "real" signal. I am trying to do this with Python. ...