These are chat archives for astropy/astropy

May 2014
Adam Ginsburg
May 15 2014 08:18
Is the FITS standard supposed to be case sensitivity or insensitive w.r.t. units, e.g. BUNTI?
Adam Ginsburg
May 15 2014 12:35
@eteq, @taldcroft - coordinates.SkyCoord('19 23 40.001395 +14 31 01.550347', unit=(u.hour,u.deg), frame='icrs') doesn't work any more, whereas coordinates.ICRS('19 23 40.001395 +14 31 01.550347', unit=(u.hour,u.deg)) did. Is there any way to parse these space-separated sexagesimal coordinates now?
Adam Ginsburg
May 15 2014 13:34
what's the best way - using astropy utils - to download a file, preserving its name, to $PWD?
Erik Tollerud
May 15 2014 16:11
@keflavich - re: the coordinates thing: it does work to do coordinates.SkyCoord(’19:23:40.001395 +14:31:01.550347', unit=(u.hour,u.deg), frame='icrs’) so that’s the short-term solution. But I think it makes sense to support the space-delimited version, too. Do you think you’re up for trying to issue a PR to do that? I’d say it’s ok post feature-freeze becasue it’s restoring a feature that already exists...
Erik Tollerud
May 15 2014 16:16

As for the download bit, this is a smidge kludgey, but it works:

from shutil import move
from import download_file

tmpfn = download_file(url)
move(tmpfn, url.split(‘/‘)[-1]

Note that this approach only works if the URL has the actual name. To get a filename from dynamic content (e.g., a query), you need Content-Disposition from the http headers, which download_file doesn’t expose. So in that case you’re probably better off using requests or urllib2 directly or something

If you think there’s a clear use case for something like download_file(url, outdir=‘.’) which automatically takes care of file names, feel free to create an issue, @keflavich - it wouldn’t be that hard, but as yet there’s no clear call for it
Matt Craig
May 15 2014 17:27
Fits says this about unit case: "Note that, per IAU convention, case is significant throughout. "