示例#1
0
    def test_origins(self, plateifu, origin, dir3d):
        im = Image(plateifu)
        assert im.plateifu == plateifu
        assert im.data_origin == origin

        if not check_versions(im._drpver, 'v2_5_3'):
            assert dir3d in im._getFullPath()
示例#2
0
文件: images.py 项目: zpace/marvin
def show_image(input, **kwargs):
    ''' Shows a Marvin Image

    This is a thin wrapper for :func:`marvin.tools.image.Image.show`
    See :class:`marvin.tools.image.Image` for a full list of
    inputs and keywords.  This is meant to replace showImage

    '''
    from marvin.tools.image import Image
    image = Image(input, **kwargs)
    image.show()
示例#3
0
文件: images.py 项目: zpace/marvin
def get_random_images(num, release=None, download=None):
    ''' Get a random set of Images

    Gets a random set of Marvin Images.  Optionally can download them
    in bulk.

    Parameters:
        num (int):
            The number of random images to grab
        download (bool):
            If True, also downloads all the images locally
        release (str):
            The release of the data to grab images for

    Returns:
        A list of Marvin Images

    '''

    from marvin.tools.image import Image

    images = Image.get_random(num=num, release=release)

    if download:
        _download_images(images, label='by_random')

    return images
示例#4
0
文件: images.py 项目: zpace/marvin
def get_images_by_list(inputlist, release=None, download=None):
    ''' Get Images by List

    Gets Marvin Images by an input list.  Optionally can download them
    in bulk.

    Parameters:
        inputlist (int):
            The list of ids to grab images for
        download (bool):
            If True, also downloads all the images locally
        release (str):
            The release of the data to grab images for

    Returns:
        A list of Marvin Images

    '''

    from marvin.tools.image import Image
    assert isinstance(inputlist, (list, np.ndarray)), 'Input must be of type list or Numpy array'

    images = Image.from_list(inputlist, release=release)

    if download:
        _download_images(images, label='by_list')

    return images
示例#5
0
文件: images.py 项目: zpace/marvin
def get_images_by_plate(plateid, download=None, release=None):
    ''' Get Images by Plate

    Gets Marvin Images by a plate id.  Optionally can download them
    in bulk.

    Parameters:
        plateid (int):
            The plate id to grab images for
        download (bool):
            If True, also downloads all the images locally
        release (str):
            The release of the data to grab images for

    Returns:
        A list of Marvin Images

    '''

    from marvin.tools.image import Image
    assert str(plateid).isdigit(), 'Plateid must be a numeric integer value'

    images = Image.by_plate(plateid, release=release)

    if download:
        _download_images(images, label='by_plate')

    return images
示例#6
0
    def get_mass_images(self, return_images=True, barred=True, jbh=False):
        """
        Get images of Mass based MWAs

        Parameters
        ----------

        return_images: 'bool', optional, must be keyword
            if True, returns images
            if False, adds images to class
        jbh: 'bool', optional, must be keyword
            if True, uses JBH Stellarr Mass estimate
        barred: 'bool', optional, must be keyword
            if True, returns barred galaxies only
            if False, returns non-barred galaxies only
        """
        if jbh:
            if barred:
                images = Image.from_list(self.mass_jbh_mwa_dap["PLATEIFU"])
                if return_images:
                    return images
                else:
                    self.mass_jbh_mwa_images = images
            else:
                images = Image.from_list(
                    self.mass_jbh_mwa_nobar_dap["PLATEIFU"])
                if return_images:
                    return images
                else:
                    self.mass_jbh_mwa_nobar_images = images
        else:
            if barred:
                images = Image.from_list(self.mass_mwa_dap["PLATEIFU"])
                if return_images:
                    return images
                else:
                    self.mass_mwa_images = images
            else:
                images = Image.from_list(self.mass_mwa_nobar_dap["PLATEIFU"])
                if return_images:
                    return images
                else:
                    self.mass_mwa_nobar_images = images
示例#7
0
文件: test_image.py 项目: rgcl/marvin
 def test_attributes(self, plateifu, release):
     im = Image(plateifu, release=release)
     if release == 'MPL-4':
         assert im.wcs is None
         assert im.header is None
         assert im.ra is None
         assert not hasattr(im, 'bundle')
     else:
         assert im.wcs is not None
         assert im.header is not None
         assert im.ra is not None
         assert hasattr(im, 'bundle')
示例#8
0
    def test_imversion(self):
        im = Image('8485-1901', release='MPL-7')
        fp = im._getFullPath()
        assert 'stack' in fp

        im = Image('8485-1901', release='MPL-9')
        fp = im._getFullPath()
        assert 'stack' not in fp
示例#9
0
文件: test_image.py 项目: rgcl/marvin
 def test_fromlist(self):
     plateifu = ['8485-1901', '7443-12701']
     images = Image.from_list(plateifu)
     names = [im.plateifu for im in images]
     assert plateifu == names
示例#10
0
文件: test_image.py 项目: rgcl/marvin
 def test_release(self, plateifu):
     im = Image(plateifu, release='MPL-5')
     assert im.release == 'MPL-5'
示例#11
0
文件: test_image.py 项目: rgcl/marvin
 def test_origins(self, plateifu, origin, dir3d):
     im = Image(plateifu)
     assert im.plateifu == plateifu
     assert im.data_origin == origin
     assert dir3d in im._getFullPath()
示例#12
0
文件: test_image.py 项目: rgcl/marvin
def image():
    im = Image('8485-1901')
    yield im
    im = None
示例#13
0
文件: test_image.py 项目: rgcl/marvin
 def test_byplate(self):
     images = Image.by_plate(8485)
     assert isinstance(images, list)
     assert images[0].plate == 8485
示例#14
0
文件: test_image.py 项目: rgcl/marvin
 def test_getrandom(self):
     images = Image.get_random(2)
     assert len(images) == 2