Questions tagged [python]

Python is a high-level interpreted general programming language. Python has popular numerical and scientific libraries/packages, most notably numpy and scipy. The scipy.signal package is a powerful signal processing software collection. This tag covers the use of numpy, scipy, and other Python packages often used for SP computations.

Filter by
Sorted by
Tagged with
0
votes
1answer
9 views

What is the x and y axis showing for this matplotlib.pyplot histogram of a .wav file?

The python code below generates a histogram from a .wav file, but what exactly does the histogram show? Is the x axis amplitude binned by sampling rate? Is the y axis a count of how many samples are ...
2
votes
0answers
13 views

How to determine which measurements cause which?

Suppose I have two sequences of measurements, $x_1[n]$ and $x_2[n]$ for $0 \le n \le N-1$. How do I determine if there is a causal relationship between the two? My first thought was, well... I can ...
1
vote
1answer
61 views

Negative instantaneous frequency with hilbert transform using scipy hilbert

When I produce a chirp signal with a duration of 2 sec, sampling frequency of 200Hz, with frequencies ranging from 20Hz-100Hz, I get negative instantaneous frequencies using the scipy(Python) Hilbert ...
0
votes
0answers
17 views

Visualize the preprocessing steps of the wav file, e.g., downsampling, normalization, etc

I have an audio file, I am doing Signal preprocessing steps for other downstream tasks, I want to visualize the preprocessing steps to show the difference before and after each step. My preprocessing ...
0
votes
1answer
20 views

Pointers for digital FM synthesis

I am working on a digital synthesis project, in python and c currently. I have made a Sine and Saw wave generator and have now been working on FM between the two wave types. I have successfully made ...
0
votes
1answer
37 views

Visualise/compare numpy arrays from Matlab/Octave to matplotlib

I'm new to python and matplotlib, and I'd like to visualise / compare 3 mfcc files stored as numpy arrays in txt format. I have the Octave code below, and I'd like to know how it can be done using ...
0
votes
1answer
11 views

How to calculate SNR variation with period?

I want to calculate the SNR variation of a signal with respect to the period. The current technique I am using is calculating SNR iteratively by applying narrow bandpass filters of different range, ...
0
votes
1answer
26 views

What is the input dimension for LMS update algorithm

I just realized this forum existed, posted my question on the wrong forum. Sorry about the formatting, please don't hesitate to ask if any part of this post is unclear. This is my first post. I'm ...
0
votes
0answers
45 views

Python: How to generate log-frequency spectrogram from an audio?

I want to make a log-frequency spectrogram out of this audio. Later, I need this spectrogram for pitch sequence analysis. This is a sample sequence I want to achieve: ...
2
votes
3answers
119 views

Beat envelope detection

I am trying to write a python function that checks whether two lets say sine signals would generate a distinct beat envelope or not. I know that the beat frequency = f1-f2 where f1 and f2 are the ...
0
votes
2answers
26 views

How to implement an RF Mixer for chirp signal in python?

According to this link, all I need to do to mix two signals is to multiply them. I have two chirp signals with same properties, one leading the other. If I multiply them to get the IF output, I don't ...
1
vote
0answers
34 views

How to make a contour smooth in OpenCV

I am using OpenCV(4.5.1) and trying to extract a smooth contour of an object on my image. Firstly I got the contour by: ...
0
votes
1answer
37 views

Python: Dynamic Time Warping, what actually is a 'similarity score' and how to compute it?

I want to compare two time-series data to see their similarity to each other. For this task, I use Dynamic Time Warping (DTW) algorithm. I have tried the implementation using Python ...
1
vote
1answer
30 views

Register 2D image - 3D model

I have 2D pictures of an airplane of a specific model, taken with a simple camera, and a 3D point cloud model of this airplane. I would like to project the pictures onto the 3D model (cloud of points) ...
1
vote
2answers
41 views

How to apply an anti-aliasing filter before downsampling

I have an eeg signal with two channels (f3m2 and f4m1) which is divided into epochs. I want to augment the data by taking every 5th sample. I can re-use the discarded samples to create 5 versions of ...
1
vote
0answers
51 views

Recursive Least Square For Filtering

I just started doing research on Recursive Least Square for filtering noises such as sensors and dc motors noises. The only thing I've seen on the internet was Theoretical information about RLS but ...
0
votes
0answers
25 views

Find corresponding wavenumber from FFT - Python

I have a set of data taken from a high speed camera. I've done some image processing which results in getting a pixel location at each frame. This oscillates with time and so I have performed an FFT ...
1
vote
1answer
36 views

minimum-phase phase via Hilbert transform returned values

Following my previous question: HRIR Minimum phase I managed to compute the minimum-phase phase of a FIR filter (in my particular case, HRTF filters). However I am not sure of the phase values ...
0
votes
0answers
17 views

Seperate music instruments and estimate note density

Here is my problem: I have a .wav file of a musical performance with three instruments: a clarinet, a bass and drums. My goal is to detect the note speed played by the clarinet player (so I want the ...
1
vote
1answer
82 views

Compute minimum phase version of a FIR

I am working with HRIR filters, in particular I am trying to interpolate them. One commod method in the literature to perform interpolation of HRIR is to use the minimum-phase decomposition and ...
0
votes
1answer
22 views

Extracting ridges in automatically in image

I am trying to extract ridges from an image, calculated using the eigenvalues of the Hessian matrix (see answer in Best way of segmenting veins in leaves?). In this image I have zeroed out the ...
0
votes
0answers
12 views

refractive index KK relation

I make Kramers Kroing relation(KK relation) with scipy.integrate.quad to change $\kappa(w)$ into $n(w)$. Their KK relation is $n(w) = 1 + \frac{1}{\pi}\int_{-\infty}^{\infty} \frac{\kappa(w^{\prime})}...
0
votes
2answers
39 views

From a Waveform to a .wav file [closed]

I would like to make an autoencoder for music generation using PyTorch. In input, I would like to have a Waveform (from a .wav file) and I want the output to be a Waveform. My problem is that I don't ...
0
votes
0answers
30 views

Analyze the transient response of a system

Suppose I have a sytem with the following transfer function : $$H(s) = \frac{N_H(s)}{D_H(s)}$$ I would like a general method which is not dependant on the order of the system to analyze what would be ...
0
votes
0answers
23 views

Removing frequencies and reconstructing signal

I am trying to implement this section of this paper: https://arxiv.org/abs/2012.15846 The rPPG signal is the spatial average of green value per frame over a video. Head orientation signals are a ...
1
vote
0answers
33 views

trying to reproduce the behavior of initial conditions for the filter delays of scipy lfilter with R

I'm trying to reproduce the behavior of lfilter and lfilter_zi (from scipy) in R (using signal package if possible). This is the example provided by ...
0
votes
1answer
34 views

Filter design for an unusual EEG experiment

I'm designing a quite unusual (in terms of signal analysis) EEG experiment, which forces me to design my own filter. I have never done this before, so kindly please check my work and suggest ...
1
vote
2answers
37 views

Scipy butter filter - remove DC offset w/ high sample rate

I am having a hard time figuring out how to employ a high pass filter to remove the DC offset of my data signal with the "scipy butter" function because my sample rate is quite high. The ...
0
votes
1answer
32 views

Python: Resample without equal

I would like to resample (downsample) a signal using python in order to get an even spacing and fill gaps. About the signal: It consists of a vector for y (amplitude) and x (timestamps) Very slow; $...
0
votes
1answer
36 views

Simulate butterworth filter with initial condition of state vector in R

I'm working in R with the packages signal and control (don't know wether these are even the best for my use case). I have a high ...
0
votes
0answers
33 views

Possibilities in Audio Convolution Math

New Python user here! I am a musician working on a program to streamline a process of using convolution math on a folder of .wav samples. The idea is that each audio sample will be multiplied with ...
0
votes
1answer
38 views

How to find peak frequency in an audio frequency spectrum?

I have a audio file consisting of multiple frequencies, I need to find all the frequency peaks in the frequency spectrum after doing FFT. But the issue is how can I be able to set the threshold line ...
1
vote
1answer
53 views

Dynamic filter in real time audio

Following my previous question: Removing cracking in real time audio, I'm trying to implement a dynamic filter in real time audio. What I want to do is to create a filter where I can change the cut-...
0
votes
2answers
80 views

Removing cracking in real time audio filtering

I am getting back to DSP applications after a while and I've written a real time audio player in Python. Basically I'm reading chunks of data from a .wav file (I am doing this to simulate a real time ...
0
votes
2answers
59 views

Converting Audacity Filter Curve EQ into transfer function and applying it to a signal via python

First of I am very new to Signal Processing and to python in general. I am trying to write a script where I would feed a voice recording into it, internally apply an eq and have the modified signal ...
0
votes
1answer
39 views

Strange behavior from frequency to angular frequency in FFT

I have written a code to compute the Fast Fourier Transform of a simple complex exponential with frequency $f=50.0$, using scipy.fft. The code is written below: ...
2
votes
2answers
94 views

Inaccurate phase returned by np.angle

I am generating 2 sine waves, first one has fundamental frequency = 50 Hz, amplitude=10, phase=0, the second one has fundamental frequency = 100 Hz, amplitude = 5 and phase = np.pi/6 (which is ...
0
votes
1answer
59 views

FFT of long signal by segments/chunks with discontinuities

I am processing an EEG brain signal, which has up to 64 data channels sampled at 500 Hz. One of the analyses consists of extracting the ratio of alpha/delta power, where alpha represents the waveforms ...
0
votes
1answer
51 views

SMA, SVM and PSD python

I'm looking for python functions (package) to calculate SMA (signal magnitude area), SVM (signal vector magnitude) and PSD (Power Spectral Density). The goal is to extract features from an ...
0
votes
0answers
27 views

How detect if an object is missing from an image and set a Raspberry Pi GPIO output

I'm pretty new in OpenCv and Python. I want to detect an image. If a particular object is missing from the image set a GPIO output using on a Raspberry Pi. What would be the right way? I don't want ...
0
votes
1answer
46 views

revert back to stft from abs and phase

I have the following code on python ...
0
votes
0answers
14 views

Plot frequency tiling wavelets/curvelets

Is there a convinient way to plot the frequency tiling of for wavelets/curvelets? For example the input would be the number of scales $j$ and the output would be something like this: Preferably in ...
3
votes
3answers
811 views

Python audio analysis: which spectrogram should I use and why?

I am doing my final project at university: pitch estimation from song recording using convolutional neural network (CNN). I want to retrieve pitches existed in a song recording. For CNN input, I am ...
1
vote
1answer
339 views

Calculate the magnitude and phase of a signal at a particular frequency in python

I have a signal for which I need to calculate the magnitude and phase at 200 Hz frequency only. I would like to use Fourier transform for it. I am very new to signal processing. And this is my first ...
0
votes
1answer
54 views

Swift vDSP rFFT not same as Python np.fft.rfft()

I am trying to implement real FFT in iOS, for that i am using Accelerate Framework. Here is my Code for Swift. ...
0
votes
4answers
47 views

Filtering Angular Measurements

I am trying to apply a filter to reduce noise in angular measurements. Since the data comes with noise, the filter needs to be able to handle measurements that are not smoothly progressing; for ...
0
votes
0answers
25 views

How can I compute the magnitude of edges of an image?

if I have an image with 11x11 pixels and In the center of the image is a square of 5x5 pixels. The gray level of the background is 0 and the gray level of the square is 50. How can I compute the ...
0
votes
1answer
33 views

How to use values from the output of a block in GNURadio

I want to use the output values of the top_block as a way of directing my flowdiagram. So I want the flowdiagram to take one path if the output of my processing ...
1
vote
0answers
65 views

MUSIC algorithm for DOA with floating point input signals

I am writing a Direction of Arrival (DOA) estimator using the MUSIC algorithm in python and am having trouble getting the correct spectrogram output. Specifically, my resulting graph comes out aliased ...
0
votes
1answer
54 views

What happens to the phase spectrum when I resample?

[An update is added at the end of the post after receiving first response] I have an algorithm which is very sensitive to phase shifts. It works with signal sampled at 40MHz (it's a neural network so ...

1
2 3 4 5
18