Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d4a877

Browse files
committed
Remove unused std_shape variable and update references to use SIGMA directly
1 parent 18b3cb9 commit 2d4a877

1 file changed

Lines changed: 6 additions & 19 deletions

File tree

numcosmo/galaxy/nc_galaxy_sd_shape_hsm_gauss_global.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ typedef struct _NcGalaxySDShapeHSMGaussGlobalPrivate
6161
NcmModelCtrl *ctrl_hp;
6262
NcmModelCtrl *ctrl_shape;
6363
NcmStatsVec *obs_stats;
64-
gdouble std_shape;
6564
} NcGalaxySDShapeHSMGaussGlobalPrivate;
6665

6766
struct _NcGalaxySDShapeHSMGaussGlobal
@@ -164,7 +163,6 @@ static NcGalaxySDShapeIntegrand *_nc_galaxy_sd_shape_hsm_gauss_global_integ (NcG
164163
static gboolean _nc_galaxy_sd_shape_hsm_gauss_global_prepare_data_array (NcGalaxySDShape *gsds, NcmMSet *mset, GPtrArray *data_array);
165164
static void _nc_galaxy_sd_shape_hsm_gauss_global_data_init (NcGalaxySDShape *gsds, NcGalaxySDPositionData *sdpos_data, NcGalaxySDShapeData *data);
166165
static void _nc_galaxy_sd_shape_hsm_gauss_global_direct_estimate (NcGalaxySDShape *gsds, NcmMSet *mset, GPtrArray *data_array, gdouble *gt, gdouble *gx, gdouble *sigma_t, gdouble *sigma_x, gdouble *rho);
167-
static void _nc_galaxy_sd_shape_hsm_gauss_global_update_std_shape (NcGalaxySDShape *gsds);
168166

169167
static void
170168
nc_galaxy_sd_shape_hsm_gauss_global_class_init (NcGalaxySDShapeHSMGaussGlobalClass *klass)
@@ -207,15 +205,6 @@ nc_galaxy_sd_shape_hsm_gauss_global_class_init (NcGalaxySDShapeHSMGaussGlobalCla
207205
#define VECTOR (NCM_MODEL (gsds))
208206
#define SIGMA (ncm_model_orig_param_get (VECTOR, NC_GALAXY_SD_SHAPE_HSM_GAUSS_GLOBAL_SIGMA))
209207

210-
static void
211-
_nc_galaxy_sd_shape_hsm_gauss_global_update_std_shape (NcGalaxySDShape *gsds)
212-
{
213-
NcGalaxySDShapeHSMGaussGlobalPrivate * const self = nc_galaxy_sd_shape_hsm_gauss_global_get_instance_private (NC_GALAXY_SD_SHAPE_HSM_GAUSS_GLOBAL (gsds));
214-
215-
if (ncm_model_ctrl_update (self->ctrl_shape, NCM_MODEL (gsds)))
216-
self->std_shape = nc_galaxy_sd_shape_hsm_gauss_global_std_shape_from_sigma (SIGMA);
217-
}
218-
219208
static complex double
220209
_gauss_gen (NcmRNG *rng, const gdouble sigma)
221210
{
@@ -240,13 +229,12 @@ _nc_galaxy_sd_shape_hsm_gauss_global_gen (NcGalaxySDShape *gsds, NcmMSet *mset,
240229
const gdouble ra = data->sdpos_data->ra;
241230
const gdouble dec = data->sdpos_data->dec;
242231
const gdouble z = data->sdpos_data->sdz_data->z;
243-
const gdouble sigma = SIGMA;
244232
const gdouble noise1 = ncm_rng_gaussian_gen (rng, 0.0, ldata->std_noise);
245233
const gdouble noise2 = ncm_rng_gaussian_gen (rng, 0.0, ldata->std_noise);
246234
const gdouble c1 = ldata->c1;
247235
const gdouble c2 = ldata->c2;
248236
const gdouble m = ldata->m;
249-
complex double e_s = _gauss_gen (rng, sigma);
237+
complex double e_s = _gauss_gen (rng, SIGMA);
250238
complex double noise = noise1 + I * noise2;
251239
complex double c = c1 + I * c2;
252240
gdouble theta = 0.0;
@@ -289,7 +277,7 @@ _nc_galaxy_sd_shape_hsm_gauss_global_gen (NcGalaxySDShape *gsds, NcmMSet *mset,
289277
}
290278
else
291279
{
292-
e_o = e_s;
280+
e_o = e_s + c;
293281
}
294282

295283
e_o += noise;
@@ -584,11 +572,10 @@ _nc_galaxy_sd_shape_hsm_gauss_global_direct_estimate (NcGalaxySDShape *gsds, Ncm
584572
NcHICosmo *cosmo = NC_HICOSMO (ncm_mset_peek (mset, nc_hicosmo_id ()));
585573
NcHaloPosition *halo_position = NC_HALO_POSITION (ncm_mset_peek (mset, nc_halo_position_id ()));
586574
NcGalaxyWLObsEllipConv ellip_conv = nc_galaxy_sd_shape_get_ellip_conv (gsds);
587-
const gdouble std_shape = self->std_shape;
575+
const gdouble sigma = SIGMA;
588576

589577
guint i;
590578

591-
_nc_galaxy_sd_shape_hsm_gauss_global_update_std_shape (gsds);
592579
nc_halo_position_prepare_if_needed (halo_position, cosmo);
593580
ncm_stats_vec_reset (self->obs_stats, TRUE);
594581

@@ -604,7 +591,7 @@ _nc_galaxy_sd_shape_hsm_gauss_global_direct_estimate (NcGalaxySDShape *gsds, Ncm
604591
const gdouble m = ldata_i->m;
605592
const gdouble c1 = ldata_i->c1;
606593
const gdouble c2 = ldata_i->c2;
607-
const gdouble var_tot = std_shape * std_shape + std_noise * std_noise;
594+
const gdouble var_tot = sigma * sigma + std_noise * std_noise;
608595
const gdouble weight = 1.0 / var_tot;
609596
complex double e_o = e1 + I * e2;
610597
complex double hat_g;
@@ -645,8 +632,8 @@ _nc_galaxy_sd_shape_hsm_gauss_global_direct_estimate (NcGalaxySDShape *gsds, Ncm
645632
break;
646633
case NC_GALAXY_WL_OBS_ELLIP_CONV_TRACE:
647634
{
648-
const gdouble std_shape2 = std_shape * std_shape;
649-
const gdouble R = 1.0 - std_shape2;
635+
const gdouble sigma2 = sigma * sigma;
636+
const gdouble R = 1.0 - sigma2;
650637

651638
*gt = (0.5 * mean_gt / R - mean_c1) / (1.0 + mean_m);
652639
*gx = (0.5 * mean_gx / R - mean_c2) / (1.0 + mean_m);

0 commit comments

Comments
 (0)