Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotes FWHM but returns standard deviation width #52

Open
courtcraw opened this issue Aug 30, 2023 · 0 comments
Open

Quotes FWHM but returns standard deviation width #52

courtcraw opened this issue Aug 30, 2023 · 0 comments

Comments

@courtcraw
Copy link

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])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant