2022 Developer Survey is open! Take survey.

Questions tagged [scipy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
20 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 ...
user avatar
0 votes
0 answers
25 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 ...
user avatar
  • 135
1 vote
0 answers
51 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 ...
user avatar
  • 11
0 votes
1 answer
60 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-...
user avatar
  • 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 ...
user avatar
0 votes
1 answer
34 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 ...
user avatar
  • 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 ...
user avatar
1 vote
2 answers
45 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: ...
user avatar
  • 59
0 votes
1 answer
62 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 ...
user avatar
1 vote
0 answers
150 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 ...
user avatar
  • 11
1 vote
0 answers
32 views

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

...
user avatar
  • 175
0 votes
1 answer
68 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 ...
user avatar
2 votes
2 answers
147 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 ...
user avatar
  • 43
2 votes
1 answer
86 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 ...
user avatar
  • 33
1 vote
1 answer
160 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 ...
user avatar
0 votes
0 answers
18 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 ...
user avatar
0 votes
1 answer
43 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 ...
user avatar
4 votes
3 answers
184 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 ...
user avatar
1 vote
1 answer
61 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 ...
user avatar
  • 111
1 vote
1 answer
128 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: ...
user avatar
0 votes
0 answers
33 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 ...
user avatar
0 votes
1 answer
77 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. ...
user avatar
  • 23
0 votes
0 answers
64 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 ...
user avatar
1 vote
1 answer
86 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 ...
user avatar
0 votes
2 answers
97 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 ...
user avatar
2 votes
0 answers
27 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(...
user avatar
  • 131
0 votes
1 answer
85 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: ...
user avatar
-1 votes
1 answer
257 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 ...
user avatar
  • 1
1 vote
0 answers
146 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 ...
user avatar
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 ...
user avatar
  • 1
1 vote
1 answer
1k 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 ...
user avatar
1 vote
2 answers
623 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 ...
user avatar
  • 145
3 votes
3 answers
378 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: ...
user avatar
0 votes
1 answer
341 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-...
user avatar
-1 votes
1 answer
78 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 ...
user avatar
1 vote
1 answer
647 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 ...
user avatar
  • 33
2 votes
1 answer
831 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. ...
user avatar
0 votes
1 answer
67 views

narrow band filtering of a signal that is sampled at high frequency

I have a signal that is sampled at 2KHz. The frequency band of interest is from 1/60 Hz to 1 Hz, and I want the final signal to be downsampled to 10 Hz. What is the best way to do this? I read that ...
user avatar
2 votes
2 answers
364 views

Invertible low-pass (Butterworth) filter in python (scipy)?

Question Is there an invertible low-pass filter built into scipy.signal (or other python package)? If so, what is it? If not, why not (is there something ...
user avatar
2 votes
1 answer
45 views

Getting error while performing upsampling of an audio signal processing using low pass filter in python

I want to perform upsampling of an audio signal introducing zeros between samples to create a longer signal with factor of N=2. The sampling rate is 44100Hz, time = 5sec. ...
user avatar
0 votes
1 answer
56 views

Apply FFT to positive spiky signal

I have a signal that looks like this It has regularly occurring peaks 50 units apart, and offset from 0 by approximately 20. I thought I could apply the DTFT to this signal and extract the period (...
user avatar
  • 143
1 vote
1 answer
348 views

Compare two Fourier transforms of two signals by calculating the coherence

My overall aim is to compare the edges of two images by comparing their Fourier Transforms (FFT) and to calculate one number as a key performance indicator that describes how much they are similar to ...
user avatar
0 votes
1 answer
55 views

Problem wih (diverging?) digital IIR filter for an online acquisition system

I am trying to plot windows of acquired data from an LSL-compatible system. For the example below, let's consider 1-second window of a 64 channel EEG system. In practice, I use shorter 0.2-window, but ...
user avatar
  • 181
0 votes
1 answer
368 views

How to correctly set the zi parameter (initial condition) for a scipy IIR filter

Let's take as an example an IIR filter using the 'sos' output, as this is what I use the most. To apply a bandpass filter, you can do: ...
user avatar
  • 181
2 votes
1 answer
157 views

Difference between MATLAB zp2sos and python zpk2sos functions

I am trying to port some code from MATLAB to python. The goal is to use Butterworth filter (4th order, bandpass) API and convert it to second-order sections. I get the same output between MATLAB and ...
user avatar
  • 23
0 votes
1 answer
84 views

Obtaining real numbers from FFT with same length as original signal

In this article the real valued time domain signal is transformed to the frequency domain to extract some features like mean or variance. But after transform to the frequency domain I calculate ...
user avatar
  • 111
0 votes
0 answers
322 views

Trying to implement matlab pwelch function in python using scipy welch

I am trying to port the statistics toolbox function pwelch from matlab into python, but when I am trying to implement it using scipy.signals.welch, it does not return the same results as it does in ...
user avatar
0 votes
0 answers
60 views

Periodogram/PSD from FFT amplitude

I have performed a STFT for signals and obtained the amplitude through ...
user avatar
  • 9
0 votes
0 answers
274 views

Boundary effects with scipy.fftconvolve after convolution

I am having some numerical error in my code that propagates continuously, and has to do with the implementation of convolutions in Python; this is kind of struggling my progress and I would really ...
user avatar
4 votes
1 answer
2k views

Scalograms in python

I am reading this paper to learning basic concepts of dsp and I want to reproduce the following scalogram of a test signal (fig 4.2 of the paper): It has been produced from the discretization of the ...
user avatar