# Create a utility function do do spherical geometry averaging

XMLWordPrintable

## Details

• Type: Story
• Status: Done
• Priority: Minor
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
None
• Templates:
• Story Points:
1
• Sprint:
Science Pipelines DM-W16-5
• Team:
Data Release Production

## Description

I would like to calculate a correct average and RMS for a set of RA, Dec positions.

Neither Jim Bosch nor Paul Price knew of an easy, simple function to do that that existed in the stack. Paul Price suggested:

 mean = sum(afwGeom.Extent3D(coord.toVector()) for coord in coordList, afwGeom.Point3D(0, 0, 0)) mean /= len(coordList) mean = afwCoord.IcrsCoord(mean) 

That makes sense, but it's a bit unobvious (it's obvious how it works, but would likely never occur to someone that they should do it that way in the stack).

Pedantically it's also not the best way to do a mean while preserving precision, but I don't anticipate that to be an issue in practice.

Creating a function that did this would provide clarity. I don't know where that function should live.

Note: I know how to do this in Astropy. I'm intentionally not using astropy here. But part of the astropy dependency discussion is likely "how much are we otherwise rewriting in the LSST stack".

## People

• Assignee:
Paul Price
Reporter:
Michael Wood-Vasey
Reviewers:
Russell Owen
Watchers:
John Swinbank, Michael Wood-Vasey, Paul Price, Russell Owen