These are chat archives for astropy/astropy

Jun 2014
Asra Nizami
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] *, then
angles = Angle(values) then with fields=1 and sep =(six.u('\xb0'),"'",'"')[:fields] when I finally do this: string = angles.to_string(,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
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
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
Jun 10 2014 15:24
That doesn't seem right
ping @eteq @taldcroft
Christoph Deil
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
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
Jun 10 2014 17:01
I've filed an issue for the SkyCoord repr ValueError above: astropy/astropy#2613
Christoph Deil
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 ...
Michael Mueller
Jun 10 2014 18:55
@taldcroft - should I start a google hangout?
Erik Tollerud
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
Jun 10 2014 19:42
@eteq Thanks for the info ... I already changed my code to == 'icrs' which I guess is OK?
Wolfgang Kerzendorf
Jun 10 2014 21:23
we should duck-type not type check ;-)
Stuart Mumford
Jun 10 2014 21:51
Hello, anyone in here know a decent way of converting a CDi_j matrix to a PCi_j matrix?