Exemplo n.º 1
0
    def test_queue_max_size(self):
        q = methods.Queue(maxsize=1)
        self.assertEqual(0, q.qsize())
        q.put_nowait("1")
        self.assertEqual(1, q.qsize())
        with self.assertRaises(Queue.Full):
            q.put_nowait("1")
        self.assertEqual(1, q.qsize())

        # Pause to allow queue to complete operation before terminating
        # Otherwise sometimes results in 'IOError: [Errno 32] Broken pipe'
        time.sleep(0.1)
Exemplo n.º 2
0
description = """
This module uses a local build of the Astrometry.net software in order to
compute the astrometric solution of the input FITS files, saving the new files,
containing the WCS header, to the output directory. This is, in essence, a mere
simple interface to solve-field, Astrometry.net's command-line high-level user
interface, which must be present in PATH. Keep in mind that for Astrometry.net
to work it is also necessary to download the index files.

"""

ASTROMETRY_COMMAND = 'solve-field'

# The Queue is global -- this works, but note that we could have
# passed its reference to the function managed by pool.map_async.
# See http://stackoverflow.com/a/3217427/184363
queue = methods.Queue()

class AstrometryNetNotInstalled(StandardError):
    """ Raised if Astrometry.net is not installed on the system """
    pass

class AstrometryNetError(subprocess.CalledProcessError):
    """ Raised if the execution of Astrometry.net fails """
    pass

class AstrometryNetUnsolvedField(subprocess.CalledProcessError):
    """ Raised if Astrometry.net could not solve the field """

    def __init__(self, path):
        self.path = path
Exemplo n.º 3
0
 def test_queue_min_size(self):
     q = methods.Queue()
     self.assertEqual(q.qsize(), 0)
     with self.assertRaises(Queue.Empty):
         q.get_nowait()
     self.assertEqual(q.qsize(), 0)