Skip to content

Overview of the GaussianFit class

Daniel Berke edited this page Feb 24, 2022 · 1 revision

GaussianFit

The GaussianFit class performs the actual fitting of a Gaussian or integrated Gaussian function to an absorption feature. It takes an instance of Transition and HARPSFile2DScience, plus some optional additional parameters, and returns an instance of GaussianFit containing information on the fit (if successful).

Attributes GaussianFit expects in the object passed to observation

It should be possible to construct an object which GaussianFit would use in place of an instance of HARPSFile2DScience as long as it has the following attributes.

Data arrays:

  • barycentricArray: a Numpy array containing barycentric wavelengths for each pixel.
  • fluxArray: a Numpy array containing the flux in photo-electrons for each pixel.
  • errorArray: a Numpy array containing the uncertainty for each pixel.
  • pixelLowerArray: a Numpy array containing the wavelength at the left (lower) edge of each pixel, assuming wavelength increases with increasing pixel count along each row.
  • pixelUpperArray: a Numpy array containing the wavelength at the right (upper) edge of each pixel, assuming wavelength increases with increasing pixel count along each row.

Note: for HARPS, these three arrays are 2D, with each row representing an echelle order. I haven't tested it, but I think GaussianFit could handle a 1D array without (much?) modification, as long as it is treated as a 2D array that just happens to have only one row. Also, while all the other attributes are currently required, pixelLowerArray and pixelUpperArray are only required if GaussianFit is invoked with the integrated option, which uses an integrated Gaussian function to perform the fit.

Other attributes associated with the observation:

  • radialVelocity: the heliocentric radial velocity between the Sun and the target of the observation. GaussianFit searches within a fairly generous 5 km/s range around the wavelength expected by correct for the red/blue-shift of the target, so this doesn't need to too precise; it should be fine to a km/s or two.
  • dateObs: a datetime.datetime instance, representing the time the observation was taken.
  • airmass: the airmass at the time of observation, as a float.
  • exptime: the exposure time of the observation, as a float.

Attributes stored (and possibly used elsewhere), but not used in the process of fitting itself:

  • BERV: the barycentric Earth radial velocity at the time of the observation. Nominally in units of m/s.
  • calibrationFile: the name of the file used for getting the coefficients to construct the wavelength scale for the HARPS file, as a string or pathlib.Path object.
  • calibrationSource: the name of the calibration source, whether a ThAr lamp, a Fabry-Perot etalon, laser frequency comb, etc.

Note: I stored a few pieces of data in each fit in case they were needed later (especially since it would impossible to attach new data once the fitting process had happened), so I'm not 100% sure if these are actually used elsewhere in VarConLib.