Skip to content

Quotes FWHM but returns standard deviation width  #52

Description

@courtcraw

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions