# Path: crowdastro/config.py
# SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
# def get(*args, **kwargs):
# 
# Path: crowdastro/exceptions.py
# class CatalogueError(Exception):
#     pass


import argparse
import csv
import hashlib
import logging
import os
import astropy.io.fits
import astropy.utils.exceptions
import astropy.wcs
import h5py
import numpy
import scipy.spatial.distance
import sklearn.neighbors
from astropy.coordinates import SkyCoord
from astropy.io import ascii
from .config import config
from .exceptions import CatalogueError
    from . import rgz_data as data
    from . import rgz_data as data
    from . import rgz_data as data
        # overlap.
        cache_key = tuple(tuple(b) for b in bbox)
        if cache_key in bbox_cache_:
            index = bbox_cache_[cache_key]
        else:
            x_gt_min = atlas_positions[:, 0] >= bbox[0, 0]
            x_lt_max = atlas_positions[:, 0] <= bbox[0, 1]
            y_gt_min = atlas_positions[:, 1] >= bbox[1, 0]
            y_lt_max = atlas_positions[:, 1] <= bbox[1, 1]
            within = numpy.all([x_gt_min, x_lt_max, y_gt_min, y_lt_max], axis=0)
            indices = numpy.where(within)[0]

            if len(indices) == 0:
                logging.debug('Skipping radio source not in catalogue for '
                              '%s', zooniverse_id)
                continue
            else:
                if len(indices) > 1:
                    logging.debug('Found multiple (%d) ATLAS matches '
                                  'for %s', len(indices), zooniverse_id)

                index = indices[0]

            bbox_cache_[cache_key] = index

        atlas_ids.append(str(index))

    atlas_ids.sort()

    if not atlas_ids:

# Path: crowdastro/config.py
# SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
# def get(*args, **kwargs):
# 
# Path: crowdastro/exceptions.py
# class CatalogueError(Exception):
#     pass


# Path: crowdastro/import_data.py
import argparse
import csv
import hashlib
import logging
import os
import astropy.io.fits
import astropy.utils.exceptions
import astropy.wcs
import h5py
import numpy
import scipy.spatial.distance
import sklearn.neighbors
from astropy.coordinates import SkyCoord
from astropy.io import ascii
from .config import config
from .exceptions import CatalogueError
    from . import rgz_data as data
    from . import rgz_data as data
    from . import rgz_data as data

        # overlap.
        cache_key = tuple(tuple(b) for b in bbox)
        if cache_key in bbox_cache_:
            index = bbox_cache_[cache_key]
        else:
            x_gt_min = atlas_positions[:, 0] >= bbox[0, 0]
            x_lt_max = atlas_positions[:, 0] <= bbox[0, 1]
            y_gt_min = atlas_positions[:, 1] >= bbox[1, 0]
            y_lt_max = atlas_positions[:, 1] <= bbox[1, 1]
            within = numpy.all([x_gt_min, x_lt_max, y_gt_min, y_lt_max], axis=0)
            indices = numpy.where(within)[0]

            if len(indices) == 0:
                logging.debug('Skipping radio source not in catalogue for '
                              '%s', zooniverse_id)
                continue
            else:
                if len(indices) > 1:
                    logging.debug('Found multiple (%d) ATLAS matches '
                                  'for %s', len(indices), zooniverse_id)

                index = indices[0]

            bbox_cache_[cache_key] = index

        atlas_ids.append(str(index))

    atlas_ids.sort()

    if not atlas_ids:

        raise CatalogueError('No catalogued radio sources.')