Data visualization

Below we list all the functions available in the NURI software specifically designed to search for and extract data from a given period of time. More details about each function, with examples on how to execute them, can be found further down this page. A live example can be executed from this Google Colab tutorial .

plot_spectrogram (data[, tmin, tmax, fmin, ...])

Plot multiplot figure with time series, PSD and spectrogram.

Plot spectrogram

nuri. plot_spectrogram ( data , tmin = None , tmax = None , fmin = None , fmax = None , vmin = None , vmax = None , mmax = None , mmin = None , mode = 'wavelet' , omega0 = 6 , dj = 0.05 , fct = 'morlet' , stride = None , nfft = None , overlap = None , scale = 'log' , median = False , funit = 'Hz' , tunit = 'secs' , cmap = 'inferno' , zone = 'Local' , fname = None ) [source]

Plot multiplot figure with time series, PSD and spectrogram.

Parameters :
data TimeSeries

Magnetic field data

tmin, tmax datetime

First and last timestamps

fmin, fmax float

Minimum and maximum frequencies

vmin, vmax float

Minimum and maximum color values

mode str

Spectrogram mode, wavelet or Fourier. Default is Fourier

omega0 int

Wavelet function parameter

dj float

Scale resolution (smaller values of dj give finer resolution)

fct str

Wavelet function (morlet,paul,dog)

stride float

Length of segment

nfft float

Length of FFT

overlap float

Length of overlapping segment

cmap str


scale str

Plotted frequency scale. Default is “log”.

funit strg

Frequency unit, Hz or mHz. Default is Hz.

tunit str

Time unit, secs, mins or hrs. Default is mins.

fname str

Output file name.


The matplotlib.pyplot.imshow module is used to plot the wavelet spectrogram. This module is usually used to plot raw images and assumes that the position of the cell in the input spectrogram array directly represents the position of the pixel in the raw image. That is, for an input Python array (in which rows are appended below previous ones), the first row in the array is assumed to represent the top line of pixel in the image. Therefore, in order to plot the spectrogram array using the imshow module, one needs to carefully check that the rows (which are representative of the frequency bands), are stored in descending order such that the lowest frequency is placed at the end (bottom) of the array.


>>> data = nuri.get_data('2016-3-14-10','2016-3-14-11','/content/drive/MyDrive/CityMagData/1Hz',station=2,sensor='biomed',scalar=True)
>>> nuri.plot_spectrogram(data)