PAHFIT / pahfit

Model Decomposition for Near- to Mid-Infrared Spectroscopy of Astronomical Sources
https://pahfit.readthedocs.io/
18 stars 26 forks source link

Enhance fitting speed by using bounding boxes #192

Closed els1 closed 2 years ago

els1 commented 2 years ago

Enhance speed of fitting (cubes): look into Astropy modeling as it includes bounding boxes (https://docs.astropy.org/en/stable/modeling/models.html#bounding-boxes).

jdtsmith commented 2 years ago

I took a look at this, and it turns out Gaussian1D already has a bounding box set as a method, which specifies 5.5sigma bounds (see below). Drude1D also has such a method defined, but it is set at 50*fwhm, both left and right, which is probably unnecessarily large. So we could think about trimming those down a bit. But the big savings from lines are apparently already baked in.

    def bounding_box(self, factor=50):
        """Tuple defining the default ``bounding_box`` limits,
        ``(x_low, x_high)``.

        Parameters
        ----------
        factor : float
            The multiple of FWHM used to define the limits.
        """
        x0 = self.x_0
        dx = factor * self.fwhm

        return (x0 - dx, x0 + dx)
karllark commented 2 years ago

Bummer.

jdtsmith commented 2 years ago

Closing as this is already implemented.