def __init__(self, filename, i2t_func, fshape=None, order=None):
        # read the file dictionary
        f = open(filename, 'rb')
        dic = fileheader2dic(get_fileheader(f))
        f.close()

        # check fshape
        if fshape is None:
            # by default open as 2D with nblocks,np/2 fshape
            fshape = (dic['nblocks'], int(dic["np"] / 2))
        else:
            # check that last dimension has np/2 points
            if fshape[-1] != int(dic["np"] / 2):
                s = "last dimension should have size %i" % (int(dic["np"] / 2))
                raise ValueError(s)
            # product of all but last dim should be number of blocks
            if reduce(lambda x, y: x * y, fshape[:-1]) != dic['nblocks']:
                s = "number of traces in file does not match fshape"
                raise ValueError(s)

        # check order
        if order is None:
            order = range(len(fshape))

        # finalize
        self.fdtype = find_dtype(dic)
        self.pts = dic["np"]
        self.nbh = dic["nbheaders"]
        self.bbytes = dic["bbytes"]
        self.dtype = find_cdtype(dic)
        self.filename = filename
        self.i2t = i2t_func
        self.fshape = fshape
        self.order = order
        self.__setdimandshape__()   # set ndim and shape attributes
Create and set up object.
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/fileio/varian.py/fid_nd.__init__