Skip to content

Commit

Permalink
Merge pull request #99 from willcerny/master
Browse files Browse the repository at this point in the history
All the checks passed, but that probably means we don't have a check on the radial extension calculation. In any case, this is definitely an improvement in how the estimation is being done.
  • Loading branch information
kadrlica authored Jun 27, 2024
2 parents 6883af0 + 0a76a7e commit e4f0a62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
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 @@ -318,7 +318,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

0 comments on commit e4f0a62

Please sign in to comment.