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
-1
votes
0answers
12 views

Which one is a better method for contour detection? image processing or deep learning?

I'm studying on a project. i don't know which method should i choose, image processing or deep learning? (i am using python) 1- Detect the sample when sample is put on the frame 2- Remove the ...
0
votes
1answer
44 views

python3: speech recognition - calculating features of a WAV file

I am supposed to do this as a school project, but I am kind of lost when it comes to signals and would appreciate your help. Also, English is not my first language, and I will be translating the ...
0
votes
0answers
16 views

Can I get some help plotting an IIR filter frequency response in Python?

The problem I'm trying to solve is described here. In my script, I used Euler's identity to calculate z^-n, such that z^-n = cos(omegan) - jsin(omegan). I find the magnitude of these values from a ...
0
votes
1answer
50 views

How to plot the periodic digital spectrum?

In a previous answer, Dan Boschen wrote (emphasis mine): First let me explain the "unfolded" digital spectrum: If you allow the frequency axis of the sampled signal to extend to $\pm \infty$, ...
0
votes
0answers
18 views

Cepstrum calculation with 5-smoothing zero padding

I am trying to compute cepstrum of a signal x An implementation of this in python is: ...
0
votes
2answers
56 views

how can we align wto signals with a time lag in between?

I have two signals from two different sensors. I cropped the area i am interested in from both sensor signals. The problem is that the signals start at different time instants. I am searching for a ...
0
votes
0answers
31 views

Python resampling and filtering question

Intro Hi I'm looking for someone with some experience to walk me through some questions I have regarding resampling (downsampling) in Python. Here is my problem: I have accelerometer data that comes ...
0
votes
0answers
32 views

Trying to convert Raw image(Bayer format) to jpg/png image in Python

I am using the Sony Low-light image dataset from the paper Learning-to-see-in-the-Dark. I am trying to convert Raw image (bayer pattern in arw format) into a jpg/png. I used an online tool that gives ...
0
votes
0answers
12 views

Issues to debug source code did in OpenCV through Python [closed]

I am trying to debug OpenCV python source codes through MS visual studio code, initially, I put the breakpoint at line 20, but even so, I am facing every time the same error at the command line: <...
0
votes
1answer
32 views

How to measure algorithmically side lobes in real data

I want to measure algorithmically the following parameters in a given FFT data (real numbers). peak side lobe levels side lobe levels 
side lobes nulls The following image illustrates parameters I ...
2
votes
2answers
73 views

Why is my signal attenuated after applying a HighPass-filter?

I am new to DSP, but I've been attempting apply a butterworth high-pass filter on a 1D array (Values peeking at 300~) to eliminate any noise, yet when applying a high pass filter, I'm ending up with ...
0
votes
2answers
69 views

downsample signal to a specific number of samples in Python

The Python Scipy library provides several functions to downsample signals, but they all have limitations: The resample function is based on Fourier method, which means it assumes periodic signals. ...
0
votes
1answer
48 views

How can I correctly plot an impulse_response() of a discrete transfer function?

I posted this question on stack overflow and I think it was the wrong place so I moved it here. Hello, I'm new to python, I just want to use the control library and I'm slowly learning, I did my ...
2
votes
1answer
51 views

Large spike at beginning of signal after applying Bandpass filter

Foreword: I am a PhD student and fairly unexperienced with many signal processing and engineering concepts, please be gentle. I am attempting to filter out a frequency range of 1Hz to 2Hz from a 2....
1
vote
1answer
24 views

Applying a 2D band pass filter (Butterworth ?) to an array with NaNs

I am trying to filter out the low frequencies of an array looking like this : For now, I am taking transects of this array and applying a 1D - butterworth band pass filter : ...
1
vote
1answer
60 views

Running the BM3D Denoising Algorithm in Python

I am looking for a strong baseline in image denoising and therefore wanted to have the BM3D algorithm in my benchmark. These 2 python implementations: https://github.com/ericmjonas/pybm3d https://...
0
votes
1answer
78 views

Demodulation of FSK signal

What kind of FSK signal is this and what demodulation technique can I use to demodulate it. Why is the phase of the 1's changing like that and how does that effect how it needs to be demodulated. I ...
1
vote
1answer
31 views

SciPy Lfilter issue

For one of my DSP projects, I decided to use python to perform signal processing. While I am new to python, I understand that it is a very powerful and versatile language. For my processing, I opted ...
3
votes
5answers
264 views

What Are The Semantics Of Wav-File Sample Values?

The title is the question. To make this concrete, assume I have a standard 16-bit single channel wav file, with (although it doesn't matter) a 16000 Hz sampling rate. Each sample magnitude will be a ...
0
votes
1answer
33 views

which features fundamental frequency is correlated?

I'm unable to compute $f_0$ (fundamental frequency) in librosa feature extraction. By ready much in github issues check the second comment. I see that $f_0$ is ...
0
votes
1answer
28 views

numpy.linalg.lstsq underdetermined case

I would like to understand what I am doing wrong here. I am trying to perform polynomial regression by minimizing the least squares, ||Au-y||^2, where y is the given data and A is the matrix where the ...
0
votes
0answers
39 views

Stuck with plotting wavelet transform in Python

I want to plot the frequency composition of a sampled signal data versus time by using surf or any 3D plot. Normally time resolution of FFT is zero so I want to use wavelet transform where I want to ...
0
votes
0answers
9 views

Normalize a Mel-Spec over which axis?

I have to find out: how to normalize a Mel-spectrogram.(for mashine-learning purpose) However, I don't know which axis has to be transformed. The spectrogram S is of shape (m x n) where n are the ...
1
vote
1answer
80 views

Understanding Fourier Transforms in abstract math terms

I am having a hard time implementing a method that computes Fourier transform coefficients for the complex form using the trapezoid rule. I have floated questions in the math and stackoverflow ...
2
votes
1answer
76 views

get poles and zeros of frequency response

I am working on a python based LTSPICE project. I would like to get poles and zeros of AC simulation data. Is there a way to get them under use of the magnitude and phase out of the frequency ...
0
votes
1answer
35 views

estimation of ARMA(1,1) with MA parameter greater than 1

I am working with the following simple ARMA(1,1) model: $$ z_{t+1} = \phi z_{t} + \theta\varepsilon_{t} + \varepsilon_{t+1} $$ In my case $\theta$ depends on some other parameters, and, therefore, I ...
1
vote
0answers
14 views

Looking for a way to fill holes in objects, and break bridges between them

I am trying to extract building footprints from satellite images. Using a series of morphological operations i.e erosion and opening by reconstruction, I'm able to obtain the footprints, albeit with a ...
1
vote
0answers
86 views

Problem using pitch shifting with TD-PSOLA and formant preservation

I tried out this implementation of TD-PSOLA (https://github.com/sannawag/TD-PSOLA) and even though I know how the algorithm works, I can't understand why I get NO audible differences in the output ...
2
votes
2answers
50 views

How to detect real time sound onsets?

I'm a Software Engineer Undergraduate. I'm trying to detect drum strokes(beats) in real-time in python. I used amplitude threshold-based onset detect (beat detect) algorithm but it takes other noises ...
3
votes
0answers
39 views

How to compare imaginary coherence values?

High, I am currently writing my Master's thesis on susceptibility for hypnosis. I am comparing EGG signals of lowly and highly susceptible individuals. The imaginary coherence is given by: $$ \...
0
votes
0answers
48 views

How accurate is Python's FFT?

I am getting started with Python's FFT. I tested it on a signal that is a sum of three signals, two of which have an eigenfrequency of the grid, the third one does not (but due to large no. of data ...
0
votes
1answer
45 views

Real Fast Fourier Transformation (FFT) in 2D changes with changing the axes order

I am using Python to calculate the real FFT for a 2D array. I found that the real FFT function does not return an array with the same size as the input array, rather, it returns an array with the same ...
2
votes
1answer
65 views

KalmanFilter EM estimation of covariances

The question might be very simple, but I get a strange result from Kalman Filter. Let us consider the simplest state-space model, the random walk plus noise: $$ y_{t} = x_{t} + \varepsilon_{t}\\ x_{t} ...
0
votes
0answers
20 views

Calculating a transform with a circle and lines

I am trying to determine the transformation (rotation + translation + scale) between two images in order to shift them. The images are taken with two different modalities that produce very different ...
0
votes
0answers
32 views

Scaling x axis for FFTs in Python

I edited the post to be more specific, see below. I have a dataset, on which I need to perform and IFFT, cut the valueable part of it (by multiplying with a gaussian curve), then FFT back. First it's ...
0
votes
0answers
67 views

Does bicubic downsampling in PyTorch internally involve anti-aliasing?

Does bicubic downsampling in PyTorch torch.nn.functional.interpolate internally involve anti-aliasing? If not, how can we avoid aliasing when direct using bicubic ...
0
votes
0answers
10 views

Want to create a function that calculates the ISO and Shutter speed based on the brightness of previous image

I want to calculate the shutter speed and ISO of Picamera using the brightness information of the previous image I captured. I have already calculated the brightness of the previous image but I am ...
0
votes
1answer
52 views

Understanding the FFT phase spectrum with a simple example

I'm trying to compute the DFT using scipy's functions. I don't understand why the phase spectrum of a simple sine wave with 2 Hz frequency doesn't show $\pm\pi/2$ at the $\pm 2Hz$ frequencies. Instead,...
0
votes
0answers
16 views

Compute SNR for a noisy signal in Python [duplicate]

I have a discrete signal represented by an array in Python: $x \in R^N$. Now I add Gaussian noise to x: $x = x + np.random.normal(l=0, s=1, size=x.shape)$. How can I compute the signal-to-noise ratio ...
0
votes
0answers
58 views

I wish to create a GNU Radio program in C++ that doesn't need GRC or Python, is there a reference or template for this?

I want to create a functionally equivalent C++ file to the Python top_block.py file that is generated by GRC when executing a (blank example) flow chart. I know that C++ can be used to define blocks ...
3
votes
1answer
58 views

Square wave FFT results show frequency that seems too low?

I have created an open source plotting package for a low cost oscilloscope - see link here: GitHub Plotting Software But during my testing I have one result that may be wrong: a noisy 7 kHz square ...
0
votes
1answer
34 views

How to produce color image using edge detected images?

Hi I am trying to produce an image which is a combination of multiple images such as in focus stacking. Now I have 6 photos and I want to produce a final image such that the final image uses blocks of ...
0
votes
1answer
40 views

How to implement Matlab welch in python with the same result?

I want to implement Matlab pwelch function in python. The Matlab code is shown blew: [PSD,f] = pwelch(data,length(data),[],[],2000); which data is a row vector ...
1
vote
0answers
58 views

How to filter out noise in high frequency signal?

I am trying to filter this signal (download-zip): ...
0
votes
1answer
21 views

Generating spectrogram for band-pass filtered wav file python

I have some .wav files of heart sounds. I want to apply band-pass filter [20Hx 100 Hz]. Then generating PCG images size of 560x420 pixels and RGB format. How could i do this? Any help will be highly ...
0
votes
0answers
10 views

SSD object detection - Class score and bbox coordinates computing

How does SSD ( single shot multibox )object detection model computes the the confidence score and the bounding box coordinates, referring to SSD paper, it said that this process is done with the aid ...
0
votes
0answers
30 views

Least Square Support Vector Machine (LS-SVM) in python

I was wondering if there is a package for LS-SVM in python? I know how to carry out SVM but not sure how to call LS-SVM and also if there would be some sample codes for LSSVM?
0
votes
1answer
44 views

PyAudio recording is taking much longer than planned

I'm trying to record sounds in chunks using PyAudio for 15 seconds, chunk size being 1024 and sampling rate is 1024 *40. I understand the number of chunks would be (time of recording) * (sampling rate)...
0
votes
1answer
19 views

How do I filter out this horizon from my contour?

I am trying to identify the T-rex and obstacles (cactus and bird) from Google's no-internet game. What I have done is: Apply GaussianBlur filter Apply Canny Apply Dilate Apply erode findContours ...
0
votes
1answer
63 views

Conclusions of sampling around Nyquist Rate

I'm trying to understand some results of playing around with sampling around a signal's Nyquist sampling rate. For my example, I'm sampling a $B=5\mathrm{Hz}$ wave over a 1 second period. In the ...