def order_data(data, torder):
    # determine the shape of the on disk data matrix
    ntraces = reduce(lambda x, y: x * y, data.shape[:-1])
    nshape = (ntraces, data.shape[-1])

    # take care of flat files
    if torder == 'flat' or torder == 'f':
        return data.reshape(nshape)

    # make an emprt array to hold the 2D disk formated data matrix
    ndata = np.empty(nshape, dtype=data.dtype)

    # index2tuple converter
    t2i = torder2t2i(torder)

    # loop over all non-direct dimension indices
    for ntrace in range(ntraces):
        tup = t2i(data.shape[:-1], ntrace)
        ndata[ntrace] = data[tup]
    return ndata


#######################
# fid reading/writing #
#######################
Fails if the string `str1` does not start with the string `str2`.
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/fileio/varian.py/order_data--crossover with--dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/BuiltIn.py/_Verify.should_start_with