Exo-TiC / ExoTiC-LD

Limb-darkening package to calculate the coefficients for specific instruments, stars, and wavelength ranges
https://exotic-ld.readthedocs.io
MIT License
8 stars 6 forks source link

add square-root law #28

Closed hrwakeford closed 1 year ago

hrwakeford commented 1 year ago

Add in the square-root limb-darkening law.

hrwakeford commented 1 year ago

@DavoGrant Add the following function to ld_laws.py

@custom_model
def squareroot_limb_darkening(x, c1=0.0, c2=0.0):
    """
    Define square-root limb darkening model with four parameters c1, c2
    """
    model = 1. - (c1 * (1. - x)) + (c2 * (1. - x **0.5))
    return model

with the following call sequence in ld_computation.py

        def compute_squareroot_ld_coeffs(self, wavelength_range, mode,
                                    custom_wavelengths=None,
                                    custom_throughput=None):
        """
        Compute the square root limb-darkening coefficients.
        Parameters
        ----------
        wavelength_range : array_like, (start, end)
            Wavelength range over which to compute the limb-darkening
            coefficients. Wavelengths must be given in angstroms and
            the values must fall within the supported range of the
            corresponding instrument mode.
        mode : string
            Instrument mode which defines the throughput.
            Modes supported for Hubble:
                'HST_STIS_G430L', 'HST_STIS_G750L', 'HST_WFC3_G280p1',
                'HST_WFC3_G280n1', 'HST_WFC3_G102', 'HST_WFC3_G141'.
            Modes supported for JWST:
                'JWST_NIRSpec_Prism', 'JWST_NIRSpec_G395H',
                'JWST_NIRSpec_G395M', 'JWST_NIRSpec_G235H',
                'JWST_NIRSpec_G235M', 'JWST_NIRSpec_G140H-f100',
                'JWST_NIRSpec_G140M-f100', 'JWST_NIRSpec_G140H-f070',
                'JWST_NIRSpec_G140M-f070', 'JWST_NIRISS_SOSSo1',
                'JWST_NIRISS_SOSSo2', 'JWST_NIRCam_F322W2',
                'JWST_NIRCam_F444', 'JWST_MIRI_LRS'.
            Modes for photometry:
                'Spitzer_IRAC_Ch1', 'Spitzer_IRAC_Ch2', 'TESS'.
            Alternatively, use 'custom' mode. In this case the custom
            wavelength and custom throughput must also be specified.
        custom_wavelengths : array_like, optional
            Wavelengths corresponding to custom_throughput [angstroms].
        custom_throughput : array_like, optional
            Throughputs corresponding to custom_wavelengths.
        Returns
        -------
        (c1, c2) : tuple
            Limb-darkening coefficients for the square root law.
        """
        # Compute the stellar limb-darkening.
        mu, intensity = self._limb_dark_fit(wavelength_range, mode,
                                            custom_wavelengths,
                                            custom_throughput)

        # Fit square-root limb-darkening law.
        fitter = LevMarLSQFitter()
        squareroot = squareroot_limb_darkening()
        squareroot = fitter(squareroot, mu, intensity)

        return squareroot.parameters