Example #1
0
def load_ts(filepath, *args, **kwargs):
    """
    Parameters
    ----------
    f : string
        File name of .csv or .pickle spectrum.

    Returns
    -------
    TimeSpectra
    """

    filepath = op.join(data_dir, filepath)
    ext = op.splitext(filepath)[1]

    if ext == '.csv':
        return TimeSpectra.from_csv(filepath, *args, **kwargs)

    #  XXX INCOMPLETE FUNCTIONALITY
    elif ext == '.pickle':
        df = df_load(filepath)
        logger.critical("LOADING FROM PICKLE NOT COMPLETE YET")

    else:
        raise DataError('%s must have file extension .csv or .pickle, not '
                        '%s' % (filepath, ext))
Example #2
0
def load_ts(filepath, *args, **kwargs):
    """
    Parameters
    ----------
    f : string
        File name of .csv or .pickle spectrum.

    Returns
    -------
    TimeSpectra
    """
    
    filepath = op.join(data_dir, filepath)
    ext = op.splitext(filepath)[1]
    

    if ext == '.csv':
        return TimeSpectra.from_csv(filepath, *args, **kwargs)

    #  XXX INCOMPLETE FUNCTIONALITY
    elif ext == '.pickle':
        df = df_load(filepath)
        logger.critical("LOADING FROM PICKLE NOT COMPLETE YET")

    else:
        raise DataError('%s must have file extension .csv or .pickle, not '
                             '%s' %(filepath, ext))
Example #3
0
def get_csvdataframe(filename="spectra.csv", **csvargs):
    """ Takes in spectral data, either .pickle or .csv, returns dataframe.  Files must be in same path as
    called by get_exampledata.  If csv file, one can pass csvargs throught the **csvargs dictionary."""
    filepath = get_exampledata(filename, as_string=False)
    ext = os.path.splitext(filepath)[1]
    if ext == ".csv":
        return read_csv(filepath, **csvargs)
    elif ext == ".pickle":
        return df_load(filepath)
    else:
        raise AttributeError("%s must have file extension .csv or .pickle, not %s" % (filename, ext))
Example #4
0
def get_csvdataframe(filename='spectra.csv', **csvargs):
    ''' Takes in spectral data, either .pickle or .csv, returns dataframe.  
        Files must be in same path as  called by get_exampledata.  If csv file,
        one can pass csvargs throught the **csvargs dictionary.'''

    filepath=get_exampledata(filename, as_stream=False)
    ext=os.path.splitext(filepath)[1]

    if ext == '.csv':
        return read_csv(filepath, **csvargs)

    # Is this deprecated/useful?
    elif ext == '.pickle':
        return df_load(filepath)

    else:
        raise errors.GeneralError('%s must have file extension .csv or .pickle, not '
                             '%s' %(filename, ext))
Example #5
0
def get_csvdataframe(filename='spectra.csv', **csvargs):
    ''' Takes in spectral data, either .pickle or .csv, returns dataframe.  
        Files must be in same path as  called by get_exampledata.  If csv file,
        one can pass csvargs throught the **csvargs dictionary.'''

    filepath = get_exampledata(filename, as_stream=False)
    ext = os.path.splitext(filepath)[1]

    if ext == '.csv':
        return read_csv(filepath, **csvargs)

    # Is this deprecated/useful?
    elif ext == '.pickle':
        return df_load(filepath)

    else:
        raise errors.GeneralError(
            '%s must have file extension .csv or .pickle, not '
            '%s' % (filename, ext))