Skip to content

Commit

Permalink
Merge 2ce5ded into 18f046a
Browse files Browse the repository at this point in the history
  • Loading branch information
vitenti committed Mar 7, 2023
2 parents 18f046a + 2ce5ded commit 8abdf0c
Show file tree
Hide file tree
Showing 28 changed files with 2,060 additions and 1,096 deletions.
3 changes: 2 additions & 1 deletion docs/numcosmo-docs.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@
<xi:include href="xml/nc_reduced_shear_calib_wtg.xml"/>
<xi:include href="xml/nc_galaxy_wl.xml"/>
<xi:include href="xml/nc_galaxy_wl_dist.xml"/>
<xi:include href="xml/nc_galaxy_wl_reduced_shear_gauss.xml"/>
<xi:include href="xml/nc_galaxy_wl_ellipticity_gauss.xml"/>
<xi:include href="xml/nc_galaxy_wl_ellipticity_kde.xml"/>
<xi:include href="xml/nc_galaxy_wl_proj.xml"/>
</section>
<section>
Expand Down
32 changes: 17 additions & 15 deletions numcosmo/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ nc_headers = \
model/nc_hicosmo_idem2.h \
model/nc_hicosmo_gcg.h \
model/nc_hicosmo_de.h \
model/nc_hicosmo_de_reparam_ok.h \
model/nc_hicosmo_de_reparam_ok.h \
model/nc_hicosmo_de_reparam_cmb.h \
model/nc_hicosmo_de_cpl.h \
model/nc_hicosmo_de_cpl.h \
model/nc_hicosmo_de_jbp.h \
model/nc_hicosmo_de_xcdm.h \
model/nc_hicosmo_de_wspline.h \
Expand Down Expand Up @@ -399,13 +399,13 @@ nc_headers = \
lss/nc_halo_density_profile_einasto.h \
lss/nc_halo_density_profile_dk14.h \
lss/nc_halo_density_profile_hernquist.h \
lss/nc_galaxy_acf.h \
lss/nc_multiplicity_func.h \
lss/nc_multiplicity_func_ps.h \
lss/nc_multiplicity_func_st.h \
lss/nc_multiplicity_func_jenkins.h \
lss/nc_multiplicity_func_warren.h \
lss/nc_multiplicity_func_tinker.h \
lss/nc_galaxy_acf.h \
lss/nc_multiplicity_func.h \
lss/nc_multiplicity_func_ps.h \
lss/nc_multiplicity_func_st.h \
lss/nc_multiplicity_func_jenkins.h \
lss/nc_multiplicity_func_warren.h \
lss/nc_multiplicity_func_tinker.h \
lss/nc_multiplicity_func_tinker_mean_normalized.h \
lss/nc_multiplicity_func_crocce.h \
lss/nc_multiplicity_func_bocquet.h \
Expand Down Expand Up @@ -436,7 +436,8 @@ nc_headers = \
lss/nc_galaxy_redshift_gauss.h \
lss/nc_galaxy_wl.h \
lss/nc_galaxy_wl_dist.h \
lss/nc_galaxy_wl_reduced_shear_gauss.h \
lss/nc_galaxy_wl_ellipticity_gauss.h \
lss/nc_galaxy_wl_ellipticity_kde.h \
lss/nc_galaxy_wl_proj.h \
lss/nc_cor_cluster_cmb_lens_limber.h \
lss/nc_wl_surface_mass_density.h \
Expand Down Expand Up @@ -520,9 +521,9 @@ nc_sources = \
model/nc_hicosmo_idem2.c \
model/nc_hicosmo_gcg.c \
model/nc_hicosmo_de.c \
model/nc_hicosmo_de_reparam_ok.c \
model/nc_hicosmo_de_reparam_ok.c \
model/nc_hicosmo_de_reparam_cmb.c \
model/nc_hicosmo_de_cpl.c \
model/nc_hicosmo_de_cpl.c \
model/nc_hicosmo_de_jbp.c \
model/nc_hicosmo_de_xcdm.c \
model/nc_hicosmo_de_wspline.c \
Expand Down Expand Up @@ -551,8 +552,8 @@ nc_sources = \
lss/nc_halo_density_profile_einasto.c \
lss/nc_halo_density_profile_dk14.c \
lss/nc_halo_density_profile_hernquist.c \
lss/nc_galaxy_acf.c \
lss/nc_multiplicity_func.c \
lss/nc_galaxy_acf.c \
lss/nc_multiplicity_func.c \
lss/nc_multiplicity_func_ps.c \
lss/nc_multiplicity_func_st.c \
lss/nc_multiplicity_func_jenkins.c \
Expand Down Expand Up @@ -588,7 +589,8 @@ nc_sources = \
lss/nc_galaxy_redshift_gauss.c \
lss/nc_galaxy_wl.c \
lss/nc_galaxy_wl_dist.c \
lss/nc_galaxy_wl_reduced_shear_gauss.c \
lss/nc_galaxy_wl_ellipticity_gauss.c \
lss/nc_galaxy_wl_ellipticity_kde.c \
lss/nc_galaxy_wl_proj.c \
lss/nc_cor_cluster_cmb_lens_limber.c \
lss/nc_wl_surface_mass_density.c \
Expand Down
100 changes: 51 additions & 49 deletions numcosmo/data/nc_data_bao_empirical_fit_2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* numcosmo is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Expand All @@ -27,10 +27,10 @@
* SECTION:nc_data_bao_empirical_fit_2d
* @title: NcDataBaoEmpiricalFit2d
* @short_description: Baryon oscillation data -- $D_H / r_d$ and $D_t / r_d$ empirical likelihood.
*
* This object implements the BAO data when its likelihood function is provided,
*
* This object implements the BAO data when its likelihood function is provided,
* e.g., [Bautista et al. (2017)][XBautista2017].
*
*
*/

#ifdef HAVE_CONFIG_H
Expand All @@ -47,11 +47,11 @@ enum
{
PROP_0,
PROP_DH_RD_FIDUC,
PROP_DT_RD_FIDUC,
PROP_DT_RD_FIDUC,
PROP_Z,
PROP_M2LNP,
PROP_DIST,
PROP_SIZE
PROP_SIZE
};

G_DEFINE_TYPE (NcDataBaoEmpiricalFit2d, nc_data_bao_empirical_fit_2d, NCM_TYPE_DATA_DIST2D);
Expand All @@ -61,10 +61,10 @@ nc_data_bao_empirical_fit_2d_init (NcDataBaoEmpiricalFit2d *bao_ef)
{
bao_ef->Dh_rd_fiduc = 0.0;
bao_ef->Dt_rd_fiduc = 0.0;
bao_ef->z = 0.0;
bao_ef->m2lnp = NULL;
bao_ef->p = NULL;
bao_ef->dist = nc_distance_new (2.0);
bao_ef->z = 0.0;
bao_ef->m2lnp = NULL;
bao_ef->p = NULL;
bao_ef->dist = nc_distance_new (2.0);
}

static void
Expand All @@ -76,7 +76,7 @@ nc_data_bao_empirical_fit_2d_constructed (GObject *object)
NcDataBaoEmpiricalFit2d *bao_ef = NC_DATA_BAO_EMPIRICAL_FIT_2D (object);

ncm_stats_dist2d_prepare (bao_ef->p);

ncm_data_set_init (NCM_DATA (bao_ef), TRUE);
}
}
Expand All @@ -85,6 +85,7 @@ static void
nc_data_bao_empirical_fit_2d_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
NcDataBaoEmpiricalFit2d *bao_ef = NC_DATA_BAO_EMPIRICAL_FIT_2D (object);

g_return_if_fail (NC_IS_DATA_BAO_EMPIRICAL_FIT_2D (object));

switch (prop_id)
Expand All @@ -102,7 +103,7 @@ nc_data_bao_empirical_fit_2d_set_property (GObject *object, guint prop_id, const
ncm_spline2d_clear (&bao_ef->m2lnp);
ncm_stats_dist2d_clear (&bao_ef->p);
bao_ef->m2lnp = g_value_dup_object (value);
bao_ef->p = NCM_STATS_DIST2D (ncm_stats_dist2d_spline_new (bao_ef->m2lnp));
bao_ef->p = NCM_STATS_DIST2D (ncm_stats_dist2d_spline_new (bao_ef->m2lnp));
break;
case PROP_DIST:
nc_data_bao_empirical_fit_2d_set_dist (bao_ef, g_value_get_object (value));
Expand All @@ -117,6 +118,7 @@ static void
nc_data_bao_empirical_fit_2d_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
NcDataBaoEmpiricalFit2d *bao_ef = NC_DATA_BAO_EMPIRICAL_FIT_2D (object);

g_return_if_fail (NC_IS_DATA_BAO_EMPIRICAL_FIT_2D (object));

switch (prop_id)
Expand Down Expand Up @@ -149,18 +151,16 @@ nc_data_bao_empirical_fit_2d_dispose (GObject *object)

ncm_spline2d_clear (&bao_ef->m2lnp);
ncm_stats_dist2d_clear (&bao_ef->p);

nc_distance_clear (&bao_ef->dist);

/* Chain up : end */
G_OBJECT_CLASS (nc_data_bao_empirical_fit_2d_parent_class)->dispose (object);
}

static void
nc_data_bao_empirical_fit_2d_finalize (GObject *object)
{


/* Chain up : end */
G_OBJECT_CLASS (nc_data_bao_empirical_fit_2d_parent_class)->finalize (object);
}
Expand All @@ -171,7 +171,7 @@ static void _nc_data_bao_empirical_fit_2d_inv_pdf (NcmDataDist2d *dist2d, NcmMSe
static void
nc_data_bao_empirical_fit_2d_class_init (NcDataBaoEmpiricalFit2dClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NcmDataDist2dClass *bao_ef_class = NCM_DATA_DIST2D_CLASS (klass);

object_class->constructed = nc_data_bao_empirical_fit_2d_constructed;
Expand Down Expand Up @@ -223,40 +223,39 @@ nc_data_bao_empirical_fit_2d_class_init (NcDataBaoEmpiricalFit2dClass *klass)
bao_ef_class->inv_pdf = _nc_data_bao_empirical_fit_2d_inv_pdf;
}

static gdouble
static gdouble
_nc_data_bao_empirical_fit_2d_m2lnL_val (NcmDataDist2d *dist2d, NcmMSet *mset, gdouble x, gdouble y)
{
NcDataBaoEmpiricalFit2d *bao_ef = NC_DATA_BAO_EMPIRICAL_FIT_2D (dist2d);
const gdouble alpha_par = nc_data_bao_empirical_fit_2d_get_alpha_parallel (bao_ef, mset);
const gdouble alpha_per = nc_data_bao_empirical_fit_2d_get_alpha_perpendicular (bao_ef, mset);
const gdouble alphax = alpha_per - x;
const gdouble alphay = alpha_par - y;
gdouble m2lnL = ncm_stats_dist2d_eval_m2lnp (bao_ef->p, alphax, alphay);
const gdouble alpha_par = nc_data_bao_empirical_fit_2d_get_alpha_parallel (bao_ef, mset);
const gdouble alpha_per = nc_data_bao_empirical_fit_2d_get_alpha_perpendicular (bao_ef, mset);
const gdouble alphax = alpha_per - x;
const gdouble alphay = alpha_par - y;
gdouble m2lnL = ncm_stats_dist2d_eval_m2lnp (bao_ef->p, alphax, alphay);
gdouble xl, xu, yl, yu;

ncm_stats_dist2d_xbounds (bao_ef->p, &xl, &xu);
ncm_stats_dist2d_ybounds (bao_ef->p, &yl, &yu);

/*
printf ("x, y = % 22.15g, % 22.15g | m2lnL = % 22.15g (% 22.15g % 22.15g) (% 22.15g % 22.15g)\n",
alphax, alphay, m2lnL,
xl, xu, yl, yu);
*/
* printf ("x, y = % 22.15g, % 22.15g | m2lnL = % 22.15g (% 22.15g % 22.15g) (% 22.15g % 22.15g)\n",
* alphax, alphay, m2lnL,
* xl, xu, yl, yu);
*/

if (((alphax < xl) || (alphax > xu)) || ((alphay < yl) || (alphay > yu)))
return GSL_POSINF;
else
return m2lnL;
return m2lnL;
}

static void
static void
_nc_data_bao_empirical_fit_2d_inv_pdf (NcmDataDist2d *dist2d, NcmMSet *mset, gdouble u, gdouble v, gdouble *x, gdouble *y)
{
NcDataBaoEmpiricalFit2d *bao_ef = NC_DATA_BAO_EMPIRICAL_FIT_2D (dist2d);

NCM_UNUSED (bao_ef);
g_assert_not_reached ();

}

/**
Expand All @@ -265,9 +264,9 @@ _nc_data_bao_empirical_fit_2d_inv_pdf (NcmDataDist2d *dist2d, NcmMSet *mset, gdo
* @Dh_rd_fiduc: fiducial $D_H/r_d$
* @Dt_rd_fiduc: fiducial $D_t/r_d$
* @z: data redshift
*
*
* Creates a new #NcDataBaoEmpiricalFit2d.
*
*
* Returns: the newly created #NcDataBaoEmpiricalFit2d.
*/
NcDataBaoEmpiricalFit2d *
Expand Down Expand Up @@ -295,15 +294,16 @@ nc_data_bao_empirical_fit_2d_new (NcmSpline2d *m2lnp, gdouble Dh_rd_fiduc, gdoub
/**
* nc_data_bao_empirical_fit_2d_new_from_file:
* @filename: file containing a serialized #NcDataBaoEmpiricalFit2d.
*
*
* Creates a new #NcDataBaoEmpiricalFit2d from @filename.
*
*
* Returns: (transfer full): the newly created #NcDataBaoEmpiricalFit2d.
*/
NcDataBaoEmpiricalFit2d *
nc_data_bao_empirical_fit_2d_new_from_file (const gchar *filename)
{
NcDataBaoEmpiricalFit2d *bao_ef = NC_DATA_BAO_EMPIRICAL_FIT_2D (ncm_serialize_global_from_file (filename));

g_assert (NC_IS_DATA_BAO_EMPIRICAL_FIT_2D (bao_ef));

return bao_ef;
Expand All @@ -313,16 +313,17 @@ nc_data_bao_empirical_fit_2d_new_from_file (const gchar *filename)
* nc_data_bao_empirical_fit_2d_new_from_id:
* @dist: a #NcDistance
* @id: a #NcDataBaoId
*
*
* Creates a new #NcDataBaoEmpiricalFit2d from @id.
*
*
* Returns: (transfer full): the newly created #NcDataBaoEmpiricalFit2d.
*/
NcDataBaoEmpiricalFit2d *
nc_data_bao_empirical_fit_2d_new_from_id (NcDistance *dist, NcDataBaoId id)
{
NcDataBaoEmpiricalFit2d *bao_ef;
gchar *filename;

switch (id)
{
case NC_DATA_BAO_EMPIRICAL_FIT_2D_BAUTISTA2017:
Expand All @@ -345,23 +346,23 @@ nc_data_bao_empirical_fit_2d_new_from_id (NcDistance *dist, NcDataBaoId id)

g_assert (NC_IS_DATA_BAO_EMPIRICAL_FIT_2D (bao_ef));
g_assert (NCM_IS_DATA (bao_ef));

return bao_ef;
}

/**
* nc_data_bao_empirical_fit_2d_get_alpha_perpendicular:
* @bao_ef: a #NcDataBaoEmpiricalFit2d
* @mset: a #NcmMSet
*
*
* Calculates value of $\alpha_{\perp}$ given a #NcmMSet,
* $$ \alpha_{perp} = \frac{[D_t(z)/r_d]}{[D_t(z)/r_d]_{fid}},$$
* where $D_t(z)$ is the transverse comoving distance [nc_distance_transverse()], $r_d$ is the sound
* horizon [nc_distance_sound_horizon()] at the drag epoch, and 'fid' indicates fiducial.
*
* where $D_t(z)$ is the transverse comoving distance [nc_distance_transverse()], $r_d$ is the sound
* horizon [nc_distance_sound_horizon()] at the drag epoch, and 'fid' indicates fiducial.
*
* Returns: $\alpha_{\perp}$
*/
gdouble
gdouble
nc_data_bao_empirical_fit_2d_get_alpha_perpendicular (NcDataBaoEmpiricalFit2d *bao_ef, NcmMSet *mset)
{
NcHICosmo *cosmo = NC_HICOSMO (ncm_mset_peek (mset, nc_hicosmo_id ()));
Expand All @@ -376,12 +377,12 @@ nc_data_bao_empirical_fit_2d_get_alpha_perpendicular (NcDataBaoEmpiricalFit2d *b
* nc_data_bao_empirical_fit_2d_get_alpha_parallel:
* @bao_ef: a #NcDataBaoEmpiricalFit2d
* @mset: a #NcmMSet
*
*
* Calculates value of $\alpha_{\parallel}$ given a #NcmMSet.
*
*
* Returns: $\alpha_{\parallel}$
*/
gdouble
gdouble
nc_data_bao_empirical_fit_2d_get_alpha_parallel (NcDataBaoEmpiricalFit2d *bao_ef, NcmMSet *mset)
{
NcHICosmo *cosmo = NC_HICOSMO (ncm_mset_peek (mset, nc_hicosmo_id ()));
Expand All @@ -396,13 +397,14 @@ nc_data_bao_empirical_fit_2d_get_alpha_parallel (NcDataBaoEmpiricalFit2d *bao_ef
* nc_data_bao_empirical_fit_2d_set_dist:
* @bao_ef: a #NcDataBaoEmpiricalFit2d
* @dist: a #NcDistance
*
*
* Sets the distance object.
*
*
*/
void
void
nc_data_bao_empirical_fit_2d_set_dist (NcDataBaoEmpiricalFit2d *bao_ef, NcDistance *dist)
{
nc_distance_clear (&bao_ef->dist);
bao_ef->dist = nc_distance_ref (dist);
}

5 changes: 3 additions & 2 deletions numcosmo/data/nc_data_bao_empirical_fit_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* numcosmo is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -79,3 +79,4 @@ void nc_data_bao_empirical_fit_2d_set_dist (NcDataBaoEmpiricalFit2d *bao_ef, NcD
G_END_DECLS

#endif /* _NC_DATA_BAO_EMPIRICAL_FIT_2D_H_ */

0 comments on commit 8abdf0c

Please sign in to comment.