# Tag: signal-processing

## Unable to distinguish four cosines from a FFT

I have four cosines with frequencies 400e-3, 500e-3, 600e-3 and 700e-3 and I am trying to do the FFT of them but under the time I need, I cannot distinguish the four. Is there a way to distinguish the peaks without changing the tmax time of 1.76 and the frequencies? Here are the results: Answer The solution was to increase

## Is there any way to detect edge in this situation?

I try to detect edge using python. There are hundreds of algorithms for edge detection, however, the image is very obscure and unclear. The most serious problem is one edge is located at the local maximum value, but the other edge is located slightly shifted from local maximum value. Through the detailed examination, I found the other edge is located

## Problem with plotting peaks using find_peaks from SciPy to detect drastic up/down turns or global outliers

Let’s say I have following dataframe contains value over time or date: I inspired from this answer to detect peaks and valleys via below code: This is the output: The problems: I can’t figure out how I can configure find_peaks() documentation to reach meaningful/drastic peaks & valley with respect to threshold as global outliers. I also checked this post but

## How to apply a first order filter with a different time constant for each column of a pandas dataframe?

everyone! I have a pandas dataframe where each column represents a noisy signal, and I would like to apply a first order filter (gain = 1, time constant = “x” seconds) in each column, but with a different time constant for each column. For example: Any ideas? Thanks! Answer You can use apply with the args passed as a tuple

## How can I count the rising edge of a square signals using python?

I have a square signal using the following code. How can I count the rising edges using python? Following image represents my output: Answer If your data is super clean (like the signal provided), then just find the number of occurrences when the value is greater than the previous:

## Black and white color addition

When red is mixed with green, I get yellow as expected. But when white is mixed with black, I should get normally grey but I get white. Shouldn’t I get grey? Here is the code: Answer I think what @Cris Luengo said (“If you want to get gray, average the white and black pixels together”) is valid; Also I think

## Interpolating measured sine wave using python

I have 2 sampled sine waves obtained as a measurement from a DSO. The sampling rate of the DSO is 160 GSa/s and my signal is 60 GHz. I need to find the phase difference between the two sine waves. Both are the same frequency. However, the sampling rate is not enough to accurately determine the phase. Is there any

## Progressively filter/smooth a signal in python (to straight line on the left to no filtering on the right)

A picture is worth a thousand words (sorry for the shoddy work): If the solution is preserving the value and the slope at both ends it is better. If, in addition, the position and sharpness of the transition can be adjusted it is perfect. But I have not found any solution yet… Thank you very much for your help Here

## Butterworth filters look very strange as increasing order

I’m trying to design a simple Butterworth bandpass filter in SciPy, and I’m running into some strange results. This is giving strange results, as can be seen from the image below (Butterworth filters from order 1-10). I thought the filter was supposed to become increasingly rectangular as the order increased? Does anyone know how to design a simple Butterworth filter

## Get In Focus Pixels of an Image

How to detect which pixels of an image are in focus compared to the blurry ones. Something like the ‘Focus Peaking’ feature lots of cameras have? The idea is to color the pixels that are in focus so that it assists the user while clicking a picture. Looking for an implementation through Python. Answer You can find the edges, which