def load_zip_data(zipname, f_sino_real, f_sino_imag,
                  f_angles=None, f_phantom=None, f_info=None):
    """Load example sinogram data from a .zip file"""
    ret = []
    with zipfile.ZipFile(str(zipname)) as arc:
        sino_real = np.loadtxt(arc.open(f_sino_real))
        sino_imag = np.loadtxt(arc.open(f_sino_imag))
        sino = sino_real + 1j * sino_imag
        ret.append(sino)
        if f_angles:
            angles = np.loadtxt(arc.open(f_angles))
            ret.append(angles)
        if f_phantom:
            phantom = np.loadtxt(arc.open(f_phantom))
            ret.append(phantom)
        if f_info:
            with arc.open(f_info) as info:
                cfg = {}
                for li in info.readlines():
                    li = li.decode()
                    if li.count("=") == 1:
                        key, val = li.split("=")
                        cfg[key.strip()] = float(val.strip())
            ret.append(cfg)
    return ret
Load example sinogram data from a .zip file