Skip to content

EleDes/Noise-spectral-density-from-timeseries-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Noise spectral density (NSD) from time series in Python

This tool calculates the estimated noise amplitude spectral density of a time series.

From the white noise part the rms value of a desired bandwidth can be calculated: rms = value * bandwidth^0.5

E.g. it is used in electronic component datasheets to show 1/f (1/f^n, n:real) corner and white noise part (flat) of voltage, but same can be applied to current noise.

NSD function get()

Based on Welch's method.

Parameters:
-----------

ts_values : array_like
    Time series of the signal (amplitude)

sample_frequency : int/float
    The sample frequency in Hz (SPS - Samples per second)

nsd_bins : int, optional
    number of NSD bins (points) to be calculated
    needs to be lower than the ts_values count
    default: 1/4 count of ts_values


window_function : function(length: int), optional
    returns: [int, array_like]
        first index is the optimum overlapping in samples for the window
        second index are the values of the window function
    default: window_HFT90D

crop : slice, optional
    default: the last and the first 3 NSD values are dropped as they are not reliable

Returns
-------
out : [array, array]
    The frequencies (index 0) and the corresponding NSD values (index 1)

Warning:

If the acquisition time of the input signal (aperture) is lower than the time between samples of the output (ts_values), than the NSD is incorrect (e.g. AZ on ADCs/DMMs)!

Nsd using acquisition time (aperture) as sample_frequency only shows correct white noise part.

Nsd using time between samples as sample_frequency only shows correct 1/f (1/f^n, n:real) part, the white noise part is too high, being (Tsps/Tacq)^0.5, e.g. for AZ: (40ms/20ms)^0.5, so ~1.4

Neither will give the correct 1/f (1/f^n, n:real) noise corner!

Examples

nsd_example generates white & brownian noise with a corner frequency of 0.1Hz/1nV: nsd_example

nsd_example_sps shows how a difference between acquisition time and time between samples effects the NSD: nsd_example_sps

nsd_example_csv imports data from csv: nsd_example_csv

nsd_example_smooth shows different filters: nsd_example_smooth

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages