def load_tar_lzma_data(tlfile):
    """Load example sinogram data from a .tar.lzma file"""
    tmpname = extract_lzma(tlfile)

    # open tar file
    fields_real = []
    fields_imag = []
    phantom = []
    parms = {}

    with tarfile.open(tmpname, "r") as t:
        members = t.getmembers()
        members.sort(key=lambda x: x.name)

        for m in members:
            n = m.name
            f = t.extractfile(m)
            if n.startswith("fdtd_info"):
                for ln in f.readlines():
                    ln = ln.decode()
                    if ln.count("=") == 1:
                        key, val = ln.split("=")
                        parms[key.strip()] = float(val.strip())
            elif n.startswith("phantom"):
                phantom.append(np.loadtxt(f))
            elif n.startswith("field"):
                if n.endswith("imag.txt"):
                    fields_imag.append(np.loadtxt(f))
                elif n.endswith("real.txt"):
                    fields_real.append(np.loadtxt(f))

    try:
        os.remove(tmpname)
    except OSError:
        pass

    phantom = np.array(phantom)
    sino = np.array(fields_real) + 1j * np.array(fields_imag)
    angles = np.linspace(0, 2 * np.pi, sino.shape[0], endpoint=False)

    return sino, angles, phantom, parms
Load example sinogram data from a .tar.lzma file