maad.util.false_Color_Spectro
- maad.util.false_Color_Spectro(df, indices=None, plim=(1, 99), reverseLUT=False, permut=False, unit='minutes', verbose=False, display=False, savefig=None, **kwargs)[source]
Create False Color Spectrogram from indices obtained by MAAD. Only indices than can be computed bin per bin (ie frequency per frequency) are used to create False Color Spectro. They are called xxx_per_bin.
- Parameters:
- dfPanda DataFrame
DataFrame with indices per frequency bin.
- indiceslist, default is None
List of indices. If permut is False (see permut), if indices is None : 1st indices is red (R), 2nd indice is green (G) and the 3rd indices is blue (B). if indices is a list of 3 indices or more, only the 3 first indices (triplet) are used to create the false color spectro. if permut is True, if indices is None : All indices in df are used if indices is a list of 3 indices or more, all the indices in the list are used to create the false color spectro with all the possibile permutations.
- plimlist of 2 scalars, default is (1,99)
Set the minimum and maximum percentile to define the min and max value of each indice. These values are then used to clip the values of each indices between these limits.
- reverseLUT: boolean, default is False
LUT : look-up table. if False, the highest indice value is the brigthest color (255) and the lowest indice value is the darkest (0) if True, it’s the reverse order, the highest indice value is the darkest color (0) and the lowest is the brighest (255)
- permutboolean, default is False
if True, all the permutations possible for red, green, blue are computed among the list of indices (see indices)
- unitstring in {‘minutes’, ‘hours’, ‘days’, ‘weeks’}, default is ‘minutes’
Select the unit base for x axis
- verboseboolean, default is False
print indices on the default terminal
- displayboolean, default is False
Display False Color Spectro
- savefigstring, optional, default is None
if not None, figures will be safe. Savefig is the prefix of the save filename.
- kwargs, optional
dpi : scalar, optional, default 96
format : str, optional, default .png
- Returns:
- false_color_imagendarray of scalars
Matrix with ndim = 4 if multiple false color spectro or ndim = 3, if single false color spectro with 3 colors : R, G, B
- tripletlist
List of triplet of indices corresponding to each false color spectro
Examples
see plot_extract_alpha_indices.py advanced example for a complete example
>>> import numpy as np >>> import pandas as pd >>> A_per_bin = [[0.5,0.4,0.3,0.2,0.1], [0.3,0.3,0.3,0.3,0.3], [0.5,0.5,0.3,0.0,0.0], [0.2,0.2,0.3,0.0,0.0], [0.0,0.0,0.3,0.0,0.0]] >>> B_per_bin = [[0.5,0.5,0.5,0.5,0.5], [0.5,0.5,0.5,0.5,0.5], [0.5,0.5,0.2,0.0,0.0], [0.5,0.2,0.1,0.0,0.0], [0.5,0.2,0.0,0.0,0.0]] >>> C_per_bin = [[0.0,0.7,0.0,0.5,0.5], [0.7,0.2,0.0,0.5,0.5], [0.5,0.5,0.7,0.2,0.2], [0.0,0.7,0.0,0.2,0.2], [0.7,0.2,0.0,0.2,0.2]] >>> df = pd.DataFrame([A_per_bin,B_per_bin,C_per_bin]) >>> df = df.T >>> df.columns = ['A_per_bin','B_per_bin','C_per_bin'] >>> df.index = pd.date_range('20200101', periods=len(df)) >>> maad.util.false_Color_Spectro (df, display=True ,unit='days', figsize=[3,3])