seiya/cube/cube.py
def manga_rss_to_cube(rss):
    """Creates a datacube from a MaNGA RSS file.

    This is a wrapper around `.cubify` for convenience when using MaNGA
    RSS files. The resulting datacubes have the same shape as a MaNGA cube.

    Parameters
    ----------
    rss : `str` or `astropy.io.fits.HDUList`
        The path to the MaNGA RSS file to use to construct the cube, or an
        `~astropy.io.fits.HDUList` with the same format.

    """

    if isinstance(rss, str):
        rss = astropy.io.fits.open(rss)
    else:
        assert isinstance(rss, astropy.io.fits.HDUList), 'invalid type for rss.'

    flux = rss['FLUX'].data
    ivar = rss['IVAR'].data
    xpos = rss['XPOS'].data
    ypos = rss['YPOS'].data

    # cubify requires that the endianness of the data and the compile match.
    # We check that they are the same here and if not modify the arrays.
    if ((sys.byteorder == 'little' and flux.dtype.byteorder == '>') or
            (sys.byteorder == 'big' and flux.dtype.byteorder == '<')):

        log.warning('changing endianness for input data.', UserWarning)

        flux = flux.byteswap().newbyteorder()
        ivar = ivar.byteswap().newbyteorder()
        xpos = xpos.byteswap().newbyteorder()
        ypos = ypos.byteswap().newbyteorder()

    ifudesign = rss[0].header['IFUDSGN']
    ifusize = int(str(ifudesign)[0:-2])

    if ifusize == 19:
        cube_shape = (34, 34)
    elif ifusize == 127:
        cube_shape = (72, 72)
    else:
        # Fill other sizes later
        raise ValueError(f'ifusize {ifusize} not yet implemented.')

    return cubify(flux, ivar, xpos, ypos, cube_shape)
Creates a datacube from a MaNGA RSS file.

    This is a wrapper around `.cubify` for convenience when using MaNGA
    RSS files. The resulting datacubes have the same shape as a MaNGA cube.

    Parameters
    ----------
    rss : `str` or `astropy.io.fits.HDUList`
        The path to the MaNGA RSS file to use to construct the cube, or an
        `~astropy.io.fits.HDUList` with the same format.

    
Creates a datacube from a MaNGA RSS file.
This is a wrapper around `.cubify` for convenience when using MaNGA
RSS files. The resulting datacubes have the same shape as a MaNGA cube.

Parameters


Creates a datacube from a MaNGA RSS file . This is a wrapper around ` . cubify ` for convenience when using MaNGA RSS files . The resulting datacubes have the same shape as a MaNGA cube . Parameters
def manga_rss_to_cube(rss):
    if isinstance(rss, str):
        rss = astropy.io.fits.open(rss)
    else:
        assert isinstance(rss, astropy.io.fits.HDUList), 'invalid type for rss.'
    flux = rss['FLUX'].data
    ivar = rss['IVAR'].data
    xpos = rss['XPOS'].data
    ypos = rss['YPOS'].data
    if ((sys.byteorder == 'little' and flux.dtype.byteorder == '>') or
            (sys.byteorder == 'big' and flux.dtype.byteorder == '<')):
        log.warning('changing endianness for input data.', UserWarning)
        flux = flux.byteswap().newbyteorder()
        ivar = ivar.byteswap().newbyteorder()
        xpos = xpos.byteswap().newbyteorder()
        ypos = ypos.byteswap().newbyteorder()
    ifudesign = rss[0].header['IFUDSGN']
    ifusize = int(str(ifudesign)[0:-2])
    if ifusize == 19:
        cube_shape = (34, 34)
    elif ifusize == 127:
        cube_shape = (72, 72)
    else:
        raise ValueError(f'ifusize {ifusize} not yet implemented.')
    return cubify(flux, ivar, xpos, ypos, cube_shape)
def manga_rss_to_cube ( rss ) : if isinstance ( rss , str ) : rss = astropy . io . fits . open ( rss ) else : assert isinstance ( rss , astropy . io . fits . HDUList ) , 'invalid type for rss.' flux = rss [ 'FLUX' ] . data ivar = rss [ 'IVAR' ] . data xpos = rss [ 'XPOS' ] . data ypos = rss [ 'YPOS' ] . data if ( ( sys . byteorder == 'little' and flux . dtype . byteorder == '>' ) or ( sys . byteorder == 'big' and flux . dtype . byteorder == '<' ) ) : log . warning ( 'changing endianness for input data.' , UserWarning ) flux = flux . byteswap ( ) . newbyteorder ( ) ivar = ivar . byteswap ( ) . newbyteorder ( ) xpos = xpos . byteswap ( ) . newbyteorder ( ) ypos = ypos . byteswap ( ) . newbyteorder ( ) ifudesign = rss [ 0 ] . header [ 'IFUDSGN' ] ifusize = int ( str ( ifudesign ) [ 0 : - 2 ] ) if ifusize == 19 : cube_shape = ( 34 , 34 ) elif ifusize == 127 : cube_shape = ( 72 , 72 ) else : raise ValueError ( f'ifusize {ifusize} not yet implemented.' ) return cubify ( flux , ivar , xpos , ypos , cube_shape )
Creates a datacube from a MaNGA RSS file.
Creates a datacube from a MaNGA RSS file .
"""Creates a datacube from a MaNGA RSS file.

    This is a wrapper around `.cubify` for convenience when using MaNGA
    RSS files. The resulting datacubes have the same shape as a MaNGA cube.

    Parameters
    ----------
    rss : `str` or `astropy.io.fits.HDUList`
        The path to the MaNGA RSS file to use to construct the cube, or an
        `~astropy.io.fits.HDUList` with the same format.

    """ # cubify requires that the endianness of the data and the compile match. # We check that they are the same here and if not modify the arrays. # Fill other sizes later
rss