Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dstndstn/astrometry.net
Browse files Browse the repository at this point in the history
  • Loading branch information
dstndstn committed May 4, 2015
2 parents c851e97 + d48d850 commit 2306dd1
Show file tree
Hide file tree
Showing 29 changed files with 240 additions and 39 deletions.
8 changes: 7 additions & 1 deletion blind/anet.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
import mimetools, mimetypes
import os, stat
from cStringIO import StringIO
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
import time

__author__ = "J. S. Bloom"
Expand Down
8 changes: 7 additions & 1 deletion blind/centroid-noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
from pylab import *
from numpy import *
from numpy.random import *
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")

# Given an image and an xylist (including estimated image sigma),
# look at a cutout around each source position, add noise, and recompute
Expand Down
8 changes: 7 additions & 1 deletion blind/image2xy.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@
# You need ctypes and a recent (1.0) numpy for this to work. I've included
# pyfits so you don't have to.

import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
import sys
import scipy
import os
Expand Down
8 changes: 7 additions & 1 deletion blind/spoof.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
import math
from math import exp
from matplotlib.pylab import imread
Expand Down
8 changes: 7 additions & 1 deletion blind/test_plotstuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
matplotlib.use('Agg')
import unittest

import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
import numpy as np
import pylab as plt
from math import pi,sqrt
Expand Down
8 changes: 7 additions & 1 deletion blind/test_plotstuff2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
if __name__ == '__main__':
matplotlib.use('Agg')
import unittest
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from astrometry.util.fits import *
from astrometry.blind.plotstuff import *
import numpy as np
Expand Down
8 changes: 7 additions & 1 deletion blind/ver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import math
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from numpy import *
from matplotlib.pylab import figure, plot, xlabel, ylabel, loglog, clf
from matplotlib.pylab import semilogy, show, find, legend, hist, axis
Expand Down
8 changes: 7 additions & 1 deletion catalogs/ngc2000tofits.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from numpy import *
from ngc2000 import ngc2000, ngc2000accurate
from astrometry.util.fits import *
Expand Down
8 changes: 7 additions & 1 deletion net/process_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@
django.setup()


import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")


import tempfile
Expand Down
8 changes: 7 additions & 1 deletion sdss/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
from astrometry.util.fits import fits_table
from astrometry.util.miscutils import get_overlapping_region
import numpy as np
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")

try:
import cutils
Expand Down
8 changes: 7 additions & 1 deletion sdss/dr10.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import os
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from astrometry.util.fits import fits_table
import numpy as np

Expand Down
8 changes: 7 additions & 1 deletion sdss/dr8.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
try:
import fitsio
except:
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")

from common import *
from dr7 import *
Expand Down
8 changes: 7 additions & 1 deletion sdss/dr9.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import os
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from astrometry.util.fits import fits_table
import numpy as np

Expand Down
8 changes: 7 additions & 1 deletion util/2mass_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
import sys
from optparse import OptionParser

import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from numpy import *

from astrometry.util.fits import *
Expand Down
28 changes: 21 additions & 7 deletions util/fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ class NoPyfits(object):
pyfits = NoPyfits()
except:
try:
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
except:
pyfits = NoPyfits()
import numpy as np
Expand Down Expand Up @@ -686,17 +692,25 @@ def fits_table(dataorfn=None, rows=None, hdunum=1, hdu=None, ext=None,
# in a try/catch in case pyfits isn't available
isrecarray = (type(data) == pyfits.core.FITS_rec)
except:
import traceback
traceback.print_exc()
pass
if not isrecarray:
try:
import pyfits.fitsrec
isrecarray = (type(data) == pyfits.fitsrec.FITS_rec)
from astropy.io import fits as pyfits
isrecarray = (type(data) == pyfits.core.FITS_rec)
except:
import traceback
traceback.print_exc()
pass
if not isrecarray:
try:
import pyfits.fitsrec
isrecarray = (type(data) == pyfits.fitsrec.FITS_rec)
except:
try:
from astropy.io import fits as pyfits
isrecarray = (type(data) == pyfits.fitsrec.FITS_rec)
except:
import traceback
traceback.print_exc()
pass
#if not isrecarray:
# if type(data) == np.recarray:
# isrecarray = True
Expand Down
16 changes: 14 additions & 2 deletions util/fits2fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,21 @@
# of the path: astrometry to pick up pyfits, and .. to pick up astrometry itself.
sys.path.insert(1, andir)
sys.path.insert(2, rootdir)
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")

import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from astrometry.util.fits import pyfits_writeto

def fits2fits(infile, outfile, verbose=False, fix_idr=False):
Expand Down
8 changes: 7 additions & 1 deletion util/fix_sdss_idr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import sys
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
import numpy

from astrometry.util.fits import pyfits_writeto
Expand Down
8 changes: 7 additions & 1 deletion util/hpimage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import sys

from pylab import *
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from numpy import *

from astrometry.util.healpix import *
Expand Down
8 changes: 7 additions & 1 deletion util/matchfile_to_wcs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from optparse import OptionParser
from astrometry.util.fits import *

Expand Down
8 changes: 7 additions & 1 deletion util/removelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
addpath.addpath()

import numpy
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from numpy import *
from numpy.random import rand
from astrometry.util.fits import pyfits_writeto
Expand Down
8 changes: 7 additions & 1 deletion util/removelines_general.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#! /usr/bin/env python

import sys
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")

from math import *
from numpy import *
Expand Down
18 changes: 16 additions & 2 deletions util/removelines_rotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@

if __name__ == '__main__':
try:
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError(
"Cannot import either pyfits or astropy.io.fits"
)
import astrometry
from astrometry.util.shell import shell_escape
from astrometry.util.filetype import filetype_short
Expand All @@ -33,7 +41,13 @@
sys.path.insert(2, rootdir)

import numpy
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from numpy import *
from numpy.random import rand

Expand Down
8 changes: 7 additions & 1 deletion util/sdss_astrom.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

from astrometry.util.fits import *
from numpy import *
import pyfits
try:
import pyfits
except ImportError:
try:
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("Cannot import either pyfits or astropy.io.fits")
from glob import glob

def tsfield_get_node_incl(tsfield):
Expand Down
Loading

0 comments on commit 2306dd1

Please sign in to comment.