def rainbow_to_vector(r, timeformat='h'):
    " Convert Rainbow object to np.arrays\n    Parameters\n    ----------\n        r : Rainbow object\n            chromatic Rainbow object to convert into array format\n        timeformat : str\n            (optional, default='hours')\n            The time format to use (seconds, minutes, hours, days etc.)\n    Returns\n    ----------\n        rflux : np.array\n            flux (MJy/sr)        [n_wavelengths x n_integrations]\n        rfluxe : np.array\n            flux error (MJy/sr)  [n_wavelengths x n_integrations]\n        rtime : np.array\n            time (BJD_TDB, houra) [n_integrations]\n        rwavel : np.array\n            wavelength (microns) [n_wavelengths]\n    "
    secondformat = ['second', 'seconds', 'sec', 's']
    minuteformat = ['minute', 'minutes', 'min', 'm']
    hourformat = ['hour', 'hours', 'h']
    dayformat = ['day', 'days', 'd']
    yearformat = ['year', 'years', 'y']
    rflux = r.fluxlike['flux']
    rfluxe = r.fluxlike['uncertainty']
    rtime = r.timelike['time']
    rwavel = r.wavelike['wavelength']
    if (timeformat in secondformat):
        rtime = (rtime * 3600)
    elif (timeformat in minuteformat):
        rtime = (rtime * 60)
    elif (timeformat in hourformat):
        pass
    elif (timeformat in dayformat):
        rtime = (rtime / 24.0)
    elif (timeformat in yearformat):
        rtime = (rtime / (24 * 365.0))
    else:
        warnings.warn('Unrecognised Time Format!')
        return
    return (rflux, rfluxe, rtime, rwavel)
Convert Rainbow object to np.arrays
Parameters
----------
    r : Rainbow object
        chromatic Rainbow object to convert into array format
    timeformat : str
        (optional, default='hours')
        The time format to use (seconds, minutes, hours, days etc.)
Returns
----------
    rflux : np.array
        flux (MJy/sr)        [n_wavelengths x n_integrations]
    rfluxe : np.array
        flux error (MJy/sr)  [n_wavelengths x n_integrations]
    rtime : np.array
        time (BJD_TDB, houra) [n_integrations]
    rwavel : np.array
        wavelength (microns) [n_wavelengths]
def rainbow_to_vector(r, timeformat='h'):
    " Convert Rainbow object to np.arrays\n    Parameters\n    ----------\n        r : Rainbow object\n            chromatic Rainbow object to convert into array format\n        timeformat : str\n            (optional, default='hours')\n            The time format to use (seconds, minutes, hours, days etc.)\n    Returns\n    ----------\n        rflux : np.array\n            flux (MJy/sr)        [n_wavelengths x n_integrations]\n        rfluxe : np.array\n            flux error (MJy/sr)  [n_wavelengths x n_integrations]\n        rtime : np.array\n            time (BJD_TDB, houra) [n_integrations]\n        rwavel : np.array\n            wavelength (microns) [n_wavelengths]\n    "
    secondformat = ['second', 'seconds', 'sec', 's']
    minuteformat = ['minute', 'minutes', 'min', 'm']
    hourformat = ['hour', 'hours', 'h']
    dayformat = ['day', 'days', 'd']
    yearformat = ['year', 'years', 'y']
    rflux = r.fluxlike['flux']
    rfluxe = r.fluxlike['uncertainty']
    rtime = r.timelike['time']
    rwavel = r.wavelike['wavelength']
    if (timeformat in secondformat):
        rtime = (rtime * 3600)
    elif (timeformat in minuteformat):
        rtime = (rtime * 60)
    elif (timeformat in hourformat):
        pass
    elif (timeformat in dayformat):
        rtime = (rtime / 24.0)
    elif (timeformat in yearformat):
        rtime = (rtime / (24 * 365.0))
    else:
        warnings.warn('Unrecognised Time Format!')
        return
    return (rflux, rfluxe, rtime, rwavel)