Observables

galaxy clustering

class desilike.observables.galaxy_clustering.power_spectrum.TracerPowerSpectrumMultipolesObservable(*args, **kwargs)[source]

Bases: BaseCalculator

Tracer power spectrum multipoles observable: compare measurement to theory.

Parameters:
  • data (array, str, Path, list, lsstypes.Mesh2SpectrumPoles, dict, default=None) – Data power spectrum measurement: flat array (of all multipoles), lsstypes.Mesh2SpectrumPoles instance, or path to such instances, or list of such objects (in which case the average of them is taken). If dict, parameters to be passed to theory to generate mock measurement. If a (list of) flat array, additionally provide list of multipoles ells and wavenumbers k, and optionally shotnoise (see kwargs).

  • covariance (array, list, default=None) – 2D array, list of lsstypes.Mesh2SpectrumPoles instance` instances, or paths to such instances; these are used to compute the covariance matrix.

  • klim (dict, default=None) – Wavenumber limits: a dictionary mapping multipoles to (min separation, max separation, (optionally) step (float)), e.g. {0: (0.01, 0.2, 0.01), 2: (0.01, 0.15, 0.01)}. If None, no selection is applied for the given multipole.

  • wmatrix (str, Path, lsstypes.WindowMatrix, WindowedPowerSpectrumMultipoles, default=None) – Optionally, window matrix.

  • transform (array, default=None) – Transform to gaussianize the likelihood of the power spectrum. For ‘cubic’, see eq. 16 of https://arxiv.org/pdf/2302.07484.pdf. If None, no transform is applied.

  • **kwargs (dict) – Optional arguments for WindowedPowerSpectrumMultipoles, e.g.:

    • theory: defaults to KaiserTracerPowerSpectrumMultipoles.

    • shotnoise: take shot noise from data, or covariance (mocks) if provided.

    • fiber_collisions

    • systematic_templates

    • if one only provided simple arrays for data and covariance, one can provide the list of multipoles ells and the corresponding (list of) \(k\) wavenumbers as a (list of) array k, and optionally shotnoise.

plot(scaling='kpk', kpower=None, kw_theory=None, fig=None, figsize=None)[source]

Plot data and theory power spectrum multipoles.

Parameters:
  • scaling (str, default=’kpk’) – Either ‘kpk’ or ‘loglog’.

  • kpower (int or None, default=None) – If not None, will overwrite power of k suggested by scaling and will plot k**kpower * pk.

  • kw_theory (list of dict, default=None) – Change the default line parametrization of the theory, one dictionary for each ell or duplicate it.

  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least 1 + len(self.ells) axes.

  • figsize ((width, height), default=None) – If not figure is passed, fix the size of the created figure. By default:

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

  • interactive (bool, default=False) – If True, use interactive interface provided by ipywidgets.

Returns:

fig

Return type:

matplotlib.figure.Figure

plot_bao(fig=None)[source]

Plot data and theory BAO power spectrum wiggles.

Parameters:
  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least len(self.ells) axes.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

Returns:

fig

Return type:

matplotlib.figure.Figure

plot_covariance_matrix(corrcoef=True, **kwargs)[source]

Plot covariance matrix.

Parameters:
  • corrcoef (bool, default=True) – If True, plot the correlation matrix; else the covariance.

  • barlabel (str, default=None) – Optionally, label for the color bar.

  • figsize (int, tuple, default=None) – Optionally, figure size.

  • norm (matplotlib.colors.Normalize, default=None) – Scales the covariance / correlation to the canonical colormap range [0, 1] for mapping to colors. By default, the covariance / correlation range is mapped to the color bar range using linear scaling.

  • labelsize (int, default=None) – Optionally, size for labels.

  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least len(self.ells) * len(self.ells) axes.

Returns:

fig

Return type:

matplotlib.figure.Figure

to_lsstypes(kind)[source]

Return data or covariance.

class desilike.observables.galaxy_clustering.correlation_function.TracerCorrelationFunctionMultipolesObservable(*args, **kwargs)[source]

Bases: BaseCalculator

Tracer correlation function multipoles observable: compare measurement to theory.

Parameters:
  • data (str, Path, list, lsstypes.Count2Correlation, lsstypes.Count2CorrelationPoles, dict, default=None) – Data correlation function measurement: flat array (of all multipoles), lsstypes.Count2Correlation instance, or path to such instances, or list of such objects (in which case the average of them is taken). If dict, parameters to be passed to theory to generate mock measurement. If a (list of) flat array, additionally provide list of multipoles ells and separations s (see kwargs).

  • covariance (list, default=None) – 2D array, list of lsstypes.Count2Correlation instances, or paths to such instances; these are used to compute the covariance matrix.

  • slim (dict, default=None) – Separation limits: a dictionary mapping multipoles to (min separation, max separation, (optionally) step (float)), e.g. {0: (30., 160., 5.), 2: (30., 160., 5.)}. If None, no selection is applied for the given multipole.

  • **kwargs (dict) – Optional arguments for WindowedCorrelationFunctionMultipoles, e.g.:

    • theory: defaults to KaiserTracerCorrelationFunctionMultipoles.

    • fiber_collisions

    • systematic_templates

    • if one only provided simple arrays for data and covariance, one can provide the list of multipoles ells and the corresponding (list of) \(s\) separations as a (list of) array s.

plot(kw_theory=None, fig=None)[source]

Plot data and theory correlation function multipoles.

Parameters:
  • kw_theory (list of dict, default=None) – Change the default line parametrization of the theory, one dictionary for each ell or duplicate it.

  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least 1 + len(self.ells) axes.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

  • interactive (bool, default=False) – If True, use interactive interface provided by ipywidgets.

Returns:

fig

Return type:

matplotlib.figure.Figure

plot_bao(fig=None)[source]

Plot data and theory BAO correlation function peak.

Parameters:
  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least len(self.ells) axes.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

Returns:

fig

Return type:

matplotlib.figure.Figure

plot_covariance_matrix(corrcoef=True, **kwargs)[source]

Plot covariance matrix.

Parameters:
  • corrcoef (bool, default=True) – If True, plot the correlation matrix; else the covariance.

  • barlabel (str, default=None) – Optionally, label for the color bar.

  • figsize (int, tuple, default=None) – Optionally, figure size.

  • norm (matplotlib.colors.Normalize, default=None) – Scales the covariance / correlation to the canonical colormap range [0, 1] for mapping to colors. By default, the covariance / correlation range is mapped to the color bar range using linear scaling.

  • labelsize (int, default=None) – Optionally, size for labels.

  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least len(self.ells) * len(self.ells) axes.

Returns:

fig

Return type:

matplotlib.figure.Figure

to_lsstypes(kind)[source]

Return observable (data) and covariance.

class desilike.observables.galaxy_clustering.compression.BAOCompressionObservable(*args, **kwargs)[source]

Bases: BaseCompressionObservable

BAO observable: compare (compressed) BAO measurements (in terms of ratios of distances to the sound horizon scale at the drag epoch) to theory predictions.

Parameters:
  • data (str, Path, array, Profiles, Chain) – BAO parameters. If array, provide corresponding quantities. Else, chain, profiles or path to such objects.

  • covariance (str, Path, 2D array, Profiles, Chain, ParameterCovariance) – Covariance for BAO parameters. If 2D array, provide corresponding quantities; if covariance.shape[0] > covariance.shape[1], considered a list of observations. Else, chain, profiles, covariance or path to such objects.

  • cosmo (BasePrimordialCosmology, default=None) – Cosmology calculator. Defaults to Cosmoprimo(fiducial=fiducial).

  • quantities (list, tuple) – Quantities to take from data and covariance: chose from ['DM_over_rd', 'DH_over_rd', 'DV_over_rd', 'DM_over_DH', 'DV_over_rd', 'qpar', 'qper', 'qiso', 'qap'].

  • z (float, default=None) – Effective redshift.

  • fiducial (str, tuple, dict, cosmoprimo.Cosmology, default=’DESI’) – Specifications for fiducial cosmology. Either:

    • str: name of fiducial cosmology in cosmoprimo.fiducial

    • tuple: (name of fiducial cosmology, dictionary of parameters to update)

    • dict: dictionary of parameters

    • cosmoprimo.Cosmology: Cosmology instance

  • **kwargs (dict) – Optional arguments for BAOExtractor.

class desilike.observables.galaxy_clustering.compression.BAOPhaseShiftCompressionObservable(*args, **kwargs)[source]

Bases: BaseCompressionObservable

BAO observable with phase shift: compare (compressed) BAO measurements (in terms of ratios of distances to the sound horizon scale at the drag epoch, and shift) to theory predictions.

Reference

https://arxiv.org/pdf/1803.10741

Parameters:
  • data (str, Path, array, Profiles, Chain) – BAO parameters. If array, provide corresponding quantities. Else, chain, profiles or path to such objects.

  • covariance (str, Path, 2D array, Profiles, Chain, ParameterCovariance) – Covariance for BAO parameters. If 2D array, provide corresponding quantities. Else, chain, profiles, covariance or path to such objects.

  • cosmo (BasePrimordialCosmology, default=None) – Cosmology calculator. Defaults to Cosmoprimo(fiducial=fiducial).

  • quantities (list, tuple) – Quantities to take from data and covariance: chose from ['DM_over_rd', 'DH_over_rd', 'DV_over_rd', 'DM_over_DH', 'DV_over_rd', 'qpar', 'qper', 'qiso', 'qap', 'baoshift'].

  • z (float, default=None) – Effective redshift.

  • fiducial (str, tuple, dict, cosmoprimo.Cosmology, default=’DESI’) – Specifications for fiducial cosmology. Either:

    • str: name of fiducial cosmology in cosmoprimo.fiducial

    • tuple: (name of fiducial cosmology, dictionary of parameters to update)

    • dict: dictionary of parameters

    • cosmoprimo.Cosmology: Cosmology instance

  • **kwargs (dict) – Optional arguments for BAOExtractor.

class desilike.observables.galaxy_clustering.compression.BandVelocityCompressionObservable(*args, **kwargs)[source]

Bases: BaseCompressionObservable

Band velocity power observable: compare band power measurements to theory predictions.

Parameters:
  • data (str, Path, array, Profiles, Chain) – Band velocity power parameters. If array, provide corresponding quantities. Else, chain, profiles or path to such objects.

  • covariance (str, Path, 2D array, Profiles, Chain, ParameterCovariance) – Covariance for band power parameters. If 2D array, provide corresponding quantities. Else, chain, profiles, covariance or path to such objects.

  • cosmo (BasePrimordialCosmology, default=None) – Cosmology calculator. Defaults to Cosmoprimo(fiducial=fiducial).

  • quantities (list, tuple) – Quantities to take from data and covariance: chose from ['dptt*', 'df', 'qap'].

  • z (float, default=None) – Effective redshift.

  • fiducial (str, tuple, dict, cosmoprimo.Cosmology, default=’DESI’) – Specifications for fiducial cosmology. Either:

    • str: name of fiducial cosmology in cosmoprimo.fiducial

    • tuple: (name of fiducial cosmology, dictionary of parameters to update)

    • dict: dictionary of parameters

    • cosmoprimo.Cosmology: Cosmology instance

  • **kwargs (dict) – Other optional arguments for BandVelocityPowerSpectrumExtractor.

class desilike.observables.galaxy_clustering.compression.BaseCompressionObservable(*args, **kwargs)[source]

Bases: BaseCalculator

class desilike.observables.galaxy_clustering.compression.ShapeFitCompressionObservable(*args, **kwargs)[source]

Bases: BaseCompressionObservable

ShapeFit observable: compare ShapeFit measurements to theory predictions.

Parameters:
  • data (str, Path, array, Profiles, Chain) – ShapeFit parameters. If array, provide corresponding quantities. Else, chain, profiles or path to such objects.

  • covariance (str, Path, 2D array, Profiles, Chain, ParameterCovariance) – Covariance for ShapeFit parameters. If 2D array, provide corresponding quantities; if covariance.shape[0] > covariance.shape[1], considered a list of observations. Else, chain, profiles, covariance or path to such objects.

  • cosmo (BasePrimordialCosmology, default=None) – Cosmology calculator. Defaults to Cosmoprimo(fiducial=fiducial).

  • quantities (list, tuple) – Quantities to take from data and covariance: chose from ['m', 'n', 'f_sqrt_Ap', 'dm', 'dn', 'df', 'DM_over_rd', 'DH_over_rd', 'DM_over_DH', 'DV_over_rd', 'qpar', 'qper', 'qap', 'qiso'].

  • z (float, default=None) – Effective redshift.

  • fiducial (str, tuple, dict, cosmoprimo.Cosmology, default=’DESI’) – Specifications for fiducial cosmology. Either:

    • str: name of fiducial cosmology in cosmoprimo.fiducial

    • tuple: (name of fiducial cosmology, dictionary of parameters to update)

    • dict: dictionary of parameters

    • cosmoprimo.Cosmology: Cosmology instance

  • **kwargs (dict) – Other optional arguments for ShapeFitPowerSpectrumExtractor, e.g., kp, a.

Reference

https://arxiv.org/abs/2106.07641

class desilike.observables.galaxy_clustering.compression.StandardCompressionObservable(*args, **kwargs)[source]

Bases: BaseCompressionObservable

Standard RSD compression observable: compare compressed RSD measurements to theory predictions.

Parameters:
  • data (str, Path, array, Profiles, Chain) – Standard compressed parameters. If array, provide corresponding quantities. Else, chain, profiles or path to such objects.

  • covariance (str, Path, 2D array, Profiles, Chain, ParameterCovariance) – Covariance for compressed parameters. If 2D array, provide corresponding quantities; if covariance.shape[0] > covariance.shape[1], considered a list of observations. Else, chain, profiles, covariance or path to such objects.

  • cosmo (BasePrimordialCosmology, default=None) – Cosmology calculator. Defaults to Cosmoprimo(fiducial=fiducial).

  • quantities (list, tuple) – Quantities to take from data and covariance: chose from ['fsigmar', 'df', 'DM_over_rd', 'DH_over_rd', 'DM_over_DH', 'DV_over_rd', 'qpar', 'qper', 'qap', 'qiso'].

  • z (float, default=None) – Effective redshift.

  • fiducial (str, tuple, dict, cosmoprimo.Cosmology, default=’DESI’) – Specifications for fiducial cosmology. Either:

    • str: name of fiducial cosmology in cosmoprimo.fiducial

    • tuple: (name of fiducial cosmology, dictionary of parameters to update)

    • dict: dictionary of parameters

    • cosmoprimo.Cosmology: Cosmology instance

  • **kwargs (dict) – Other optional arguments for StandardPowerSpectrumExtractor, e.g., r.

class desilike.observables.galaxy_clustering.compression.TurnOverCompressionObservable(*args, **kwargs)[source]

Bases: BaseCompressionObservable

Turn over observable: compare (compressed) turn over measurement (in terms of product of distance with the turn over scale \(k_{\mathrm{TO}}\)) to theory predictions.

Parameters:
  • data (str, Path, array, Profiles, Chain) – BAO parameters. If array, provide corresponding quantities. Else, chain, profiles or path to such objects.

  • covariance (str, Path, 2D array, Profiles, Chain, ParameterCovariance) – Covariance for BAO parameters. If 2D array, provide corresponding quantities; if covariance.shape[0] > covariance.shape[1], considered a list of observations. Else, chain, profiles, covariance or path to such objects.

  • cosmo (BasePrimordialCosmology, default=None) – Cosmology calculator. Defaults to Cosmoprimo(fiducial=fiducial).

  • quantities (list, tuple) – Quantities to take from data and covariance: chose from ['DV_times_kTO', 'DM_over_DH', 'qto', 'qap'].

  • z (float, default=None) – Effective redshift.

  • fiducial (str, tuple, dict, cosmoprimo.Cosmology, default=’DESI’) – Specifications for fiducial cosmology. Either:

    • str: name of fiducial cosmology in cosmoprimo.fiducial

    • tuple: (name of fiducial cosmology, dictionary of parameters to update)

    • dict: dictionary of parameters

    • cosmoprimo.Cosmology: Cosmology instance

  • **kwargs (dict) – Optional arguments for BAOExtractor.

class desilike.observables.galaxy_clustering.compression.WiggleSplitCompressionObservable(*args, **kwargs)[source]

Bases: BaseCompressionObservable

Wiggle-split observable: compare the amplitude and tilt of the velocity power spectrum, and BAO position to theory predictions.

Parameters:
  • data (str, Path, array, Profiles, Chain) – Wiggle-split parameters. If array, provide corresponding quantities. Else, chain, profiles or path to such objects.

  • covariance (str, Path, 2D array, Profiles, Chain, ParameterCovariance) – Covariance for band power parameters. If 2D array, provide corresponding quantities; if covariance.shape[0] > covariance.shape[1], considered a list of observations. Else, chain, profiles, covariance or path to such objects.

  • cosmo (BasePrimordialCosmology, default=None) – Cosmology calculator. Defaults to Cosmoprimo(fiducial=fiducial).

  • quantities (list, tuple) – Quantities to take from data and covariance: chose from ['df', 'dm', 'qap', 'qbao'].

  • z (float, default=None) – Effective redshift.

  • fiducial (str, tuple, dict, cosmoprimo.Cosmology, default=’DESI’) – Specifications for fiducial cosmology. Either:

    • str: name of fiducial cosmology in cosmoprimo.fiducial

    • tuple: (name of fiducial cosmology, dictionary of parameters to update)

    • dict: dictionary of parameters

    • cosmoprimo.Cosmology: Cosmology instance

  • **kwargs (dict) – Other optional arguments for WiggleSplitPowerSpectrumExtractor.

class desilike.observables.galaxy_clustering.window.BaseFiberCollisionsCorrelationFunctionMultipoles(*args, **kwargs)[source]

Bases: BaseCalculator

plot(fig=None)[source]

Plot fiber collision effect on correlation function multipoles.

Parameters:
  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least 1 axis.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

Returns:

fig

Return type:

matplotlib.figure.Figure

class desilike.observables.galaxy_clustering.window.BaseFiberCollisionsPowerSpectrumMultipoles(*args, **kwargs)[source]

Bases: BaseCalculator

plot(fig=None)[source]

Plot fiber collision effect on power spectrum multipoles.

Parameters:
  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least 1 axis.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

class desilike.observables.galaxy_clustering.window.BaseSystematicTemplateMultipoles(*args, **kwargs)[source]

Bases: BaseCalculator

class desilike.observables.galaxy_clustering.window.FiberCollisionsCorrelationFunctionMultipoles(*args, **kwargs)[source]

Bases: BaseFiberCollisionsCorrelationFunctionMultipoles

Fiber collision effect on correlation function multipoles. Contrary to Hahn et al. 2016, the kernel is assumed to be a sum of top-hat functions.

Parameters:
  • s (array, default=None) – Output separations.

  • ells (tuple, default=(0, 2, 4)) – Multipoles.

  • sep (array, default=None) – Transverse separation values for kernel.

  • kernel (array, default=None) – Window representing the number of pairs lost as a function of separation.

  • theory (BaseTheoryPowerSpectrumMultipoles) – Theory correlation function multipoles, defaults to KaiserTracerCorrelationFunctionMultipoles.

  • with_uncorrelated (bool, default=True) – If False, do not include the uncorrelated part (due to not correcting the selection function for missing pairs).

  • Reference

  • ———

  • https (//arxiv.org/abs/1609.01714)

class desilike.observables.galaxy_clustering.window.FiberCollisionsPowerSpectrumMultipoles(*args, **kwargs)[source]

Bases: BaseFiberCollisionsPowerSpectrumMultipoles

Fiber collision effect on power spectrum multipoles. Contrary to Hahn et al. 2016:

  • the kernel is assumed to be a sum of top-hat functions

  • no \(k D_{fc} \ll 1\) approximation, where \(D_{fc}\) is the fiber collision scale

Parameters:
  • k (array, default=None) – Output wavenumbers.

  • ells (tuple, default=(0, 2, 4)) – Multipoles.

  • sep (array, default=None) – Transverse separation values for kernel.

  • kernel (array, default=None) – Window representing the number of pairs lost as a function of separation.

  • theory (BaseTheoryPowerSpectrumMultipoles) – Theory power spectrum multipoles, defaults to KaiserTracerPowerSpectrumMultipoles.

  • with_uncorrelated (bool, default=True) – If False, do not include the uncorrelated part (due to not correcting the selection function for missing pairs).

Reference

https://arxiv.org/abs/1609.01714

class desilike.observables.galaxy_clustering.window.SystematicTemplateCorrelationFunctionMultipoles(*args, **kwargs)[source]

Bases: BaseSystematicTemplateMultipoles

Systematic templates for correlation function multipoles.

Parameters:
  • templates (callable, list or dict, default=()) – List of templates; one parameter called ‘syst_{i:d}’ will be created for each template i. or dict of templates; the key will be used as parameter name. Each template can be an array for all multipoles stacked, or a callable that takes (ell, s) as input and returns an array of size s.size.

  • s (array, list, default=None) – Output separations. If list, one array for each multipole.

  • ells (tuple, default=(0, 2, 4)) – Multipoles.

plot(fig=None)[source]

Plot systematic template multipoles.

Parameters:
  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least 1 axis.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

Returns:

fig

Return type:

matplotlib.figure.Figure

class desilike.observables.galaxy_clustering.window.SystematicTemplatePowerSpectrumMultipoles(*args, **kwargs)[source]

Bases: BaseSystematicTemplateMultipoles

Systematic templates for power spectrum multipoles.

Parameters:
  • templates (callable, list or dict, default=()) – List of templates; one parameter called ‘syst_{i:d}’ will be created for each template i. or dict of templates; the key will be used as parameter name. Each template can be an array for all multipoles stacked, or a callable that takes (ell, k) as input and returns an array of size k.size.

  • k (array, list, default=None) – Output wavenumbers. If list, one array for each multipole.

  • ells (tuple, default=(0, 2, 4)) – Multipoles.

plot(fig=None)[source]

Plot systematic template multipoles.

Parameters:
  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least 1 axis.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

Returns:

fig

Return type:

matplotlib.figure.Figure

class desilike.observables.galaxy_clustering.window.TopHatFiberCollisionsCorrelationFunctionMultipoles(*args, **kwargs)[source]

Bases: BaseFiberCollisionsCorrelationFunctionMultipoles

Fiber collision effect on correlation function multipoles, exactly following Hahn et al. 2016, assuming top-hat shape for the kernel.

Parameters:
  • s (array, default=None) – Output separations.

  • ells (tuple, default=(0, 2, 4)) – Multipoles.

  • fs (float, default=1.) – Fraction of pairs lost below the fiber collision scale Dfc.

  • Dfc (float, default=0.) – Fiber collision scale (transverse separation).

  • theory (BaseTheoryPowerSpectrumMultipoles) – Theory correlation function multipoles, defaults to KaiserTracerCorrelationFunctionMultipoles.

  • with_uncorrelated (bool, default=True) – If False, do not include the uncorrelated part (due to not correcting the selection function for missing pairs).

  • mu_range_cut (bool, default=False) – If True, normalize the Legendre integral by the uncut \(\mu\) range (instead of 2): in case the \(R1R2\) counts are cut by the tophat kernel in the estimation of correlation function multipoles.

Reference

https://arxiv.org/abs/1609.01714

class desilike.observables.galaxy_clustering.window.TopHatFiberCollisionsPowerSpectrumMultipoles(*args, **kwargs)[source]

Bases: BaseFiberCollisionsPowerSpectrumMultipoles

Fiber collision effect on power spectrum multipoles, exactly following Hahn et al. 2016:

  • top-hat shape is assumed for the kernel

  • \(k D_{fc} \ll 1\) approximation, where \(D_{fc}\) is the fiber collision scale

Parameters:
  • k (array, default=None) – Output wavenumbers.

  • ells (tuple, default=(0, 2, 4)) – Multipoles.

  • fs (float, default=1.) – Fraction of pairs lost below the fiber collision scale Dfc.

  • Dfc (float, default=0.) – Fiber collision scale (transverse separation).

  • theory (BaseTheoryPowerSpectrumMultipoles) – Theory power spectrum multipoles, defaults to KaiserTracerPowerSpectrumMultipoles.

  • with_uncorrelated (bool, default=True) – If False, do not include the uncorrelated part (due to not correcting the selection function for missing pairs).

Reference

https://arxiv.org/abs/1609.01714

class desilike.observables.galaxy_clustering.window.WindowedCorrelationFunctionMultipoles(*args, **kwargs)[source]

Bases: BaseCalculator

Window effect (for now, none) on correlation function multipoles.

Parameters:
  • slim (dict, default=None) – Optionally, separation limits: a dictionary mapping multipoles to (min separation, max separation, (optionally) step (float)), e.g. {0: (30., 160., 5.), 2: (30., 160., 5.)}. If None, no selection is applied for the given multipole.

  • s (array, default=None) – Optionally, observed separations \(s\), as an array or a list of such arrays (one for each multipole). If not specified, defaults to edge centers, based on slim if provided; else defaults to np.arange(20, 151, 5).

  • ells (tuple, default=None) – Observed multipoles, defaults to (0, 2, 4).

  • wmatrix (dict, default=None) – Can be e.g. {‘resolution’: 2}, specifying the number of theory \(s\) to integrate over per observed bin. Or {‘sedges’: sedges, ‘muedges’: muedges, ‘RR’: RR}, specifying the tabulated RR counts. If a 2D array (window matrix), output and input separations and multipoles s, ells, sin, ellsin should be provided.

  • sin (array, default=None) – If wmatrix is a 2D array, assume those are the input separations.

  • fiber_collisions (BaseFiberCollisionsCorrelationFunctionMultipoles, default=None) – Optionally, fiber collisions.

  • systematic_templates (SystematicTemplateCorrelationFunctionMultipoles, default=None) – Optionally, systematic templates.

  • theory (BaseTheoryCorrelationFunctionMultipoles) – Theory correlation function multipoles, defaults to KaiserTracerCorrelationFunctionMultipoles.

get()[source]

Return quantity of main interest, e.g. loglikelihood + logprior if self is a likelihood.

plot(fig=None)[source]

Plot window function effect on correlation function multipoles.

Parameters:
  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least 1 axis.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

Returns:

fig

Return type:

matplotlib.figure.Figure

class desilike.observables.galaxy_clustering.window.WindowedPowerSpectrumMultipoles(*args, **kwargs)[source]

Bases: BaseCalculator

Window effect on the power spectrum multipoles.

Parameters:
  • klim (dict, default=None) – Optionally, wavenumber limits: a dictionary mapping multipoles to (min separation, max separation, step (float)), e.g. {0: (0.01, 0.2, 0.01), 2: (0.01, 0.15, 0.01)}. If None, no selection is applied for the given multipole.

  • k (array, default=None) – Optionally, observed wavenumbers \(k\), as an array or a list of such arrays (one for each multipole). If not specified, taken from wmatrix if provided; else defaults to edge centers, based on klim if provided; else defaults to np.arange(0.01, 0.205, 0.01).

  • ells (tuple, default=None) – Observed multipoles. Defaults to poles in klim, if provided; else (0, 2, 4).

  • wmatrix (str, Path, pypower.BaseMatrix, dict, array, default=None) – Optionally, window matrix. Can be e.g. {‘resolution’: 2}, specifying the number of theory \(k\) to integrate over per observed bin. If a 2D array (window matrix), output and input wavenumbers and multipoles k, ells, kin, ellsin should be provided.

  • kin (array, default=None) – If provided, linearly interpolate wmatrix along input wavenumbers to these wavenumbers, or if wmatrix is a 2D array, assume those are the input wavenumbers.

  • kinrebin (int, default=1) – If wmatrix (which is defined for input theory wavenumbers) is provided, rebin theory wavenumbers by this factor.

  • kinlim (tuple, default=None) – If wmatrix (which is defined for input theory wavenumbers) is provided, limit theory wavenumbers in the provided range.

  • ellsin (tuple, default=None) – Optionally, input theory multipoles. If not specified, taken from wmatrix if provided, else (0, 2, 4).

  • shotnoise (float, default=0.) – Shot noise (window matrix must be applied to power spectrum with shot noise).

  • wshotnoise (float, default=None) – Optionally, response of the window to a shot noise.

  • fiber_collisions (BaseFiberCollisionsPowerSpectrumMultipoles, default=None) – Optionally, fiber collisions.

  • systematic_templates (SystematicTemplatePowerSpectrumMultipoles, default=None) – Optionally, systematic templates.

  • theory (BaseTheoryPowerSpectrumMultipoles) – Theory power spectrum multipoles, defaults to KaiserTracerPowerSpectrumMultipoles.

get()[source]

Return quantity of main interest, e.g. loglikelihood + logprior if self is a likelihood.

plot(fig=None)[source]

Plot window function effect on power spectrum multipoles.

Parameters:
  • fig (matplotlib.figure.Figure, default=None) – Optionally, a figure with at least 1 axis.

  • fn (str, Path, default=None) – Optionally, path where to save figure. If not provided, figure is not saved.

  • kw_save (dict, default=None) – Optionally, arguments for matplotlib.figure.Figure.savefig().

  • show (bool, default=False) – If True, show figure.

Returns:

fig

Return type:

matplotlib.figure.Figure

desilike.observables.galaxy_clustering.window.window_matrix_RR(soutedges, sedges, muedges, wcounts, ellsin=(0, 2, 4), resolution=1)[source]

Build window matrix for binning, in the continuous limit, i.e. integral of \(\int dx x^2 f(x) / \int dx x^2\) over each bin.

Parameters:
  • soutedges (dict) – \(s\)-edges, for each output \(\ell\).

  • muedges (array) – \(\mu\)-edges.

  • wcounts (2D array) – RR (weighted) pair counts, of shape (len(sedges) - 1, len(muedges) - 1).

  • ellsin (tuple, default=(0, 2, 4)) – Input, theory, \(\ell\).

  • resolution (int, default=1) – Number of evaluation points in the integral, in addition to the rebinning factor (len(sedges) - 1) / (len(list_sedges[0]) - 1).

Returns:

  • sin (array) – Input theory coordinates.

  • full_matrix (array) – Window matrix.

desilike.observables.galaxy_clustering.window.window_matrix_bininteg(list_edges, resolution=1)[source]

Build window matrix for binning, in the continuous limit, i.e. integral of \(\int dx x^2 f(x) / \int dx x^2\) over each bin.

Parameters:
  • list_edges (list) – Original coarse edges.

  • resolution (int, default=1) – Number of evaluation points in the integral.

Returns:

  • xin (array) – Input theory coordinates.

  • full_matrix (array) – Window matrix.

class desilike.observables.galaxy_clustering.covariance.BaseFootprint(nbar=None, size=None, volume=None, attrs=None)[source]

Bases: BaseClass

Base class to characterize 3D footprint: density and volume.

Initialize footprint.

Parameters:
  • nbar (float, default=None) – Density, in \((h / \mathrm{Mpc})^{3}\).

  • size (float, default=None) – If nbar is not provided, the number of objects.

  • volume (float, default=None) – Volume, in \((\mathrm{Mpc} / h)^{3}\).

property shotnoise

Shot noise, in \((h / \mathrm{Mpc})^{3}\).

property size

Number of objects.

property volume

Volume, in \((\mathrm{Mpc} / h)^{3}\).

class desilike.observables.galaxy_clustering.covariance.BoxFootprint(nbar=None, size=None, volume=None, attrs=None)[source]

Bases: BaseFootprint

Box footprint.

Initialize footprint.

Parameters:
  • nbar (float, default=None) – Density, in \((h / \mathrm{Mpc})^{3}\).

  • size (float, default=None) – If nbar is not provided, the number of objects.

  • volume (float, default=None) – Volume, in \((\mathrm{Mpc} / h)^{3}\).

class desilike.observables.galaxy_clustering.covariance.CutskyFootprint(nbar=None, size=None, area=None, zrange=None, cosmo=None, attrs=None)[source]

Bases: BaseFootprint

Extend BaseFootprint to cutsky: surface area, redshift range and redshift density.

Initialize footprint.

Parameters:
  • nbar (float, array, default=None) – If scalar, surface density, in \(\mathrm{deg}^{-2}\). Else, for each redshift in zrange, density, in \((h / \mathrm{Mpc})^{3}\).

  • size (float, default=None) – If nbar is not provided, the number of objects.

  • area (float, default=None) – Area, in \(\mathrm{deg}^{2}\).

  • zrange (tuple, array, default=None) – Redshift range, or array of redshifts where nbar is tabulated.

  • cosmo (cosmoprimo.Cosmology) – Cosmology instance, for redshift-to-distance conversion.

property area

Area, in \(\mathrm{deg}^{2}\).

property cosmo

Fiducial cosmology.

property size

Number of objects.

property volume

Volume, in \((\mathrm{Mpc} / h)^{3}\).

property zavg

Average redshift.

property zeff

Effective redshift.

class desilike.observables.galaxy_clustering.covariance.ObservablesCovarianceMatrix(observables, footprints=None, theories=None, resolution=1)[source]

Bases: BaseClass

Compute Gaussian covariance matrix for input observables. Warning: does not handle cross-correlations of different tracers!

Initialize ObservablesCovarianceMatrix.

Parameters:
  • observables (list, BaseCalculator) – List of (or single) observable, e.g. TracerPowerSpectrumMultipolesObservable or TracerCorrelationFunctionMultipolesObservable.

  • footprints (list, BaseFootprint) – List of (or single) footprints for input observables.

  • theories (list, BaseCalculator) – List of theories for input observables. Defaults to first calculator in observable that has power attribute.

  • resolution (int, default=1) – Number of integration points in each bin.

desilike.observables.galaxy_clustering.covariance.integral_legendre_product(ells, range=(-1, 1), norm=False)[source]

Return integral of product of Legendre polynomials.

Parameters:
  • ells (int, list, tuple) – Order(s) of Legendre polynomials to multiply together.

  • range (tuple, default=(-1, 1)) – \(\mu\)-integration range.

  • norm (bool, default=False) – If True, normalize integral by the \(\mu\)-integration range.

Returns:

toret – Integral of product of Legendre polynomials.

Return type:

float

lya

class desilike.observables.lya.compression.P1DCompressionObservable(*args, **kwargs)[source]

Bases: BaseCompressionObservable

P1D compression observable: compare P1D compressed measurements to theory predictions.

Parameters:
  • data (str, Path, array, Profiles, Chain) – P1D compressed parameters. If array, provide corresponding quantities. Else, chain, profiles or path to such objects.

  • covariance (str, Path, 2D array, Profiles, Chain, ParameterCovariance) – Covariance for P1D compressed parameters. If 2D array, provide corresponding quantities. Else, chain, profiles, covariance or path to such objects.

  • quantities (list, tuple) – Quantities to take from data and covariance: chose from ['delta2star', 'nstar', 'alphastar'].

  • **kwargs (dict) – Optional arguments for P1DPowerSpectrumExtractor, e.g. z, qstar.

Reference

https://arxiv.org/abs/2106.07641