These are chat archives for astropy/astropy

10th
Jun 2014
Asra Nizami
@anizami
Jun 10 2014 07:11
Hi everyone, I'm not sure if this is a bug in Astropy 0.4 but I've been having some problems with the Angle class. If I do something like
values = [15] * u.degree, then
angles = Angle(values) then with fields=1 and sep =(six.u('\xb0'),"'",'"')[:fields] when I finally do this: string = angles.to_string(unit=u.degree,fields=fields,decimal=False,precision=0,sep=sep), in Astropy 0.3.1, string = [u'15\xb0'] but in the latest developer version of Astropy, string = [u'15']. This only happens when fields=1 - if I do fields=2, both versions of Astropy give string=[u"15\xb024'"]. Have there been any changes to the Angle class?
Thomas Robitaille
@astrofrog
Jun 10 2014 14:05
@anizami - I think it might be worth emailing the astropy-dev list about this, someone there might know what changed
Christoph Deil
@cdeil
Jun 10 2014 15:19
Is this expected / desired behaviour?
In [5]: from astropy.coordinates import SkyCoord

In [6]: SkyCoord()
Out[6]: <repr(<astropy.coordinates.sky_coordinate.SkyCoord at 0x1070a1a90>) failed: ValueError: substring not found>
Thomas Robitaille
@astrofrog
Jun 10 2014 15:24
That doesn't seem right
ping @eteq @taldcroft
Christoph Deil
@cdeil
Jun 10 2014 15:26

The other thing I noticed is this:

In [17]: isinstance(c.ICRS(), c.SkyCoord)
Out[17]: False

I guess if I write a function that takes coordinates as input I should only accept SkyCoord objects, not ICRS or one of the other BaseCoordinateFrame objects?

Stuart Mumford
@Cadair
Jun 10 2014 15:27
yeah that is probably wise
SkyCoord is not a superclass of the frames
it is a wrapper
It reads the whole transform graph to find all the frames that have been defined IIRC
Christoph Deil
@cdeil
Jun 10 2014 17:01
I've filed an issue for the SkyCoord repr ValueError above: astropy/astropy#2613
Christoph Deil
@cdeil
Jun 10 2014 18:05
Github seems to be having problems ... no git server communication works for me and all travis-ci tests are failing ... https://status.github.com/
Michael Mueller
@mdmueller
Jun 10 2014 18:55
@taldcroft - should I start a google hangout?
Erik Tollerud
@eteq
Jun 10 2014 19:10
@cdeil - #2613 is definitely a bug, thanks for catching.
@cdeil @Cadair - for isinstance, you should do:
isinstance(SkyCoord(...).frame, ICRS)
If you want to write a function that accepts coordinates, you have three options that might work depending on what you want:
  • you can duck-type and just use e.g. ra, dec, or transformTo attribute/methods
  • you can convert to SkyCoord at the top of the function - it will happily accept either SkyCoord or ICRSobjects as single-arguments
  • specifically require SkyCoord
Christoph Deil
@cdeil
Jun 10 2014 19:42
@eteq Thanks for the info ... I already changed my code to coordinate.frame.name == 'icrs' which I guess is OK?
Wolfgang Kerzendorf
@wkerzendorf
Jun 10 2014 21:23
we should duck-type not type check ;-)
Stuart Mumford
@Cadair
Jun 10 2014 21:51
Hello, anyone in here know a decent way of converting a CDi_j matrix to a PCi_j matrix?