|
51 | 51 | "\n", |
52 | 52 | "# Load the projection data\n", |
53 | 53 | "path_lib = os.path.dirname(httomolibgpu.__file__)\n", |
54 | | - "in_file = os.path.abspath(os.path.join(path_lib, '..', \"tests/test_data/\",'tomo_standard.npz'))\n", |
| 54 | + "in_file = os.path.abspath(\n", |
| 55 | + " os.path.join(path_lib, \"..\", \"tests/test_data/\", \"tomo_standard.npz\")\n", |
| 56 | + ")\n", |
55 | 57 | "datafile = np.load(in_file)\n", |
56 | | - "host_data = datafile['data']\n", |
57 | | - "host_flats = datafile['flats']\n", |
58 | | - "host_darks = datafile['darks']\n", |
| 58 | + "host_data = datafile[\"data\"]\n", |
| 59 | + "host_flats = datafile[\"flats\"]\n", |
| 60 | + "host_darks = datafile[\"darks\"]\n", |
59 | 61 | "\n", |
60 | | - "print(\"The shape of the data is {} as (projections, detector Y, detector X)\".format(np.shape(host_data)))\n", |
| 62 | + "print(\n", |
| 63 | + " \"The shape of the data is {} as (projections, detector Y, detector X)\".format(\n", |
| 64 | + " np.shape(host_data)\n", |
| 65 | + " )\n", |
| 66 | + ")\n", |
61 | 67 | "\n", |
62 | 68 | "print(\"Normalising the data\")\n", |
63 | 69 | "data = cp.asarray(host_data)\n", |
64 | 70 | "flats = cp.asarray(host_flats)\n", |
65 | 71 | "darks = cp.asarray(host_darks)\n", |
66 | | - "data_normalised = normalize(data, flats, darks, cutoff = 10, minus_log = False)\n", |
| 72 | + "data_normalised = normalize(data, flats, darks, cutoff=10, minus_log=False)\n", |
67 | 73 | "\n", |
68 | 74 | "sliceSel = 64\n", |
69 | 75 | "data_normalised_np = data_normalised.get()\n", |
|
100 | 106 | "source": [ |
101 | 107 | "from httomolibgpu.recon.rotation import find_center_vo\n", |
102 | 108 | "\n", |
103 | | - "print (\"Finding the Center of Rotation for the reconstruction\")\n", |
| 109 | + "print(\"Finding the Center of Rotation for the reconstruction\")\n", |
104 | 110 | "cor = find_center_vo(data_normalised, ind=64)\n", |
105 | 111 | "print(\"The found Center of Rotation is {}\".format(cor))" |
106 | 112 | ] |
|
131 | 137 | "source": [ |
132 | 138 | "from httomolibgpu.prep.phase import paganin_filter_tomopy\n", |
133 | 139 | "\n", |
134 | | - "print (\"Applying Paganin filter\")\n", |
135 | | - "phase_contrast_data = paganin_filter_tomopy(data_normalised, pixel_size=0.1, dist=50, energy=53, alpha=1e-5)\n", |
| 140 | + "print(\"Applying Paganin filter\")\n", |
| 141 | + "phase_contrast_data = paganin_filter_tomopy(\n", |
| 142 | + " data_normalised, pixel_size=0.1, dist=50, energy=53, alpha=1e-5\n", |
| 143 | + ")\n", |
136 | 144 | "\n", |
137 | 145 | "sliceSel = 64\n", |
138 | 146 | "phase_contrast_data_np = phase_contrast_data.get()\n", |
|
176 | 184 | } |
177 | 185 | ], |
178 | 186 | "source": [ |
179 | | - "print (\"Perform Reconstruction using FBP\")\n", |
| 187 | + "print(\"Perform Reconstruction using FBP\")\n", |
180 | 188 | "\n", |
181 | 189 | "from httomolibgpu.recon.algorithm import FBP\n", |
182 | 190 | "\n", |
183 | 191 | "angles = np.linspace(0.0 * np.pi / 180.0, 180.0 * np.pi / 180.0, data.shape[0])\n", |
184 | | - " \n", |
| 192 | + "\n", |
185 | 193 | "reconFBP = FBP(phase_contrast_data, angles=angles, center=cor)\n", |
186 | 194 | "\n", |
187 | 195 | "reconFBP_np = reconFBP.get()\n", |
|
226 | 234 | } |
227 | 235 | ], |
228 | 236 | "source": [ |
229 | | - "print (\"Perform Reconstruction using Fourier (LPRec)\")\n", |
| 237 | + "print(\"Perform Reconstruction using Fourier (LPRec)\")\n", |
230 | 238 | "\n", |
231 | 239 | "from httomolibgpu.recon.algorithm import LPRec\n", |
232 | 240 | "\n", |
233 | 241 | "angles = np.linspace(0.0 * np.pi / 180.0, 180.0 * np.pi / 180.0, data.shape[0])\n", |
234 | | - " \n", |
| 242 | + "\n", |
235 | 243 | "reconLPRec = LPRec(phase_contrast_data, angles=angles, center=cor)\n", |
236 | 244 | "\n", |
237 | 245 | "reconLPRec_np = reconLPRec.get()\n", |
|
0 commit comments