Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute extension_radial posterior directly and use this for parameter estimates, as opposed to using extension+ellipticity summary statistics #99

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ugali/analysis/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion ugali/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down