How to use the stingray.modeling.ParameterEstimation function in stingray

To help you get started, we’ve selected a few stingray examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github StingraySoftware / dave / src / main / python / utils / model_helper.py View on Github external
def fit_data_with_lorentz_and_const(x_values, y_values):
    amplitude=5.
    x_0=1
    fwhm=0.5
    const=5.
    g_init = Lorentz1D(amplitude, x_0, fwhm)
    g_init += Const1D(const)
    lpost = PSDLogLikelihood(x_values, y_values, g_init)
    parest = ParameterEstimation()
    res = parest.fit(lpost, [amplitude, x_0, fwhm, const], neg=True)
    opt_amplitude = res.p_opt[0]
    opt_x_0 = res.p_opt[1]
    opt_fwhm = res.p_opt[2]
    opt_const = res.p_opt[3]
    return opt_amplitude, opt_x_0, opt_fwhm, opt_const
github StingraySoftware / dave / src / main / python / utils / model_helper.py View on Github external
def fit_data_with_gaussian(x_values, y_values, amplitude=1., mean=0, stddev=1.):
    g_init = Gaussian1D(amplitude, mean, stddev)
    lpost = PSDLogLikelihood(x_values, y_values, g_init)
    parest = ParameterEstimation()
    res = parest.fit(lpost, [amplitude, mean, stddev], neg=True)
    opt_amplitude = res.p_opt[0]
    opt_mean = res.p_opt[1]
    opt_stddev = res.p_opt[2]
    return opt_amplitude, opt_mean, opt_stddev