def read(filename,**kwargs):
    """ Read a generic input file into a recarray.
    Accepted file formats: [.fits,.fz,.npy,.csv,.txt,.dat]
    
    Parameters:
    filename : input file name
    kwargs   : keyword arguments for the reader
    Returns:
    recarray : data array
    """
    base,ext = os.path.splitext(filename)
    if ext in ('.fits','.fz'):
        # Abstract fits here...
        return fitsio.read(filename,**kwargs)
    elif ext in ('.npy'):
        return np.load(filename,**kwargs)
    elif ext in ('.csv'):
        return np.recfromcsv(filename,**kwargs)
    elif ext in ('.txt','.dat'):
        return np.genfromtxt(filename,**kwargs)

    msg = "Unrecognized file type: %s"%filename
    raise ValueError(msg)
Read a generic input file into a recarray.
    Accepted file formats: [.fits,.fz,.npy,.csv,.txt,.dat]
    
    Parameters:
    filename : input file name
    kwargs   : keyword arguments for the reader
    Returns:
    recarray : data array