[AstroPy] propagating coordinate errors

Frederic V. Hessman hessman at astro.physik.uni-goettingen.de
Thu Aug 26 02:01:07 EDT 2021


Of course I can sample the coordinates using the mostly small errors, but I'm converting zillions of Ra,Dec,pmRA,pmDEC,RV,dist data points to Galactocentric (i.e. Cartesian) coordinates where the non-Gaussian effects are minimal, so it would be REALLY HANDY not to have to sample.

From a sense of what astropy handling should feel like, it would be nice to have something like....

	from astropy import unit as u
	from astropy.coordinates import SkyCoord, Galactocentric

	s = SkyCoord (ra=11.*u.deg, dec=22.*u.deg, distance=33.*u.pc, radial_velocity=44.*u.km/u.s,....)

	# CREATE COVARIANCE FOR THIS COORDINATE IN THIS COORDINATE SYSTEM
	cov = s.cov (err_ra=2.*u.arcsec, err_dec=2.*u.arcsec, ....) # MISSING ERRORS ARE ASSUMED = 0

	# TRANFORM e.g. TO GALACTOCENTRIC COORDINATES
 	g = s.transform_to (Galactocentric)

	# GET COVARIANCE BASED ON THE OTHER COVARIANCE
	gcov = s.cov(cov)

	# ACCESS THE TRANFORMED COVARIANCE BY NAME
	print (f'v_x={g.v_x} +/- {np.sqrt(gcov['v_x']['v_x'])}')

This would be infinitely better than having to MC a zillion measurements (e.g. Gaia!), even if it means that the final errors are just estimates.

Rick

>> It's wonderful to have SkyCoord, but real coordinates have errors - how
>> does one propagate them using differentials when transforming to other
>> representations?
>> 
>> I haven't been able to find _any_ examples by looking at the official
>> examples or googling and the BaseDifferential docs are .... not very helpful.

> From: Adrian Price-Whelan <adrianmpw at gmail.com>
> 
> Hi Rick,
> 
> The most straightforward way of doing this with existing functionality is
> to pass Monte Carlo samples through the representation transformations. In
> general, if your uncertainties are, e.g., Gaussian in Spherical
> coordinates, they will not be Gaussian in other representations, so in most
> cases this is the only thing you can do. (Though if your uncertainties are
> very small, there are other tricks to employ...). If you say more about
> what exactly you want to do, I can give you some specific examples!
> 
> best,
> - Adrian

> From: Derek Homeier <derek at astro.physik.uni-goettingen.de>
> 
> On 23 Aug 2021, at 5:35 pm, Adrian Price-Whelan <adrianmpw at gmail.com> wrote:
>> 
>> The most straightforward way of doing this with existing functionality is to pass Monte Carlo samples through the representation transformations. In general, if your uncertainties are, e.g., Gaussian in Spherical coordinates, they will not be Gaussian in other representations, so in most cases this is the only thing you can do. (Though if your uncertainties are very small, there are other tricks to employ...). If you say more about what exactly you want to do, I can give you some specific examples!
>> 
> Looking at e.g. how velocity components, if set, are transformed along in sc.data.differentials,
> would it be possible to use that mechanism for small differentials?
> 
> Cheers,
> 				Derek



More information about the AstroPy mailing list