firecrown.likelihood.number_counts ================================== .. py:module:: firecrown.likelihood.number_counts .. autoapi-nested-parse:: Number counts source and systematics. Attributes ---------- .. autoapisummary:: firecrown.likelihood.number_counts.LINEAR_BIAS_DEFAULT_ALPHAZ firecrown.likelihood.number_counts.LINEAR_BIAS_DEFAULT_ALPHAG firecrown.likelihood.number_counts.LINEAR_BIAS_DEFAULT_Z_PIV firecrown.likelihood.number_counts.PT_NON_LINEAR_BIAS_DEFAULT_B_2 firecrown.likelihood.number_counts.PT_NON_LINEAR_BIAS_DEFAULT_B_S firecrown.likelihood.number_counts.CONSTANT_MAGNIFICATION_BIAS_DEFAULT_MAG_BIAS firecrown.likelihood.number_counts.NUMBER_COUNTS_DEFAULT_BIAS firecrown.likelihood.number_counts.NumberCountsSystematicFactory Classes ------- .. autoapisummary:: firecrown.likelihood.number_counts.NumberCountsArgs firecrown.likelihood.number_counts.NumberCountsSystematic firecrown.likelihood.number_counts.PhotoZShift firecrown.likelihood.number_counts.PhotoZShiftandStretch firecrown.likelihood.number_counts.SelectField firecrown.likelihood.number_counts.LinearBiasSystematic firecrown.likelihood.number_counts.PTNonLinearBiasSystematic firecrown.likelihood.number_counts.MagnificationBiasSystematic firecrown.likelihood.number_counts.ConstantMagnificationBiasSystematic firecrown.likelihood.number_counts.NumberCounts firecrown.likelihood.number_counts.LinearBiasSystematicFactory firecrown.likelihood.number_counts.PTNonLinearBiasSystematicFactory firecrown.likelihood.number_counts.MagnificationBiasSystematicFactory firecrown.likelihood.number_counts.ConstantMagnificationBiasSystematicFactory firecrown.likelihood.number_counts.NumberCountsFactory Module Contents --------------- .. py:class:: NumberCountsArgs Bases: :py:obj:`firecrown.likelihood.source.SourceGalaxyArgs` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.NumberCountsArgs :parts: 1 Class for number counts tracer builder argument. .. py:attribute:: bias :type: None | numpy.typing.NDArray[numpy.float64] :value: None .. py:attribute:: mag_bias :type: None | tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64]] :value: None .. py:attribute:: has_pt :type: bool :value: False .. py:attribute:: has_hm :type: bool :value: False .. py:attribute:: b_2 :type: None | tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64]] :value: None .. py:attribute:: b_s :type: None | tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64]] :value: None .. py:class:: NumberCountsSystematic(parameter_prefix = None) Bases: :py:obj:`firecrown.likelihood.source.SourceGalaxySystematic`\ [\ :py:obj:`NumberCountsArgs`\ ] .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.NumberCountsSystematic :parts: 1 Abstract base class for systematics for Number Counts sources. Derived classes must implement :meth:`apply` with the correct signature. .. py:method:: apply(tools, tracer_arg) :abstractmethod: Apply method to include systematics in the tracer_arg. This does not modify the supplied tracer_arg; it returns a new one that has been updated. :param tools: the Modeling tools used to update the tracer_arg :param tracer_arg: the original NumberCountsArgs to which to apply the systematic :return: the updated NumberCountsArgs .. py:class:: PhotoZShift(sacc_tracer, active = True) Bases: :py:obj:`firecrown.likelihood.source.SourceGalaxyPhotoZShift`\ [\ :py:obj:`NumberCountsArgs`\ ] .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.PhotoZShift :parts: 1 Photo-z shift systematic. .. py:class:: PhotoZShiftandStretch(sacc_tracer, active = True) Bases: :py:obj:`firecrown.likelihood.source.SourceGalaxyPhotoZShiftandStretch`\ [\ :py:obj:`NumberCountsArgs`\ ] .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.PhotoZShiftandStretch :parts: 1 Photo-z shift systematic. .. py:class:: SelectField(field = 'delta_matter') Bases: :py:obj:`firecrown.likelihood.source.SourceGalaxySelectField`\ [\ :py:obj:`NumberCountsArgs`\ ] .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.SelectField :parts: 1 Systematic to select 3D field. .. py:data:: LINEAR_BIAS_DEFAULT_ALPHAZ :value: 0.0 .. py:data:: LINEAR_BIAS_DEFAULT_ALPHAG :value: 1.0 .. py:data:: LINEAR_BIAS_DEFAULT_Z_PIV :value: 0.5 .. py:class:: LinearBiasSystematic(sacc_tracer) Bases: :py:obj:`NumberCountsSystematic` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.LinearBiasSystematic :parts: 1 Linear bias systematic. This systematic adds a linear bias model which varies with redshift and the growth function. The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: :ivar alphaz: the redshift exponent of the bias. :ivar alphag: the growth function exponent of the bias. :ivar z_piv: the pivot redshift of the bias. .. py:attribute:: alphaz .. py:attribute:: alphag .. py:attribute:: z_piv .. py:method:: apply(tools, tracer_arg) Apply a linear bias systematic. :param tools: the ModelingTools used to update the tracer_arg :param tracer_arg: a NumberCountsArgs object with values to be updated :return: the updated NumberCountsArgs object .. py:data:: PT_NON_LINEAR_BIAS_DEFAULT_B_2 :value: 1.0 .. py:data:: PT_NON_LINEAR_BIAS_DEFAULT_B_S :value: 1.0 .. py:class:: PTNonLinearBiasSystematic(sacc_tracer = None) Bases: :py:obj:`NumberCountsSystematic` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.PTNonLinearBiasSystematic :parts: 1 Non-linear bias systematic. This systematic adds a linear bias model which varies with redshift and the growth function. The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: :ivar b_2: the quadratic bias. :ivar b_s: the stochastic bias. .. py:attribute:: b_2 .. py:attribute:: b_s .. py:method:: apply(tools, tracer_arg) Apply a non-linear bias systematic. :param tools: currently unused, but required by interface :param tracer_arg: a NumberCountsArgs object with values to be updated :return: the updated NumberCountsArgs object .. py:class:: MagnificationBiasSystematic(sacc_tracer) Bases: :py:obj:`NumberCountsSystematic` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.MagnificationBiasSystematic :parts: 1 Magnification bias systematic. This systematic adds a magnification bias model for galaxy number contrast following Joachimi & Bridle (2010), arXiv:0911.2454. The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: :ivar r_lim: the limiting magnitude. :ivar sig_c: the intrinsic dispersion of the source redshift distribution. :ivar eta: the slope of the luminosity function. :ivar z_c: the characteristic redshift of the source distribution. :ivar z_m: the slope of the source redshift distribution. .. py:attribute:: r_lim .. py:attribute:: sig_c .. py:attribute:: eta .. py:attribute:: z_c .. py:attribute:: z_m .. py:method:: apply(tools, tracer_arg) Apply a magnification bias systematic. :param tools: currently unused, but required by the interface :param tracer_arg: a NumberCountsArgs object with values to be updated :return: an updated NumberCountsArgs object .. py:data:: CONSTANT_MAGNIFICATION_BIAS_DEFAULT_MAG_BIAS :value: 1.0 .. py:class:: ConstantMagnificationBiasSystematic(sacc_tracer) Bases: :py:obj:`NumberCountsSystematic` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.ConstantMagnificationBiasSystematic :parts: 1 Simple constant magnification bias systematic. This systematic adds a constant magnification bias model for galaxy number contrast. The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: :ivar mag_bias: the magnification bias. .. py:attribute:: mag_bias .. py:method:: apply(tools, tracer_arg) Apply a constant magnification bias systematic. :param tools: currently unused, but required by interface :param tracer_arg: a NumberCountsArgs object with values to be updated :return: an updated NumberCountsArgs object .. py:data:: NUMBER_COUNTS_DEFAULT_BIAS :value: 1.5 .. py:class:: NumberCounts(*, sacc_tracer, has_rsd = False, derived_scale = False, scale = 1.0, systematics = None) Bases: :py:obj:`firecrown.likelihood.source.SourceGalaxy`\ [\ :py:obj:`NumberCountsArgs`\ ] .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.NumberCounts :parts: 1 Source class for number counts. .. py:attribute:: sacc_tracer .. py:attribute:: has_rsd :value: False .. py:attribute:: derived_scale :value: False .. py:attribute:: bias .. py:attribute:: systematics :type: firecrown.updatable.UpdatableCollection[firecrown.likelihood.source.SourceGalaxySystematic[NumberCountsArgs]] .. py:attribute:: scale :value: 1.0 .. py:attribute:: current_tracer_args :type: None | NumberCountsArgs :value: None .. py:attribute:: tracer_args :type: NumberCountsArgs .. py:method:: create_ready(inferred_zdist, has_rsd = False, derived_scale = False, scale = 1.0, systematics = None) :classmethod: Create a NumberCounts object with the given tracer name and scale. This is the recommended way to create a NumberCounts object. It creates a fully initialized object. :param inferred_zdist: the inferred redshift distribution :param has_rsd: whether to include RSD in the tracer :param derived_scale: whether to include a derived parameter for the scale of the tracer :param scale: the initial scale of the tracer :param systematics: a list of systematics to apply to the tracer :return: a fully initialized NumberCounts object .. py:method:: create_tracers(tools) Create the tracers for this source. :param tools: the ModelingTools used to create the tracers :return: a tuple of tracers and the updated tracer_args .. py:method:: get_scale() Return the scale for this source. :return: the scale for this source. .. py:class:: LinearBiasSystematicFactory(/, **data) Bases: :py:obj:`pydantic.BaseModel` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.LinearBiasSystematicFactory :parts: 1 Factory class for LinearBiasSystematic objects. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: type :type: Annotated[Literal['LinearBiasSystematicFactory'], Field(description='The type of the systematic.')] :value: 'LinearBiasSystematicFactory' .. py:method:: create(bin_name) Create a LinearBiasSystematic object with the given tracer name. .. py:method:: create_global() Create a LinearBiasSystematic object with the given tracer name. .. py:class:: PTNonLinearBiasSystematicFactory(/, **data) Bases: :py:obj:`pydantic.BaseModel` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.PTNonLinearBiasSystematicFactory :parts: 1 Factory class for PTNonLinearBiasSystematic objects. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: type :type: Annotated[Literal['PTNonLinearBiasSystematicFactory'], Field(description='The type of the systematic.')] :value: 'PTNonLinearBiasSystematicFactory' .. py:method:: create(bin_name) Create a PTNonLinearBiasSystematic object with the given tracer name. :param bin_name: the name of the bin :return: the created PTNonLinearBiasSystematic object .. py:method:: create_global() Create a global PTNonLinearBiasSystematic object. .. py:class:: MagnificationBiasSystematicFactory(/, **data) Bases: :py:obj:`pydantic.BaseModel` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.MagnificationBiasSystematicFactory :parts: 1 Factory class for MagnificationBiasSystematic objects. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: type :type: Annotated[Literal['MagnificationBiasSystematicFactory'], Field(description='The type of the systematic.')] :value: 'MagnificationBiasSystematicFactory' .. py:method:: create(bin_name) Create a MagnificationBiasSystematic object with the given tracer name. :param bin_name: the name of the bin :return: the created MagnificationBiasSystematic object .. py:method:: create_global() Required by the interface, but raises an error. MagnificationBiasSystematic systematics cannot be global. .. py:class:: ConstantMagnificationBiasSystematicFactory(/, **data) Bases: :py:obj:`pydantic.BaseModel` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.ConstantMagnificationBiasSystematicFactory :parts: 1 Factory class for ConstantMagnificationBiasSystematic objects. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: type :type: Annotated[Literal['ConstantMagnificationBiasSystematicFactory'], Field(description='The type of the systematic.')] :value: 'ConstantMagnificationBiasSystematicFactory' .. py:method:: create(bin_name) Create a ConstantMagnificationBiasSystematic object. :param bin_name: the name of the bin :return: the created ConstantMagnificationBiasSystematic object .. py:method:: create_global() Required by the interface, but raises an error. ConstantMagnificationBiasSystematic systematics cannot be global. .. py:data:: NumberCountsSystematicFactory .. py:class:: NumberCountsFactory(/, **data) Bases: :py:obj:`pydantic.BaseModel` .. autoapi-inheritance-diagram:: firecrown.likelihood.number_counts.NumberCountsFactory :parts: 1 Factory class for NumberCounts objects. .. py:attribute:: per_bin_systematics :type: Sequence[NumberCountsSystematicFactory] .. py:attribute:: global_systematics :type: Sequence[NumberCountsSystematicFactory] .. py:attribute:: include_rsd :type: bool :value: False .. py:method:: model_post_init(_, /) Initialize the NumberCountsFactory. .. py:method:: create(inferred_zdist) Create a NumberCounts object with the given tracer name and scale. :param inferred_zdist: the inferred redshift distribution :return: a fully initialized NumberCounts object .. py:method:: create_from_metadata_only(sacc_tracer) Create an WeakLensing object with the given tracer name and scale. :param sacc_tracer: the name of the tracer :return: a fully initialized NumberCounts object