    Photoz kernel based on RBF kernel in SED space.

    Args:
        fcoefs_amp: ``numpy.array`` of size (numBands, numCoefs)
            describint the amplitudes of the Gaussians approximating the
            photometric filters.
        fcoefs_mu: ``numpy.array`` of size (numBands, numCoefs)
            describint the positions of the Gaussians approximating the
            photometric filters.
        fcoefs_sig: ``numpy.array`` of size (numBands, numCoefs)
            describint the widths of the Gaussians approximating the
            photometric filters.
        lines_mu: ``numpy.array`` of SED line positions
        lines_sig: ``numpy.array`` of SED line widths
        var_C: GP variance for SED continuum correlations.
            Should be a ``float`, preferably between 1e-3 and 1e2.
        var_L: GP variance for SED line correlations.
            Should be a ``float`, preferably between 1e-3 and 1e2.
        alpha_C: GP lengthscale for smoothness of SED continuum correlations.
            Should be a ``float`, preferably between 1e1 and 1e4.
        alpha_L: GP lengthscale for smoothness of SED line correlations.
            Should be a ``float`, preferably between 1e1 and 1e4.
        lambdaRef (Optional): Pivot space for the SEDs
            (``float``, default: ``4.5e3``)
        g_AB (Optional): AB photometric normalization constant
            (``float``, default: ``1.0``)
        DL_z (Optional): function for computing the luminosity distance
            as a fct of redshift. Default: an analytic approximation.
        redshiftGrid (Optional): redshift grid (array) for computing the GP.
            (default: some fine grid.)
        use_interpolators (Optional): ``boolean`` indicating if the GP
            should be used for all predictions,
            or if an interpolation scheme should be used (default: ``True``)


    Photoz kernel based on RBF kernel in SED space.

    Args:
        fcoefs_amp: ``numpy.array`` of size (numBands, numCoefs)
            describint the amplitudes of the Gaussians approximating the
            photometric filters.
        fcoefs_mu: ``numpy.array`` of size (numBands, numCoefs)
            describint the positions of the Gaussians approximating the
            photometric filters.
        fcoefs_sig: ``numpy.array`` of size (numBands, numCoefs)
            describint the widths of the Gaussians approximating the
            photometric filters.
        lines_mu: ``numpy.array`` of SED line positions
        lines_sig: ``numpy.array`` of SED line widths
        var_C: GP variance for SED continuum correlations.
            Should be a ``float`, preferably between 1e-3 and 1e2.
        var_L: GP variance for SED line correlations.
            Should be a ``float`, preferably between 1e-3 and 1e2.
        alpha_T: GP lengthscale for smoothness of time correlations.
            Should be a ``float`.
        alpha_C: GP lengthscale for smoothness of SED continuum correlations.
            Should be a ``float`, preferably between 1e1 and 1e4.
        alpha_L: GP lengthscale for smoothness of SED line correlations.
            Should be a ``float`, preferably between 1e1 and 1e4.
        lambdaRef (Optional): Pivot space for the SEDs
            (``float``, default: ``4.5e3``)
        g_AB (Optional): AB photometric normalization constant
            (``float``, default: ``1.0``)
        DL_z (Optional): function for computing the luminosity distance
            as a fct of redshift. Default: an analytic approximation.
        redshiftGrid (Optional): redshift grid (array) for computing the GP.
            (default: some fine grid.)
        use_interpolators (Optional): ``boolean`` indicating if the GP
            should be used for all predictions,
            or if an interpolation scheme should be used (default: ``True``)


    Approximate luminosity_distance relation,
    agrees with astropy.FlatLambdaCDM(H0=70, Om0=0.3, Ob0=None) better than 1%


Photometric filter response


SED template, tabulated and to be interpolated  on a redshift grid


    def on_nH_change(self):
        if self.cb_collap.isChecked()==1:
            if ',' in self.gas_nH_value.text():
                pass
            else:
                msg_err = QMessageBox()
                msg_err.setIcon(QMessageBox.Information)
                msg_err.setText("Error: For collapse, a comma is needed: e.g. '3000,1e+7'.")
                msg_err.exec_()
        QApplication.processEvents()


Class responsible for managing the search terms of genes we are searching for in NCBI.


Class responsible for managing the data for each taxon.


    This class calculates the covariance for COSEBI estimator of the
    shear-shear correlation. Inherits the functionality of the
    CovELLSpace class.

    Parameters
    ----------
    cov_dict : dictionary
        Specifies which terms of the covariance (Gaussian, non-Gaussian,
        super-sample covariance) should be calculated. To be passed from
        the read_input method of the Input class.
    obs_dict : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'observables' : dictionary
            Specifies which observables (cosmic shear, galaxy-galaxy
            lensing and/or clustering) should be calculated. Also,
            indicates whether cross-terms are evaluated.
        'ELLspace' : dictionary
            Specifies the exact details of the projection to ell space.
            The projection from wavefactor k to angular scale ell is
            done first, followed by the projection to real space in this
            class
        'THETAspace' : dictionary
            Specifies the exact details of the projection to real space,
            e.g., theta_min/max and the number of theta bins to be
            calculated.
        'COSEBIs' : dictionary
            Specifies the exact details of the projection to COSEBIs,
            e.g. the number of modes to be calculated.
        'bandpowers' : dictionary
            Specifies the exact details of the projection to bandpowers,
            e.g. the ell modes and their spacing.
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    hod_dict : dictionary
        Specifies all the information about the halo occupation
        distribution used. This defines the shot noise level of the
        covariance and includes the mass bin definition of the different
        galaxy populations. To be passed from the read_input method of
        the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey.
        Relevant values are the effective number density of galaxies for
        all tomographic bins as well as the ellipticity dispersion for
        galaxy shapes. To be passed from the read_input method of the
        Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
        'trispec' : dictionary
            Contains precision information about the trispectra, this
            includes k-range and spacing and the desired precision
            limits.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'survey_area_clust' : dictionary
            Contains information about the survey footprint that is read
            from the fits file of the survey (processed by healpy).
            Possible keys: 'area', 'ell', 'a_lm'
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).
        'tri' : dictionary
            Look-up table for the trispectra (for all combinations of
            matter 'm' and tracer 'g', optional).
            Possible keys: '', 'z', 'mmmm', 'mmgm', 'gmgm', 'ggmm',
            'gggm', 'gggg'
        'cosebis' : dictionary
            Look-up tables for calculating COSEBIs. Currently the code
            cannot generate the roots and normalizations for the kernel
            functions itself, so either the kernel's roots and
            normalizations or the kernel (W_n) itself must be given.
            Possible keys: 'wn_log_ell', 'wn_log', 'wn_lin_ell',
                           'wn_lin', 'norms', 'roots'

    Attributes
    ----------
    see CovELLSpace class

    Example :
    ---------
    from cov_input import Input, FileInput
    from cov_cosebis import CovCOSEBI
    inp = Input()
    covterms, observables, output, cosmo, bias, hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    covcosebi = CovCOSEBI(covterms, observables, output, cosmo, bias,
        hod, survey_params, prec, read_in_tables)


    This class calculates the real space covariance for shear-shear
    correlation functions xi_+/-, for position-shear correlations
    gamma_t (galaxy-galaxy lensing), and position-position correlations
    (galaxy clustering). Inherits the functionality of the CovELLSpace
    class.

    Parameters
    ----------
    cov_dict : dictionary
        Specifies which terms of the covariance (Gaussian, non-Gaussian,
        super-sample covariance) should be calculated. To be passed from
        the read_input method of the Input class.
    obs_dict : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'observables' : dictionary
            Specifies which observables (cosmic shear, galaxy-galaxy
            lensing and/or clustering) should be calculated. Also,
            indicates whether cross-terms are evaluated.
        'ELLspace' : dictionary
            Specifies the exact details of the projection to ell space.
            The projection from wavefactor k to angular scale ell is
            done first, followed by the projection to real space in this
            class
        'THETAspace' : dictionary
            Specifies the exact details of the projection to real space,
            e.g., theta_min/max and the number of theta bins to be
            calculated.
        'COSEBIs' : dictionary
            Specifies the exact details of the projection to COSEBIs,
            e.g. the number of modes to be calculated.
        'bandpowers' : dictionary
            Specifies the exact details of the projection to bandpowers,
            e.g. the ell modes and their spacing.
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    iA_dict: dictionary
        Specifies all the information about the intrinsic alignment model.
        To be passed from the read_input method in the Input class.
    hod_dict : dictionary
        Specifies all the information about the halo occupation
        distribution used. This defines the shot noise level of the
        covariance and includes the mass bin definition of the different
        galaxy populations. To be passed from the read_input method of
        the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey.
        Relevant values are the effective number density of galaxies for
        all tomographic bins as well as the ellipticity dispersion for
        galaxy shapes. To be passed from the read_input method of the
        Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
        'trispec' : dictionary
            Contains precision information about the trispectra, this
            includes k-range and spacing and the desired precision
            limits.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'survey_area_clust' : dictionary
            Contains information about the survey footprint that is read
            from the fits file of the survey (processed by healpy).
            Possible keys: 'area', 'ell', 'a_lm'
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).
        'tri': dictionary
            Look-up table for the trispectra (for all combinations of
            matter 'm' and tracer 'g', optional).
            Possible keys: '', 'z', 'mmmm', 'mmgm', 'gmgm', 'ggmm',
            'gggm', 'gggg'

    Atrributes
    ----------
    see CovELLSpace class

    Example :
    ---------
    from cov_input import Input, FileInput
    from cov_theta_space import CovTHETASpace
    inp = Input()
    covterms, observables, output, cosmo, bias, iA hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    covtheta = CovTHETASpace(covterms, observables, output, cosmo, bias,
        iA, hod, survey_params, prec, read_in_tables)


    Provides methods to read-in all parameters from a configuration file
    that are needed for the covariance code. Some parameters are
    compulsory, others are optional. Whenever an optional parameter is
    not set explicitly and a fall-back value is inserted, a message will
    be displayed to inform the user what the value has been set to.
    Lastly, a new configuration file can be generated that lists all
    values used. A full list of all input values is given in the config.ini .

    Attributes
    ----------
    Too many to list, but all relevant ones are put into
    dictionaries and explained in the method 'read_input'

    Example :
    ---------
    from cov_input import Input
    inp = Input()
    covterms, observables, output, cosmo, bias, hod, survey_params, \
        prec = inp.read_input()


    Provides methods to read-in look-up tables listed in a configuration
    file. Apart from the redshift distribution(s), they are optional
    additions that can speed up the covariance code or simply feed it a
    model that is not configured. All input files will be checked for
    internal consistencies. In the Setup class more consistency tests
    across different variable and file inputs will be performed. The new
    configuration file that the Input class can generate will be
    appended with a list of all the files used.

    Attributes
    ----------
        too many to list but all relevant ones are put into
        dictionaries and explained in the method 'read_input'

    Example :
    ---------
    from cov_input import FileInput
    fileinp = FileInput(bias)
    read_in_tables = fileinp.read_input(bias)


    This class calculates the k-space covariance for power spectra
    estimators (matter-matter, tracer-tracer and tracer-matter) at a
    single redshift. Inherits the functionality of the PolySpectra
    class.

    Parameters
    ----------
    zet : float
        Redshift at which the covariance should be evaluated.
    cov_dict : dictionary
        Specifies which terms of the covariance (Gaussian, non-Gaussian,
        super-sample covariance) should be calculated. To be passed from
        the read_input method of the Input class.
    obs_dict : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'observables' : dictionary
            Specifies which observables (cosmic shear, galaxy-galaxy
            lensing and/or clustering) should be calculated. Also,
            indicates whether cross-terms are evaluated.
        'ELLspace' : dictionary
            Specifies the exact details of the projection to ell space.
            The projection from wavefactor k to angular scale ell is
            done first, followed by the projection to real space in this
            class
        'THETAspace' : dictionary
            Specifies the exact details of the projection to real space,
            e.g., theta_min/max and the number of theta bins to be
            calculated.
        'COSEBIs' : dictionary
            Specifies the exact details of the projection to COSEBIs,
            e.g. the number of modes to be calculated.
        'bandpowers' : dictionary
            Specifies the exact details of the projection to bandpowers,
            e.g. the ell modes and their spacing.
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    hod_dict : dictionary
        Specifies all the information about the halo occupation
        distribution used. This defines the shot noise level of the
        covariance and includes the mass bin definition of the different
        galaxy populations. To be passed from the read_input method of
        the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey.
        Relevant values are the effective number density of galaxies for
        all tomographic bins as well as the ellipticity dispersion for
        galaxy shapes. To be passed from the read_input method of the
        Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
        'trispec' : dictionary
            Contains precision information about the trispectra, this
            includes k-range and spacing and the desired precision
            limits.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).
        'tri': dictionary
            Look-up table for the trispectra (for all combinations of
            matter 'm' and tracer 'g', optional).
            Possible keys: '', 'z', 'mmmm', 'mmgm', 'gmgm', 'ggmm',
            'gggm', 'gggg'

    Attributes
    ----------
    see PolySpectra class

    Example :
    ---------
    from cov_input import Input, FileInput
    from cov_k_space import CovKSpace
    inp = Input()
    covterms, observables, output, cosmo, bias, hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    zet = 0
    covk = CovKSpace(zet, covterms, observables, cosmo, bias, hod,
        survey_params, prec, read_in_tables)


    This class calculates the ell-space covariance for angular power
    spectra estimators (kappa-kappa, tracer-tracer and tracer-kappa).
    Inherits the functionality of the PolySpectra class.

    Parameters
    ----------
    cov_dict : dictionary
        Specifies which terms of the covariance (Gaussian, non-Gaussian,
        super-sample covariance) should be calculated. To be passed from
        the read_input method of the Input class.
    obs_dict : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'observables' : dictionary
            Specifies which observables (cosmic shear, galaxy-galaxy
            lensing and/or clustering) should be calculated. Also,
            indicates whether cross-terms are evaluated.
        'ELLspace' : dictionary
            Specifies the exact details of the projection to ell space,
            e.g., ell_min/max and the number of ell-modes to be
            calculated.
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    iA_dict: dictionary
        Specifies all the information about the intrinsic alignment model.
        To be passed from the read_input method in the Input class.
    hod_dict : dictionary
        Specifies all the information about the halo occupation
        distribution used. This defines the shot noise level of the
        covariance and includes the mass bin definition of the different
        galaxy populations. To be passed from the read_input method of
        the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey.
        Relevant values are the effective number density of galaxies for
        all tomographic bins as well as the ellipticity dispersion for
        galaxy shapes. To be passed from the read_input method of the
        Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
        'trispec' : dictionary
            Contains precision information about the trispectra, this
            includes k-range and spacing and the desired precision
            limits.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'survey_area_clust' : dictionary
            Contains information about the survey footprint that is read
            from the fits file of the survey (processed by healpy).
            Possible keys: 'area', 'ell', 'a_lm'
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).
        'tri': dictionary
            Look-up table for the trispectra (for all combinations of
            matter 'm' and tracer 'g', optional).
            Possible keys: '', 'z', 'mmmm', 'mmgm', 'gmgm', 'ggmm',
            'gggm', 'gggg'

    Attributes
    ----------
    see CovKSpace class
    ellrange : array
        Multipoles at which the covariance is calculated
    deg2torad2 : float
        Conversion factor from degrees to radian squared
    arcmin2torad2 : float
        Conversion factor from arcminutes to radian squared
    spline_zclust : list
        List of spline objects for the redshift distributuon for each
        tomographic bin of the clustering analysis
    spline_zlens : list
        List of spline objects for the redshift distributuon for each
        tomographic bin of the lensing analysis
    los_integration_chi : array
        Values of the comoving distance at which the line of sight integration
        is carriend out.
    spline_z_of_chi : spline_object
        ...
    spline_lensweight : list
        List of spline objects for the lensing weight for each
        tomographic bin of the lensing analysis
    Cell_gg : array
        Array storing the C_ell of the clustering analysis with shape
        (# ell modes, # sample bins, # tomographic bins,
        # tomographic bins)
    Cell_gm, Cell_gkappa : array
        Array storing the C_ell of the galaxy-galaxy lensing analysis
        with shape (# ell modes, # sample bins, # tomographic bins,
        # tomographic bins)
    Cell_mm, Cell_kappakappa : array
        Array storing the C_ell of the cosmic shear analysis with shape
        (# ell modes, # tomographic bins, # tomographic bins)

    Example :
    ---------
    from cov_input import Input, FileInput
    from cov_ell_space import CovELLSpace
    inp = Input()
    covterms, observables, output, cosmo, bias, iA, hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    covell = CovELLSpace(covterms, observables, output, cosmo, bias,
        iA, hod, survey_params, prec, read_in_tables)


    This class calculates the necessary ingredients of the halo model
    which are later used to calculate the covariance. Important
    quantities are the mass function, the galaxy bias and the halo model
    integrals. All quantities are calculated at a single redshift.
    Inherits the functionality of the Setup class and contains instances
    of the hmf and hod class.

    Atrributes
    ----------
    zet : float
        Redshift at which the covariance should be evaluated.
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    hod_dict : dictionary
        Specifies all the information about the halo occupation
        distribution used. This defines the shot noise level of the
        covariance and includes the mass bin definition of the different
        galaxy populations. To be passed from the read_input method of
        the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey. To be
        passed from the read_input method of the Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
        'trispec' : dictionary
            Contains precision information about the trispectra, this
            includes k-range and spacing and the desired precision
            limits.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).

    Private Variables
    -----------------
    see Setup class
    mass_func : class
        This class specifies the mass function. It originates from the
        hmf module.
    hod : class
        This class specifies the halo occupation distribution. It
        originates from the cov_hod module.
    ngal : array
        with unit 1 / (Mpc/h)^3
        with shape (sample_bins)
        average number density of tracers given an HOD
    ncen : array
        with unit 1 / (Mpc/h)^3
        with shape (sample_bins)
        average number density of central galaxies given an HOD
    nsat : array
        with unit 1 / (Mpc/h)^3
        with shape (sample_bins)
        average number density of satellite galaxies given an HOD
    norm_bias : float
        normalization constant for the bias model
    effective_bias : array
        with shape (sample_bins)
        effective bias for tracers assuming an HOD

    Example
    -------
    from cov_input import Input, FileInput
    from cov_halo_model import HaloModel
    inp = Input()
    covterms, observables, output, cosmo, bias, hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    zet = 0
    hm = HaloModel(zet, cosmo, bias, hod, survey_params, prec,
                   read_in_tables)


    This class provides different models for the halo occupation
    distribution. All quantities are calculated at as a function halo
    mass.

    Attributes
    ----------
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    hm_prec : dictionary
        Contains precision information about the HaloModel (also, see
        hmf documentation by Steven Murray), this includes mass range
        and spacing for the mass integrations in the halo model.

    Private Variables
    -----------------
    Mrange : array
        with unit M_sun/h
        with shape (M_bins)
        logarithmically spaced masses in the range
        [hm_prec['log10M_min'], hm_prec['log10M_max']]
    Mbins : array
        with unit M_sun/h
        with shape (sample_dims, 300)
        logarithmically spaced masses in the range
        [bias_dict['logmass_bins'][:-1], bias_dict['logmass_bins'][1:]],
        returns Mrange if no samples are specified

    Example
    -------
    from cov_input import Input, FileInput
    from cov_setup import Setup
    from cov_hod import HOD
    inp = Input()
    covterms, observables, output, cosmo, bias, hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    # autoperforms consistency check of look-up tables with
    # configuration
    setting = Setup(cosmo, bias, survey_params, prec, read_in_tables)
    my_hod = HOD(bias, prec['hm'])

    Instructions how to add another relation :
    ------------------------------------------
    1) add your own relation with preferably hard-coded variables
    2) change the function occ_num_and_prob_per_pop
      2.1) add if pop == 'cen': and else if pop == 'sat': to the
           function if your relations differ for these populations
      2.2) your mass-observable relation can be called at L302
           Mobs = ..., make sure you provide an array with shape
           (M_bins) as does, e.g., the function double_powerlaw
      2.3) your scattering relation can be called at L303 (and L290)
           occ_prob = ..., make sure you provide an array with shape
           (sample bins, 300, M_bins) as does, e.g., the function
           lognormal


    This class calculates the power spectra, power spectra responses,
    and trispectra that are required for the covariance in k-space.
    Spectra for matter and tracer are evaluated at a single redshift.
    Inherits the functionality of the HaloModel class.

    Attributes
    ----------
    zet : float
        Redshift at which the covariance should be evaluated.
    cov_dict : dictionary
        Specifies which terms of the covariance (Gaussian, non-Gaussian,
        super-sample covariance) should be calculated. To be passed from
        the read_input method of the Input class.
    obs_dict : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'observables' : dictionary
            Specifies which observables (cosmic shear, galaxy-galaxy
            lensing and/or clustering) should be calculated. Also,
            indicates whether cross-terms are evaluated.
        'ELLspace' : dictionary
            Specifies the exact details of the projection to ell space.
            The projection from wavefactor k to angular scale ell is
            done first, followed by the projection to real space in this
            class
        'THETAspace' : dictionary
            Specifies the exact details of the projection to real space,
            e.g., theta_min/max and the number of theta bins to be
            calculated.
        'COSEBIs' : dictionary
            Specifies the exact details of the projection to COSEBIs,
            e.g. the number of modes to be calculated.
        'bandpowers' : dictionary
            Specifies the exact details of the projection to bandpowers,
            e.g. the ell modes and their spacing.
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    hod_dict : dictionary
        Specifies all the information about the halo occupation
        distribution used. This defines the shot noise level of the
        covariance and includes the mass bin definition of the different
        galaxy populations. To be passed from the read_input method of
        the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey. To be
        passed from the read_input method of the Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
        'trispec' : dictionary
            Contains precision information about the trispectra, this
            includes k-range and spacing and the desired precision
            limits.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).
        'tri': dictionary
            Look-up table for the trispectra (for all combinations of
            matter 'm' and tracer 'g', optional).
            Possible keys: '', 'z', 'mmmm', 'mmgm', 'gmgm', 'ggmm',
            'gggm', 'gggg'

    Private Variables :
    -------------------
    see HaloModel class
    mm : bool
        flag that only performs necessary calculation for the matter-
        matter observable. To be passed from the read_input method of
        the Input class (part of [observables]).
    gm : bool
        same as above but for the matter-tracer observable
    gg : bool
        same as above but for the tracer-tracer observable
    cross_terms : bool
        Same as above but for the cross-terms between different
        observables.
    cov_dict : dictionary
        See above in Parameters : cov_dict
    Pmm : array
        with unit ?
        with shape (powspec_prec['log10k_bins'], sample bins)
        matter-matter power spectrum either from a look-up table,
        calculated through the halo model, or None if not needed
    Pgm : array
        with unit ?
        same as above but for the matter-tracer power spectrum
    Pgg : array
        with unit ?
        same as above but for the tracer-tracer power spectrum
    Plin_spline : UnivariateSpline
        spline object for log linear-power-spectrum as a function of
        log(k), given by the halo model
    krange_tri : array
        with unit ?
        with shape (trispec_prec['log10k_bins'])
        linear k-range on which the trispectra will be evaluated
    logks_tri : array
        with unit ?
        with shape (trispec_prec['log10k_bins'])
        logarithmic k-range on which the trispectra will be evaluated
    tri_idxlist : list
        a list containing the indices of a matrix with shape
        (trispec_prec['log10k_bins'], trispec_prec['log10k_bins'],
        sample_dim, sample_dim), where we only loop over independent
        matrix elements (the matrix is symmetric in k-space and
        sample-space)
    trispec_matter_klim : float
        with unit ?
        precision parameter for the minimum wavenumber for which the
        trispectrum is evaluated precisely
    trispec_matter_mulim : float
        precision parameter mu = cos(phi) for the minimum angle mu
        between two k-vectors for which the trispectrum is evaluated
        precisely
    num_cores : int
        specifies number of cores for trispectra .calculation, if no
        input is given or '[misc]: num_cores = 0' all available cores
        are used

    Example :
    ---------
    from cov_input import Input, FileInput
    from cov_polyspectra import PolySpectra
    inp = Input()
    covterms, observables, output, cosmo, bias, hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    zet = 0
    polys = PolySpectra(zet, covterms, observables, cosmo, bias, hod,
        survey_params, prec, read_in_tables)


    This class calculates the covariance of the same tracer using arbitrary
    summary statistics whose Fourier and Realspace filters are passed through file inputs.
    It also calculates their respective cross-covariance.
    The structure is very similar to the COSEBIs class, but requires a more careful treatment
    of the noise term. It should be noted that covCOSEBI, CovBandPowers and covTHETAspace are
    optimized for the respective estimators. This class uses a more brute force approach for
    the integration and will thus most likely be slower or less accurate. It should only be
    used if cross-variances between different 2pt statistics is required or a new statistic
    needs to be calculated which has not been implemented in the code.

    Parameters
    ----------
    cov_dict : dictionary
        Specifies which terms of the covariance (Gaussian, non-Gaussian,
        super-sample covariance) should be calculated. To be passed from
        the read_input method of the Input class.
    obs_dict : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'observables' : dictionary
            Specifies which observables (cosmic shear, galaxy-galaxy
            lensing and/or clustering) should be calculated. Also,
            indicates whether cross-terms are evaluated.
        'ELLspace' : dictionary
            Specifies the exact details of the projection to ell space.
            The projection from wavefactor k to angular scale ell is
            done first, followed by the projection to real space in this
            class
        'THETAspace' : dictionary
            Specifies the exact details of the projection to real space,
            e.g., theta_min/max and the number of theta bins to be
            calculated.
        'bandpowers' : dictionary
            Specifies the exact details for the bandpower covariance.
        'arbitrary_summary' dictionary
                Specifies a few details for the arbitrary summary covariance
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    iA_dict: dictionary
        Specifies all the information about the intrinsic alignment model.
        To be passed from the read_input method in the Input class.
    hod_dict : dictionary
        Specifies all the information about the halo occupation
        distribution used. This defines the shot noise level of the
        covariance and includes the mass bin definition of the different
        galaxy populations. To be passed from the read_input method of
        the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey.
        Relevant values are the effective number density of galaxies for
        all tomographic bins as well as the ellipticity dispersion for
        galaxy shapes. To be passed from the read_input method of the
        Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
        'trispec' : dictionary
            Contains precision information about the trispectra, this
            includes k-range and spacing and the desired precision
            limits.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'survey_area_clust' : dictionary
            Contains information about the survey footprint that is read
            from the fits file of the survey (processed by healpy).
            Possible keys: 'area', 'ell', 'a_lm'
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).
        'tri': dictionary
            Look-up table for the trispectra (for all combinations of
            matter 'm' and tracer 'g', optional).
            Possible keys: '', 'z', 'mmmm', 'mmgm', 'gmgm', 'ggmm',
            'gggm', 'gggg'
        'arb_summary': dictionary
            Look-up table for the arbitrary summary statistics filters


    This class calculates the bandpower covariance for all probes specified.
    The calculations are carried out using the realspace covariance. All
    functionality from CovTHETASpace is inherited. The bandpower covariance
    is, however, calculated from ell space.

    Parameters
    ----------
    cov_dict : dictionary
        Specifies which terms of the covariance (Gaussian, non-Gaussian,
        super-sample covariance) should be calculated. To be passed from
        the read_input method of the Input class.
    obs_dict : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'observables' : dictionary
            Specifies which observables (cosmic shear, galaxy-galaxy
            lensing and/or clustering) should be calculated. Also,
            indicates whether cross-terms are evaluated.
        'ELLspace' : dictionary
            Specifies the exact details of the projection to ell space.
            The projection from wavefactor k to angular scale ell is
            done first, followed by the projection to real space in this
            class
        'THETAspace' : dictionary
            Specifies the exact details of the projection to real space,
            e.g., theta_min/max and the number of theta bins to be
            calculated.
        'bandpowers' : dictionary
            Specifies the exact details for the bandpower covariance.
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    iA_dict: dictionary
        Specifies all the information about the intrinsic alignment model.
        To be passed from the read_input method in the Input class.
    hod_dict : dictionary
        Specifies all the information about the halo occupation
        distribution used. This defines the shot noise level of the
        covariance and includes the mass bin definition of the different
        galaxy populations. To be passed from the read_input method of
        the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey.
        Relevant values are the effective number density of galaxies for
        all tomographic bins as well as the ellipticity dispersion for
        galaxy shapes. To be passed from the read_input method of the
        Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
        'trispec' : dictionary
            Contains precision information about the trispectra, this
            includes k-range and spacing and the desired precision
            limits.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'survey_area_clust' : dictionary
            Contains information about the survey footprint that is read
            from the fits file of the survey (processed by healpy).
            Possible keys: 'area', 'ell', 'a_lm'
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).
        'tri': dictionary
            Look-up table for the trispectra (for all combinations of
            matter 'm' and tracer 'g', optional).
            Possible keys: '', 'z', 'mmmm', 'mmgm', 'gmgm', 'ggmm',
            'gggm', 'gggg'

    Attributes:
    -----------
    see CovELLSpace class

    Example :
    ---------
    from src.cov_input import Input, FileInput
    from src.cov_theta_space import CovBandPowers
    inp = Input()
    covterms, observables, output, cosmo, bias, iA hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    covBP = CovBandPowers(covterms, observables, output, cosmo, bias,
        iA, hod, survey_params, prec, read_in_tables)


    This class provides various methods that set the cosmological model
    via astropy, and normalizes the tabulated redshift distributions. It
    also contains consistency checks between input in the configuration
    file and the look-up tables, the redshift range, number of
    tomographic bins, the k-range, the mass range and the number of
    galaxy samples (e.g., split in stellar mass bins). All consistency
    checks are automatically performed when the Setup class is called.

    Atrributes
    ----------
    cosmo_dict : dictionary
        Specifies all cosmological parameters. To be passed from the
        read_input method of the Input class.
    bias_dict : dictionary
        Specifies all the information about the bias model. To be passed
        from the read_input method of the Input class.
    survey_params_dict : dictionary
        Specifies all the information unique to a specific survey.
        Relevant values are the effective number density of galaxies for
        all tomographic bins. To be passed from the read_input method of
        the Input class.
    prec : dictionary
        with the following keys (To be passed from the read_input method
        of the Input class.)
        'hm' : dictionary
            Contains precision information about the HaloModel (also,
            see hmf documentation by Steven Murray), this includes mass
            range and spacing for the mass integrations in the halo
            model.
        'powspec' : dictionary
            Contains precision information about the power spectra, this
            includes k-range and spacing.
    read_in_tables : dictionary
        with the following keys (To be passed from the read_input method
        of the FileInput class.)
        'zclust' : dictionary
            Look-up table for the clustering redshifts and their number
            of tomographic bins. Relevant for clustering and galaxy-
            galaxy lensing estimators.
        'zlens' : dictionary
            Look-up table for the lensing redshifts and their number of
            tomographic bins. Relevant for cosmic shear and galaxy-
            galaxy lensing estimators.
        'Pxy' : dictionary
            default : None
            Look-up table for the power spectra (matter-matter, tracer-
            tracer, matter-tracer, optional).
        'Cxy' : dictionary
            default : None
            Look-up table for the C_ell projected power spectra (matter-
            matter, tracer- tracer, matter-tracer, optional).
        'effbias' : dictionary
            default : None
            Look-up table for the effective bias as a function of
            redshift(optional).
        'mor' : dictionary
            default : None
            Look-up table for the mass-observable relation (optional).
        'occprob' : dictionary
            default : None
            Look-up table for the occupation probability as a function
            of halo mass per galaxy sample (optional).
        'occnum' : dictionary
            default : None
            Look-up table for the occupation number as a function of
            halo mass per galaxy sample (optional).

    Private Variables
    -----------------
    cosmology : class
        This class specifies the cosmological model and basic relations
        such as distances. It originates from the
        astropy.cosmology.w0waCDM module.
    rho_bg : float
        with unit M_sun / pc**3
        matter density parameter times critical density at redshift 0
    sample_dim : int
        number of samples of, e.g., stellar mass the tracers are divided
        in, specified by [bias]: 'log10mass_bins' or the look-up tables
        specifying the HOD
    zet_clust : dictionary
        private variable for read_in_tables['zclust'] but zero-padded
        and 'value_loc_in_clustbin'-adjusted (see above)
    zet_lens : dictionary
        private variable for read_in_tables['zlens'] but zero-padded
        and 'value_loc_in_lensbin'-adjusted (see above)
    zet_min : float
        minimum redshift considered as given by zet_clust
    zet_max : float
        maximum redshift considered as given by zet_lens
    n_tomo_clust : int
        number of tomographic bins relevant for clustering and/or
        galaxy-galaxy lensing analysis
    n_tomo_lens : int
        number of tomographic bins relevant for cosmic shear and/or
        galaxy-galaxy lensing analysis
    Pxy_tab : dictionary
        See above in Parameters Pxy_tab
    Cxy_tab : dictionary
        See above in Parameters Cxy_tab
    effbias_tab : dictionary
        See above in Parameters effbias_tab
    mor_tab : dictionary
        See above in Parameters mor_tab
    occprob_tab : dictionary
        See above in Parameters occprob_tab
    occnum_tab : dictionary
        See above in Parameters occnum_tab

    Example :
    ---------
    from cov_input import Input, FileInput
    from cov_setup import Setup
    inp = Input()
    covterms, observables, output, cosmo, bias, hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input(inp.config_name)
    setting = Setup(cosmo, bias, survey_params, prec, read_in_tables)


    This class implements Gauss legendre integration using the Legendre
    polynomials to approximate an integral over an arbitrary function
    by a polynomial up to some order.

    Parameters
    ------------
    support : 1D array
        the support of the integrand, i.e. the integration variable
    integrand : 1D array
        the integrand, must be of the same length as support
    log_support: bool
        should the integration variable be interpolated logarithmically
    log_integrand: bool
        should the integrand be interpolated logarithmically
    order : int
        the order of the Gauss-Legendre quadrature
    rel_acc : float
        relative accuracy to be reached. This is always estimated by the
        relative difference between the integral evaluated with
        polynomial order n and n + 2


    Class writing the output of the OneCovariance code. Methods of this class collect
    all the necessary blocks of the covariance matrix.

    Parameters:
    -----------
    output_dict : dictionary

    Example :
    ---------
    from cov_input import Input, FileInput
    from cov_ell_space import CovELLSpace
    from cov_output import Output

    inp = Input()
    covterms, observables, output, cosmo, bias, hod, survey_params, \
        prec = inp.read_input()
    fileinp = FileInput()
    read_in_tables = fileinp.read_input()
    covell = CovELLSpace(covterms, observables, output, cosmo, bias,
                         hod, survey_params, prec, read_in_tables)
    gauss, nongauss, ssc = \
        covell.calc_covELL(observables, output, bias, hod,
                           survey_params, prec, read_in_tables)

    out = Output(output)
    out.write_cov(covterms, observables, covell.n_tomo_clust,
                  covell.n_tomo_lens, covell.ellrange, gauss, nongauss,
                  ssc)


Exceptions are documented in the same way as classes.

    The __init__ method may be documented in either the class level
    docstring, or as a docstring on the __init__ method itself.

    Either form is acceptable, but the two should not be mixed. Choose one
    convention to document the __init__ method and be consistent with it.

    Note:
        Do not include the `self` parameter in the ``Args`` section.

    Args:
        msg (str): Human readable string describing the exception.
        code (:obj:`int`, optional): Error code.

    Attributes:
        msg (str): Human readable string describing the exception.
        code (int): Exception error code.


The summary line for a class docstring should fit on one line.

    If the class has public attributes, they may be documented here
    in an ``Attributes`` section and follow the same formatting as a
    function's ``Args`` section. Alternatively, attributes may be documented
    inline with the attribute's declaration (see __init__ method below).

    Properties created with the ``@property`` decorator should be documented
    in the property's getter method.

    Attributes:
        attr1 (str): Description of `attr1`.
        attr2 (:obj:`int`, optional): Description of `attr2`.


Class for data extracted from the experiment directory

    Attributes
    ----------
    label: str\n
    terrain: str\n
    loading: str\n
    material: str\n
    hydration: str\n
    date: str\n
    rep: str


Holds data that will be used in tools_pg.animatedFigure*() calls

    Attributes
    ----------
    nt: int
        number of time steps\n
    data_binned: np.ndarray
        Time binned pressure grid data\n
    contact_data: dict
        Results of running tools_pg.contact_area_run()\n
    sharp: np.ndarray
        Results of running tools_pg.sharpPG()\n
    lean: np.ndarray
        Results of tools_pg.leanPG()\n
    imu_contact_bin: np.ndarray
        Results of
    col_max: int
    pg_imu: np.ndarray
    x_imu: List[float]


Provides an implementation that performs no logging


Maintains module-wide state..


Provides utility functions for filenames.

  FileInfo provides easy access to the components of a file's path
  relative to the project root.


    An example implementation of an instrument
    An instument function thats uses the WFC3
    spectral grid and applies a gaussian noise
    with a scale ``noise_scale`` for each spectrum
    point.


Available MPI operations


Fake file-like stream object that redirects writes to a queue.


A process that can safely call fortran functions.

    This is used to safely call fortran functions from python. It is used
    to overcome the STOP issue with fortran code that kills the interpreter.


A safe fortran caller.


USes the M2 algorithm to compute the variance in a streaming fashion


Class for loading opacities from pickle files.

    This was the original format for TauREx 1/2 opacities. It is now
    deprecated in favour of HDF5 files.


This is the base class for computing opactities.


Radis opacity using HITRAN database.

    This module uses the RADIS code to compute opacity
    using the HITRAN database. This module is not recommended
    for general use as it is very slow and is deprioritized
    in the opacity module list.


Fake opacity for testing purposes.


Opacity from Exo_Transmit.


Opacities from HDF5 files.

    These usually come from ExoMol. Specifically the ExoMolOP database.


Provides interpolation methods.


KTables from NEMESIS.


This is the base class for computing opactities using correlated k tables


Ktables loaded from pickle files.

    This is the old way of loading ktables from pickle files
    from TauREx 1/2. It is not recommended to use this format
    of loading ktables as it is not as flexible as the HDF5
    format. It is recommended to use the HDF5 format instead.


A mixin class to represent a ktable.


Implements a lazy load of opacities.

    A singleton thatloads and caches xsections as they are needed.
    Calling:

    >>> opt = OpacityCache()
    ... opt2 = OpacityCache()

    Reveals that:

    >>> opt == opt2
    True

    Importantly this class will automatically search directories for cross-sections
    set using the :func:`set_opacity_path` method:

    >>> opt.set_opacity_path('path/to/crossections')

    Multiple paths can be set as well

    >>> opt.set_opacity_path(
    ... ['/path/to/crosssections','/another/path/to/crosssections'])

    To get the cross-section object for a particular molecule
    use the square bracket operator:

    >>> opt['H2O']
    <taurex.opacity.pickleopacity.PickleOpacity at 0x107a60be0>

    This returns a :class:`~taurex.opacity.opacity.Opacity` object
    for you to compute H2O cross sections from. When called for the
    first time, a directory search is performed and, if found, the
    appropriate cross-section is loaded. Subsequent calls will immediately
    return the already loaded object:

    >>> h2o_a = opt['H2O']
    >>> h2o_b = opt['H2O']
    >>> h2o_a == h2o_b
    True

    If you have any plugins that include new opacity formats, the cache
    will automatically detect them.

    Lastly you can manually add an opacity directly for a molecule
    into the cache:

    >>> new_h2o = MyNewOpacityFormat()
    >>> new_h2o.molecule
    H2O
    >>> opt.add_opacity(new_h2o)
    >>> opt['H2O']
    <MyNewOpacityFormat at 0x107a60be0>

    Now TauREx3 will use it instead in all calculations!


A singleton for your usage.

    When inheriting do not implement __init__ instead override :func:`init`.


Allows for the storage of global variables.


    Implements a lazy load of collisionally induced absorpiton cross-sections
    Supports pickle files and HITRAN cia files. Functionally behaves the same
    as :class:`~taurex.cache.opacitycache.OpacityCache` except the keys are
    now cia pairs
    e.g:

    >>> CIACache()['H2-H2']
    <taurex.cia.picklecia.PickleCIA at 0x107a60be0>

    Pickle ``.db`` and HITRAN ``.cia`` files are supported and automatically
    loaded. with priority given to ``.db`` files


Implements a lazy load of opacities.

    A singleton that loads and caches ktables as they are needed.

    Now TauREx3 will use it instead in all calculations!


Protocol for classes that have input_keywords()


Protocol for classes that have discover() methods


A singleton factory the discovers new classes from plugins.


Parse input file and generate appropriate objects.


Computes contribution from Rayleigh scattering.


Class to build opacity for hydrogen ion.


Computes the CIA contribution to the optical depth.

    CIA is collisionally induced absorption.


Computes Mie scattering contribution to optica depth.

    Formalism taken from: Lee et al. 2013, ApJ, 778, 97

    Parameters
    ----------

    lee_mie_radius: float
        Particle radius in um

    lee_mie_q: float
        Extinction coefficient

    lee_mie_mix_ratio: float
        Mixing ratio in atmosphere in particles/m3

    lee_mie_bottomP: float
        Bottom of cloud deck in Pa

    lee_mie_topP: float
        Top of cloud deck in Pa


Computes a flat (gray) absorption contribution.

    Absorption is computed as a flat value between two pressures
    across all wavenumbers.

    Parameters
    ----------

    flat_mix_ratio: float
        Opacity value

    flat_bottomP: float
        Bottom of absorbing region in Pa

    flat_topP: float
        Top of absorbing region in Pa


The base class for modelling contributions to the optical depth.

    *Abstract class*

    By default this handles contributions from cross-sections.
    If the type of contribution being implemented is a `sigma`-type
    like the form given in :func:`contribute_tau` then
    To function in Taurex3, it only requires the concrete implementation of:

    - :func:`prepare_each`

    Different forms may require reimplementing
    :func:`contribute` as well as :func:`prepare`


    Optically thick cloud deck up to a certain height

    These have the form:

    .. math::
            \\tau(\\lambda,z) =
                \\begin{cases}
                \\infty       & \\quad \\text{if } P(z) >= P_{0}\\\\
                0            & \\quad \\text{if } P(z) < P_{0}
                \\end{cases}

    Where :math:`P_{0}` is the pressure at the top of the cloud-deck.


    Bins to a wavenumber grid given by ``wngrid``.
    The method places flux into the correct bins
    using histogramming methods. This is fast but can
    suffer as it assumes that there are no gaps in the
    wavenumber grid. This can cause weird results and
    may cause the flux to be higher in the boundary
    of points between two distinct regions
    (such as WFC3 + Spitzer)

    Parameters
    ----------

    wngrid: :obj:`array`
        Wavenumber grid

    wngrid_width: :obj:`array`, optional
        Must have same shape as ``wngrid``
        Full bin widths for each wavenumber grid point
        given in ``wngrid``. If not provided then
        this is automatically computed from ``wngrid``.


A special class of binning used for lightcurves.

    This is essentially the same as
    :class:`~taurex.binning.nativebinner.NativeBinner`
    but for lightcurve forward models.


    Bins to a wavenumber grid given by ``wngrid`` using a
    more accurate method that takes into account the amount
    of contribution from each native bin. This method also
    handles cases where bins are not continuous and/or
    overlapping.

    Parameters
    ----------

    wngrid: :obj:`array`
        Wavenumber grid

    wngrid_width: :obj:`array`, optional
        Must have same shape as ``wngrid``
        Full bin widths for each wavenumber grid point
        given in ``wngrid``. If not provided then
        this is automatically computed from ``wngrid``.


A `do-nothing` binner.

    This is useful when the pipeline expects
    a binner but none is given. Simplifies implementation and also
    handles dictionary writing of the forward model.


Binned spectrum type.


    *Abstract class*

    The binner class deals with binning down spectra to different resolutions.
    It also provides a method to generate spectrum output format from a forward
    model result in the form of a dictionary.
    Using this class does not need to be restricted to TauREx3 results and can
    be used to bin down any arbitrary spectra.


Dictionary for storing fit parameter output.


Holds information about a fitting parameter.


Holds information about a derived parameter.


A base class that handles fitting and optimization of forward models.

    The class handles the compiling and management of fitting parameters in
    forward models, in its current form it cannot fit and requires a class
    derived from it to implement the :func:`compute_fit` function.


Dictionary for storing nestle stats output.


Dictionary for storing nestle solution output.


An optimizer that uses the `nestle <http://kylebarbary.com/nestle/>`_ library
    to perform optimization.


Fit parameter for multinest.


Multinest output type


    A singleton for your usage. When inheriting do not implement __init__ instead
    override :func:`init`


Defines the type of prior space.


Defines a prior function


Defines a uniform prior.


Defines a log-uniform prior.


Defines a gaussian prior.


Defines a log-gaussian prior.


SNR noise model.

    Simple instrument model that, for a given
    wavelength-independant, signal-to-noise ratio,
    compute resulting noise from it.


Instrument noise model.

    *Abstract class*

    Defines some method that transforms
    a spectrum and generates noise.


Loads a 2-3 column file

    The first column is the wavelength grid, the second column is the noise
    and the third column is the width of the wavelength bin. If the third column
    is not present, the width is computed from the wavelength grid.


Stores output data in the HDF5 hierarchical structure.


Output using HDF5 format.


Abstract class for writeable objects.


Stores output data in a hierarchical structure.


Base calss for handling outputs from Taurex3


Base Planet class.

    Holds information on a planet and its properties and
    derived properties


An implementation for earth


An implementation for mars.


Protocol for fitting callables.


Protocol for derived callables.


A class that manages fitting parameters.

    Not really used on its own it should really be inherited from to be used properly.
    It also provides class with the ability to read and write
    fitting parameters using their params names, for example,
    if we create a class like this:

    .. code-block:: python

        class Foo(Fittable):

            def __init__(self):
                self.value = 10

            @fitparam(param_name='foobar',param_latex='$Foo^{bar}$',default_bounds=[1,12])
            def bar(self):
                return self.value

            @bar.setter
            def bar(self,value):
                self.value = value

    We can read and write data in the standard python way like so:

    >>> foo = Foo()
    >>> foo.bar
    10
    >>> foo.bar = 20
    >>> foo.bar
    20

    but we also get this functionality for free:

    >>> foo['foobar']
    20
    >>> foo['foobar'] = 30
    >>> foo['foobar']
    30


Defines a class that contains citation information.


A base class that holds information on the star in the model.
    Its implementation is a star that has a blackbody spectrum.


Alias for the base star type


A star that uses the PHOENIX synthetic stellar atmosphere spectrums.

    These spectrums are read from ``.gits.gz`` files in a directory given by
    ``phoenix_path``
    Each file must contain the spectrum for one temperature

    Parameters
    ----------

    phoenix_path: str, **required**
        Path to folder containing phoenix ``fits.gz`` files

    temperature: float, optional
        Stellar temperature in Kelvin

    radius: float, optional
        Stellar radius in Solar radius

    metallicity: float, optional
        Metallicity in solar values

    mass: float, optional
        Stellar mass in solar mass

    distance: float, optional
        Distance from Earth in pc

    magnitudeK: float, optional
        Maginitude in K band

    Raises
    ------
    Exception
        Raised when no phoenix path is defined


Loads an observed lightcurve from a pickle file.


Observation is a taurex spectrum from a HDF5 file.

    An instrument function must have been used for this to work


Loads an observation from Iraclis pickle data.


Loads an observed spectrum from an array

    Loads spectrum and computes bin
    edges and bin widths. Spectrum shape(nbins, 3-4) with 3-4 columns with
    ordering:
        1. wavelength (um)
        2. spectral data
        3. error
        4. (optional) bin width

    If no bin width is present then they are computed.


    Loads an observed spectrum from a text file and computes bin
    edges and bin widths. Spectrum must be 3-4 columns with ordering:
        1. wavelength
        2. spectral data
        3. error
        4. (optional) bin width

    If no bin width is present then they are computed.

    Parameters
    -----------
    filename: string
        Path to observed spectrum file.


A base class that represents spectrums.

    *Abstract class*

    A base class where spectrums are loaded (or later created). This
    is used to either plot against the forward model or passed into the
    optimizer to be used to fit the forward model.


Skeleton for defining chemistry.
    *Abstract Class*

    Must implement methods:

    - :func:`activeGases`
    - :func:`inactiveGases`
    - :func:`activeGasMixProfile`
    - :func:`inactiveGasMixProfile`

    *Active* are those that are actively
    absorbing in the atmosphere. In technical terms they are molecules
    that have absorption cross-sections. You can see which molecules
    are able to actively absorb by doing:
    You can find out what molecules can actively absorb by doing:

            >>> avail_active_mols = OpacityCache().find_list_of_molecules()

    Active gases are only determined at initialization and cannot be changed
    during runtime. If you want to change the active gases you will need to
    reinitialize the chemistry class.


Chemistry profile read from file.


    Chemistry class that automatically seperates out
    active and inactive gases

    Has a helper function that should be called at the
    end of initialization. :func:`determine_active_inactive`
    once :func:`gases` has been set.

    You'll only need to implement :func:`gases` and :func:`mixProfile`
    to use this class.


The standard chemical model used in Taurex.

    This allows for the combinationof different mixing profiles for each molecule.
    Lets take an example
    profile, we want an atmosphere with a constant mixing of ``H2O`` but two
    layer mixing for ``CH4``.
    First we initialize our chemical model:

        >>> chemistry = TaurexChemistry()

    Then we can add our molecules using the :func:`addGas` method. Lets start
    with ``H2O``, since its a constant profile for all layers of the atmosphere
    we thus add
    the :class:`~taurex.data.profiles.chemistry.gas.constantgas.ConstantGas`
    object:

        >>> chemistry.addGas(ConstantGas('H2O',mix_ratio = 1e-4))

    Easy right? Now the same goes for ``CH4``, we can add the molecule into
    the chemical model by using the correct profile (in this case
    :class:`~taurex.data.profiles.chemistry.gas.twolayergas.TwoLayerGas`):

        >>> chemistry.addGas(TwoLayerGas('CH4',mix_ratio_surface=1e-4,
                                         mix_ratio_top=1e-8))

    Chaining is also supported:

        >>> chemistry.addGas(gas1).addGas(gas2)

    Molecular profiles available are:
        * :class:`~taurex.data.profiles.chemistry.gas.constantgas.ConstantGas`
        * :class:`~taurex.data.profiles.chemistry.gas.twolayergas.TwoLayerGas`
        * :class:`~taurex.data.profiles.chemistry.gas.twolayergas.TwoPointGas`


Constant gas profile.

    Molecular abundace is constant at each layer of the
    atmosphere


This class is a base for a single molecule or gas.
    Its used to describe how it mixes at each layer and combined
    with
    :class:`~taurex.data.profile.chemistry.taurexchemistry.TaurexChemistry`
    is used to build a chemical profile of the planets atmosphere.
    Requires implementation of:

    - func:`~mixProfile`


Gas profile in Power law.

    This is a profile adapted for HJ (T > 2000 K) which takes
    into account upper atm mix reduction. Laws taken from Parmentier (2018)


Two layer gas profile.

    A gas profile with two different mixing layers at the surface of the
    planet and top of the atmosphere seperated at a defined
    pressure point and smoothened.


Two point gas profile.

    A gas profile with two different mixing layers at the surface of the
    planet and top of the atmosphere and interpolated between the two


Gas profile from an array.

    Molecular abundance is interpolated if the number of layers do not match


Layer-by-layer temperature introduced in Rodgers et al (2000)

    Inverse Methods for Atmospheric Sounding (equation 3.26).
    Featured in NEMESIS code (Irwin et al., 2008,
    J. Quant. Spec., 109, 1136 (equation 19)
    Used in all Barstow et al. papers.


Temperature profile loaded from array.


Temperature profile defined and smoothed by user points.

    A temperature profile that is defined at various heights of the
    atmopshere and then smoothend.

    At minimum, temepratures on both the top ``T_top`` and surface
    ``T_surface`` must be defined.
    If any intermediate points are given as ``temperature_points``
    then the same number of ``pressure_points``
    must be given as well.

    A 2-point temperature profile has ``len(temperature_points) == 0``
    A 3-point temperature profile has ``len(temperature_points) == 1``

    etc.


A temperature profile read from file.

    If pressure is included in file then the temperature profile
    will be interpolated to the pressure points of the atmosphere.


An isothermal temperature-pressure profile.


TP profile from Guillot 2010, A&A, 520, A27 (equation 49).

    Using modified 2stream approx.
    from Line et al. 2012, ApJ, 749,93 (equation 19)


Defines temperature profile for an atmosphere.

    *Abstract Class*

    Must define:

    - :func:`profile`


Base pressure class.

    *Abstract Class*

    Simple. Defines the layering
    of the atmosphere. Only requires
    implementation of:

    - :func:`compute_pressure_profile`
    - :func:`profile`


A basic pressure profile.


A pressure profile built from a logspace.


Load pressure profile from file.


Pressure profile from an array for each layer


Base mixin class.


Provides a :func:`addGas` method to any chemistry

    This class will either inject or force a molecule
    to become a :class:`~taurex.data.profiles.chemistry.gas.gas.Gas`
    object. Allowing them to be freely changed or retrieved.

    For example lets enhance ACE:

    >>> from acepython.taurex import ACEChemistry
    >>> from taurex.mixin import enhance_class, MakeFreeMixin
    >>> old_ace = ACEChemistry()
    >>> new_ace = enhance_class(ACEChemistry, MakeFreeMixin)

    ``new_ace`` behaves the same as ``old_ace``:

    >>> new_ace.ace_metallicity
    1.0

    And we see the same molecules and fitting parameters exist:

    >>> old_ace.gases == new_ace.gases
    True
    >>> new_ace.gases
    ['CH3COOOH', 'C4H9O', ... 'HNC', 'HON', 'NCN']
    >>> new_ace.fitting_parameters().keys()
    dict_keys(['ace_metallicity', 'metallicity', 'ace_co', 'C_O_ratio'])

    ``new_ace`` is embued with the

    >>> from taurex.chemistry import ConstantGas
    >>> new_ace.addGas(ConstantGas('TiO',1e-8)).addGas(ConstantGas('VO',1e-8))
    >>> new_ace.gases == old_ace.gases
    False
    >>> new_ace.gases
    ['CH3COOOH', 'C4H9O', ... 'HNC', 'HON', 'NCN', 'TiO', 'VO']

    And indeed see that they are included. We can also retrieve them:

    >>> new_ace.fitting_parameters().keys()
    dict_keys(['TiO', 'VO', 'ace_metallicity', 'metallicity', 'ace_co', 'C_O_ratio'])

    Finally we can force an existing molecule like CH4 into becoming a Gas:

    >>> new_ace.addGas(ConstantGas('CH4',1e-5))

    And see that it is now a retrieval parameter as well.

    >>> new_ace.fitting_parameters().keys()
    dict_keys(['TiO', 'VO', 'CH4', 'ace_metallicity',
                'metallicity', 'ace_co', 'C_O_ratio'])


Scales the temperature profile by a factor.

    Mostly a proof of concept class for mixins. Not particularly
    useful in practice.


    Class for using pickled (``.db``) collisionally induced absorptions
    Very simple since the format is simple

    Parameters
    ----------
    filename : str
        Path to pickle

    pair_name : str , optional
        Whilst the name of the pair is determined by the pickle filename
        since these can be different you can optionally force the name through
        this parameter


Class that handles a particular HITRAN cia wavenumber grid.

    Since temperatures for CIA sometimes have different wavenumber grids this
    class helps to simplify managing them by only dealing with one at a time.
    These will help us unify into a single grid eventually

    Parameters
    ----------
    wn_min : float
        The minimum wavenumber for this grid

    wn_max : float
        The maximum wavenumber for this grid


A class that directly deals with HITRAN

    Takes HITRAN `cia <https://hitran.org/cia/>`_
    and turns them into generic CIA objects that nicely produces
    cross sections for us. This will handle CIAs that have wavenumber
    grids split across temperatures by unifying them into single grids.

    To use it simply do:

    >>> h2h2 = HitranCIA('path/to/H2-He.cia')

    And now you can painlessly compute cross-sections like this:

    >>> h2h2.cia(400)

    Or if you have a wavenumber grid, we can also interpolate it:

    >>> h2h2.cia(400,mywngrid)

    And all it cost was buying me a beer!

    Parameters
    ----------
    filename : str
        Path to HITRAN cia file


    *Abstract class*

    This is the base class for collisionally induced absorption opacities.
    To function in Taurex3, it requires concrete implementations of:
        - :func:`wavenumberGrid`
        - :func:`compute_cia`
        - :func:`temperatureGrid`

    Parameters
    ----------
    name : str
        Name to use for logging

    pair_name : str
        pair of molecules this class represents. e.g. 'H2-H2' or 'H2-He'


Logging Handler for Taurex 3.

    Prevents other MPI threads from writing to log
    unless they are in trouble (>=ERROR)

    Parameters
    ----------
    stream : stream-object , optional
        Stream to write to otherwise defaults to ``stderr``


Base class for loggable objects.


A forward model for direct imaging of exo-planets.


A forward model for eclipses.


A forward model for transits.


A 'simple' 1D base model.

    It in the sense that its just
    a fairly standard single profiles model.
    It will handle settingup and initializing, building
    collecting parameters from given profiles for you.
    The only method that requires implementation is:

    - :func:`path_integral`


A forward model for a 1D atmosphere.

    Automatically sets up the following profiles:
        - Temperature
        - Pressure
        - Chemistry
        - Planet
        - Star
        - Contributions

    Must implement the following methods:
        - :func:`path_integral`
            - Main integration function that must
            return the absorption and optical depth
            for the given wngrid.


A base class for producing forward models.


Lightcurve data for a single instrument.


Class holding data for a lightcurve from an instrument.


A base class for producing forward models


Test the base spectrum class.


Test the observed spectrum class.


    Scale used by the Planck collaboration to plot Temperature power spectra:
    base-10 logarithmic up to l=50, and linear from there on.
    Care is taken so non-positive values are not plotted.


Authors: Andreas Nygaard and Thomas Tram (2024)


Stop training when the loss is at its min, i.e. the loss stops decreasing.

  Arguments:
      patience: Number of epochs to wait after min has been hit. After this
      number of no improvement, training stops.


    Main object used for all ASSIST Ephemeris operations.
    Not tied to a particular REBOUND simulation.


    Main object used for all ASSIST operations, tied to a particular REBOUND simulation.
    This is an abstraction of the C struct assist_extras.


An OGS run model


A single OGS run model


    Computes the analytical solution to a diffusion-advection-reaction equation
    in steady state on a 1D domain subject to a pressure gradient from p0 (left)
    to p1 (right) and a concentration gradient from c0 (left) to c1 (right).

    The porosities in the left and right halves of the domain differ.

    The analytical solution works for non-zero Darcy velocities only.


Run all tests and post-process the result data


    Read in a line cube and initialize the class.

    Args:
        path (str): Relative path to the rotation map you want to fit.
        FOV (Optional[float]): If specified, clip the data down to a
            square field of view with sides of `FOV` [arcsec].
        fill (Optional[float/None]): Value to fill any NaN values.
        velocity_range (Optional[list]): A velocity range in [m/s] to
            clip the data down to: ``[min_velo, max_velo]``.


    A class containing an annulus of spectra with their associated polar angles
    measured east of north from the redshifted major axis. These range from -pi
    to +pi. It will also store the inclination of the disk which will
    additionally define the rotation direction of the disk. A positive
    inclination will define clockwise (west of north) rotation, while a negative
    inclination will specify anti-clockwise direction.

    Args:
        spectra (ndarray): Array of shape ``[N, M]`` of spectra to shift and
            fit, where ``N`` is the number of spectra and ``M`` is the length
            of the velocity axis.
        pvals (ndarray): Polar angles in [rad] of each of the spectra.
        velax (ndarray): Velocity axis in [m/s] of the spectra.
        inc (float): Inclination of the disk in [deg]. A positive inclination
            specifies a clockwise rotating disk.
        rvals (ndarray): Radial position in [arcsec] of each pixel.
        xsky (ndarray): On-sky x-offset in [arcsec] of each pixel.
        ysky (ndarray): On-sky y-offset in [arcsec] of each pixel.
        jidx (ndarray): j-index of the original data array (y-axis).
        iidx (ndarray): i-index of the original data array (x-axis).
        remove_empty (optional[bool]): Remove empty spectra.
        sort_spectra (optional[bool]): Sorted the spectra into increasing
            ``theta``.


    Read in the velocity maps and initialize the class. To make the fitting
    quicker, we can clip the cube to a smaller region, or downsample the
    image to get a quicker initial fit.

    Args:
        path (str): Relative path to the rotation map you want to fit.
        FOV (Optional[float]): If specified, clip the data down to a
            square field of view with sides of `FOV` [arcsec].
        uncertainty (Optional[str]): Relative path to the map of v0
            uncertainties. Must be a FITS file with the same shape as the
            data. If nothing is specified, will tried to find an uncerainty
            file following the ``bettermoments`` format. If this is not found,
            it will assume a 10% on all pixels.
        downsample (Optional[int]): Downsample the image by this factor for
            quicker fitting. For example, using ``downsample=4`` on an image
            which is 1000 x 1000 pixels will reduce it to 250 x 250 pixels.
            If you use ``downsample='beam'`` it will sample roughly
            spatially independent pixels using the beam major axis as the
            spacing.
        fill (Optional[float]): Replace all ``NaN`` values with this value.
        force_center (Optional[bool]): If ``True`` define the spatial axes such
            that they describe offset from the array center in [arcsec]. This
            is useful if the FITS header does not contain axis information.


    A ``datacube`` instance to read in data in a ``FITS`` format. This should
    contain all the functions to interact with a spectral line dataset.

    Args:
        path (str): Path to the datacube to load.
        FOV (Optional[float]): If specified, clip the data down to a
            square field of view with sides of `FOV` [arcsec].
        velocity_range (Optional[list]): A tuple or list of the minimum and
            maximum velocities in [m/s] to clip the data cube to.
        fill (Optional[float]): Replace all ``NaN`` values with this value.
        force_center (Optional[bool]): If ``True`` define the spatial axes such
            that they describe offset from the array center in [arcsec]. This
            is useful if the FITS header does not contain axis information.


Defines a class to store and read the window function and one sigma
       depth function data relating to the tps planet detection
       metrics.  The tps planet detection metrics consist of the
       window function and one-sigma depth function.  See
       Burke & Catanzarite 2016, Planet Detection Metrics: Window and
            One-Sigma Depth Functions for Data Release 25 (KSCI-19101-002)
       for a description of the window function and one-sigma depth function.

       instantiate tps_planet_detection_metrics with the KIC ID and filePath
       to the window and OSD function fits files.
       The fits files are available for DR25 here

       http://exoplanetarchive.ipac.caltech.edu/bulk_data_download/

       This function assumes the filenames have not been renamed
       from their original names.
       INIT INPUT:
       wanted_kic - [int] KIC id of target you want data for
       filePath - [str] path to the directory containing fits files
       want_wf - [bool] retrieve window function data
       want_osd - [bool] retrieve one sigma depth function

       CLASS VARIABLE CONTENTS:
       pulsedurations - [hr] list of transit durations searched
       id - [int] Target identifier
       wf_data - list of dictionary containing window function data
       osd_data - list of dictionary containing one sigma depth function

       CLASS FUNCTION CONTENTS:
       __init__ - initialization sets variable contents and reads in files