ashleychontos / pySYD

automated measurements of global asteroseismic parameters
https://pysyd.readthedocs.io
MIT License
25 stars 13 forks source link

Quotes FWHM but returns standard deviation width #52

Open courtcraw opened 1 year ago

courtcraw commented 1 year ago

Hi! I've noticed that pySYD returns a value called the "FWHM", however it seems that the value it's actually returning is the standard deviation width.

Traceback using the current version of pysyd on github: the returned value FWHM is defined in line 1650 of target.py: self.params['results'][self.module]['FWHM'].append(gauss[3]) gauss[3] is defined in line 1631 of target.py: gauss, _ = curve_fit(models.gaussian, self.region_freq, self.region_pow, p0=guesses, bounds=bb, maxfev=1000) the parameters of this fit are defined in the gaussian definition - lines 83-110 of models.py:

`def gaussian(frequency, offset, amplitude, center, width): """ Gaussian model

Observed solar-like oscillations have a Gaussian-like profile and
therefore, detections are modeled as a Gaussian distribution.

Parameters
    frequency : numpy.ndarray
        the frequency array
    offset : float
        the vertical offset
    amplitude : float
        amplitude of the Gaussian
    center : float
        center of the Gaussian
    width : float
        the width of the Gaussian

Returns
    result : np.ndarray
        the Gaussian distribution

"""
model = np.zeros_like(frequency)
model += amplitude*np.exp(-(center-frequency)**2.0/(2.0*width**2))
model += offset
return model`

So if pysyd's reported FWHM is indeed this "width" parameter, then it's not the FWHM. I don't see the FWHM referred to anywhere else in target.py.

Luckily it's quite an easy fix! :) I am new to using git so I don't want to screw everything up by submitting a pull request, so I'll just describe it here. The simplest change would be to replace line 1650 of target.py: self.params['results'][self.module]['FWHM'].append(gauss[3]) with: self.params['results'][self.module]['FWHM'].append(2*np.sqrt(2*np.log(2))*gauss[3])