Correlation

class mutis.correlation.Correlation(signal1, signal2, fcorr)[source]

Bases: object

Analysis of the correlation of two signals.

Parameters
signal1Signal

Values of the time axis.

signal2Signal

Values of the signal axis.

fcorrstr

Method used to correlate the signals.

Methods Summary

gen_corr([uncert, dsamples])

Generates the correlation of the signals.

gen_synth(samples)

Generates the synthetic light curves.

gen_times([ftimes])

Sets times and bins using the method defined by ftimes parameter.

peak_find([smooth, smooth_std, Ninterp])

Find the peaks of the correlation, optionally smoothing with a kernel of standard deviation s.

plot_corr([uncert, ax, legend])

Plots the correlation of the signals.

plot_signals([ax])

Plots the signals involved in this correlation.

plot_times([rug])

Plots the time binning generated previously.

Methods Documentation

gen_corr(uncert=True, dsamples=500)[source]

Generates the correlation of the signals.

Generates the correlation of the signals, and computes their confidence level from the synthetic light curves, which must have been generated before.

gen_synth(samples)[source]

Generates the synthetic light curves.

Generates the specified number samples of synthetic light curves for each signal, to be used to compute the significance the correlation.

Parameters
samplesint

Number of synthetic light curves to be generated for each signal.

gen_times(ftimes='canopy', *args, **kwargs)[source]

Sets times and bins using the method defined by ftimes parameter.

Parameters
ftimesstr

Method used to bin the time interval of the correlation. Possible values are: - “canopy”: Computes a binning as dense as possible, with variable bin width and (with a minimum and a maximum resolution) and a minimum statistic. - “rawab”: Computes a binning with variable bin width, a given step, maximum bin size and a minimum statistic. - “uniform”: Computes a binning with uniform bin width and a minimum statistic. - “numpy”: Computes a binning suitable for method=’numpy’.

peak_find(smooth=False, smooth_std=None, Ninterp=1000)[source]

Find the peaks of the correlation, optionally smoothing with a kernel of standard deviation s. Returns dict with peak positions and significances, ordered from closest to farthest from zero.

plot_corr(uncert=True, ax=None, legend=False)[source]

Plots the correlation of the signals.

Plots the correlation of the signal, and the confidence limits computed from the synthetic curves.

Parameters
axmatplotlib.axes.Axes

Axes to be used (default None, it creates a new axes).

legendbool

Whether to add a legend indicating the confidence levels.

plot_signals(ax=None)[source]

Plots the signals involved in this correlation.

Plots the signals involved in this correlation, in the same window but with different twin y-axes and different colors.

Parameters
axAxes

Axes to be used for plotting.

plot_times(rug=False)[source]

Plots the time binning generated previously.

Plots the number of total bins, their distribution and the number of points in each bin for the generated time binning, previously generated with Correlation().gen_times(…).

Parameters
rugbool

Whether to make a rug plot just below the binning, to make it easier to visually understand the density and distribution of the generated bins.