From 65bf152ee9739e9cfae2609465780214bd697568 Mon Sep 17 00:00:00 2001 From: William Cerny Date: Tue, 16 Apr 2024 10:38:20 -0400 Subject: [PATCH 1/2] Update stats.py to include extension_radial parameter in supplement() Part 1 of an improvement to use the full posterior when calculating the azimuthally-averaged (radial) extension. This fix specifically adds extension_radial to the class method supplement(), part of the Samples class --- ugali/utils/stats.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ugali/utils/stats.py b/ugali/utils/stats.py index aec8a15..c82e797 100644 --- a/ugali/utils/stats.py +++ b/ugali/utils/stats.py @@ -299,7 +299,14 @@ def supplement(self,coordsys='gal'): names = ['position_angle_gal','position_angle_cel'] arrs = [pa_gal,pa_cel] out = recfuncs.append_fields(out,names,arrs,**kwargs).view(Samples) - + + if ('extension' in out.names) and ('ellipticity' in out.names): + ext = out.extension + ellipticity = out.ellipticity + rext = ext * np.sqrt(1-ellipticity) + + out = recfuncs.append_fields(out,['extension_radial'], [rext]).view(Samples) + return out def get(self, names=None, burn=None, clip=None): From 0a76a7e5f089819b50b201657f875920222788e8 Mon Sep 17 00:00:00 2001 From: William Cerny Date: Tue, 16 Apr 2024 10:56:06 -0400 Subject: [PATCH 2/2] Update results.py to use new extension_radial field of samples to compute extension_radial estimate Part 2 of an improvement to use the full posterior of the extension and ellipticity to derive extension_radial samples, then compute summary statistics on extension_radial. --- ugali/analysis/results.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ugali/analysis/results.py b/ugali/analysis/results.py index 99877d6..1f4425e 100644 --- a/ugali/analysis/results.py +++ b/ugali/analysis/results.py @@ -166,6 +166,8 @@ def get_results(self,**kwargs): results['dec'] = self.estimate('dec',**kwargs) results['glon'] = self.estimate('glon',**kwargs) results['glat'] = self.estimate('glat',**kwargs) + results['extension_radial'] = self.estimate('extension_radial', **kwargs) + except KeyError: logger.warn("Didn't find 'ra' or 'dec' in Samples...") if self.coordsys == 'gal': @@ -216,9 +218,9 @@ def get_results(self,**kwargs): # Radially symmetric extension (correct for ellipticity). ell,ell_err = estimate['ellipticity'] - rext,rext_err = ext*np.sqrt(1-ell),np.array(ext_err)*np.sqrt(1-ell) + rext,rext_err = results['extension_radial'] #ext*np.sqrt(1-ell),np.array(ext_err)*np.sqrt(1-ell) rext_sigma = np.nan_to_num(np.array(rext_err) - rext) - results['extension_radial'] = ugali.utils.stats.interval(rext,rext_err[0],rext_err[1]) + #results['extension_radial'] = ugali.utils.stats.interval(rext,rext_err[0],rext_err[1]) # now obsolete results['extension_radial_arcmin'] = ugali.utils.stats.interval(60*rext,60*rext_err[0],60*rext_err[1]) # Bayes factor for ellipticity