def generative_model(s,x,y,z,r, factor=<NUM_LIT>):
pl.close('<STR_LIT:all>')<EOL>slicez = int(round(z.mean()))<EOL>slicex = s.image.shape[<NUM_LIT:2>]//<NUM_LIT:2><EOL>slicer1 = np.s_[slicez,s.pad:-s.pad,s.pad:-s.pad]<EOL>slicer2 = np.s_[s.pad:-s.pad,s.pad:-s.pad,slicex]<EOL>center = (slicez, s.image.shape[<NUM_LIT:1>]//<NUM_LIT:2>, slicex)<EOL>fig = pl.figure(figsize=(factor*<NUM_LIT>,factor*<NUM_LIT:10>))<EOL>gs1 = ImageGrid(fig, rect=[<NUM_LIT:0.0>, <NUM_LIT>, <NUM_LIT:1.0>, <NUM_LIT>], nrows_ncols=(<NUM_LIT:1>,<NUM_LIT:3>),<EOL>axes_pad=<NUM_LIT:0.1>)<EOL>ax_real = gs1[<NUM_LIT:0>]<EOL>ax_fake = gs1[<NUM_LIT:1>]<EOL>ax_diff = gs1[<NUM_LIT:2>]<EOL>diff = s.get_model_image() - s.image<EOL>ax_real.imshow(s.image[slicer1], cmap=pl.cm.bone_r)<EOL>ax_real.set_xticks([])<EOL>ax_real.set_yticks([])<EOL>ax_real.set_title("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>ax_fake.imshow(s.get_model_image()[slicer1], cmap=pl.cm.bone_r)<EOL>ax_fake.set_xticks([])<EOL>ax_fake.set_yticks([])<EOL>ax_fake.set_title("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>ax_diff.imshow(diff[slicer1], cmap=pl.cm.RdBu, vmin=-<NUM_LIT:0.1>, vmax=<NUM_LIT:0.1>)<EOL>ax_diff.set_xticks([])<EOL>ax_diff.set_yticks([])<EOL>ax_diff.set_title("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>gs2 = ImageGrid(fig, rect=[<NUM_LIT:0.1>, <NUM_LIT:0.0>, <NUM_LIT>, <NUM_LIT>], nrows_ncols=(<NUM_LIT:3>,<NUM_LIT:2>),<EOL>axes_pad=<NUM_LIT:0.1>)<EOL>ax_plt1 = fig.add_subplot(gs2[<NUM_LIT:0>])<EOL>ax_plt2 = fig.add_subplot(gs2[<NUM_LIT:1>])<EOL>ax_ilm1 = fig.add_subplot(gs2[<NUM_LIT:2>])<EOL>ax_ilm2 = fig.add_subplot(gs2[<NUM_LIT:3>])<EOL>ax_psf1 = fig.add_subplot(gs2[<NUM_LIT:4>])<EOL>ax_psf2 = fig.add_subplot(gs2[<NUM_LIT:5>])<EOL>c = int(z.mean()), int(y.mean())+s.pad, int(x.mean())+s.pad<EOL>if s.image.shape[<NUM_LIT:0>] > <NUM_LIT:2>*s.image.shape[<NUM_LIT:1>]//<NUM_LIT:3>:<EOL><INDENT>w = s.image.shape[<NUM_LIT:2>] - <NUM_LIT:2>*s.pad<EOL>h = <NUM_LIT:2>*w//<NUM_LIT:3><EOL><DEDENT>else:<EOL><INDENT>h = s.image.shape[<NUM_LIT:0>] - <NUM_LIT:2>*s.pad<EOL>w = <NUM_LIT:3>*h//<NUM_LIT:2><EOL><DEDENT>w,h = w//<NUM_LIT:2>, h//<NUM_LIT:2><EOL>xyslice = np.s_[slicez, c[<NUM_LIT:1>]-h:c[<NUM_LIT:1>]+h, c[<NUM_LIT:2>]-w:c[<NUM_LIT:2>]+w]<EOL>yzslice = np.s_[c[<NUM_LIT:0>]-h:c[<NUM_LIT:0>]+h, c[<NUM_LIT:1>]-w:c[<NUM_LIT:1>]+w, slicex]<EOL>ax_plt1.imshow(<NUM_LIT:1>-s.obj.get_field()[xyslice], cmap=pl.cm.bone_r, vmin=<NUM_LIT:0>, vmax=<NUM_LIT:1>)<EOL>ax_plt1.set_xticks([])<EOL>ax_plt1.set_yticks([])<EOL>ax_plt1.set_ylabel("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>ax_plt1.set_title("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>ax_plt2.imshow(<NUM_LIT:1>-s._platonic_image()[yzslice], cmap=pl.cm.bone_r, vmin=<NUM_LIT:0>, vmax=<NUM_LIT:1>)<EOL>ax_plt2.set_xticks([])<EOL>ax_plt2.set_yticks([])<EOL>ax_plt2.set_title("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>ax_ilm1.imshow(s.ilm.get_field()[xyslice], cmap=pl.cm.bone_r)<EOL>ax_ilm1.set_xticks([])<EOL>ax_ilm1.set_yticks([])<EOL>ax_ilm1.set_ylabel("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>ax_ilm2.imshow(s.ilm.get_field()[yzslice], cmap=pl.cm.bone_r)<EOL>ax_ilm2.set_xticks([])<EOL>ax_ilm2.set_yticks([])<EOL>t = s.ilm.get_field().copy()<EOL>t *= <NUM_LIT:0><EOL>t[c] = <NUM_LIT:1><EOL>s.psf.set_tile(util.Tile(t.shape))<EOL>psf = (s.psf.execute(t)+<NUM_LIT>)**<NUM_LIT:0.1><EOL>ax_psf1.imshow(psf[xyslice], cmap=pl.cm.bone)<EOL>ax_psf1.set_xticks([])<EOL>ax_psf1.set_yticks([])<EOL>ax_psf1.set_ylabel("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>ax_psf2.imshow(psf[yzslice], cmap=pl.cm.bone)<EOL>ax_psf2.set_xticks([])<EOL>ax_psf2.set_yticks([])<EOL>ax_zoom = fig.add_axes([<NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>])<EOL>im = s.image[slicer1]<EOL>sh = np.array(im.shape)<EOL>cx = x.mean()<EOL>cy = y.mean()<EOL>extent = [<NUM_LIT:0>,sh[<NUM_LIT:0>],<NUM_LIT:0>,sh[<NUM_LIT:1>]]<EOL>ax_zoom.set_xticks([])<EOL>ax_zoom.set_yticks([])<EOL>ax_zoom.imshow(im, extent=extent, cmap=pl.cm.bone_r)<EOL>ax_zoom.set_xlim(cx-<NUM_LIT:12>, cx+<NUM_LIT:12>)<EOL>ax_zoom.set_ylim(cy-<NUM_LIT:12>, cy+<NUM_LIT:12>)<EOL>ax_zoom.set_title("<STR_LIT>", fontsize=<NUM_LIT>)<EOL>ax_zoom.hexbin(x,y, gridsize=<NUM_LIT:32>, mincnt=<NUM_LIT:0>, cmap=pl.cm.hot)<EOL>zoom1 = zoomed_inset_axes(ax_zoom, <NUM_LIT:30>, loc=<NUM_LIT:3>)<EOL>zoom1.imshow(im, extent=extent, cmap=pl.cm.bone_r)<EOL>zoom1.set_xlim(cx-<NUM_LIT:1.0>/<NUM_LIT:6>, cx+<NUM_LIT:1.0>/<NUM_LIT:6>)<EOL>zoom1.set_ylim(cy-<NUM_LIT:1.0>/<NUM_LIT:6>, cy+<NUM_LIT:1.0>/<NUM_LIT:6>)<EOL>zoom1.hexbin(x,y,gridsize=<NUM_LIT:32>, mincnt=<NUM_LIT:5>, cmap=pl.cm.hot)<EOL>zoom1.set_xticks([])<EOL>zoom1.set_yticks([])<EOL>zoom1.hlines(cy-<NUM_LIT:1.0>/<NUM_LIT:6> + <NUM_LIT:1.0>/<NUM_LIT:32>, cx-<NUM_LIT:1.0>/<NUM_LIT:6>+<NUM_LIT>, cx-<NUM_LIT:1.0>/<NUM_LIT:6>+<NUM_LIT>+<NUM_LIT>, lw=<NUM_LIT:3>)<EOL>zoom1.text(cx-<NUM_LIT:1.0>/<NUM_LIT:6> + <NUM_LIT:1.0>/<NUM_LIT>, cy-<NUM_LIT:1.0>/<NUM_LIT:6>+<NUM_LIT>, '<STR_LIT>')<EOL>mark_inset(ax_zoom, zoom1, loc1=<NUM_LIT:2>, loc2=<NUM_LIT:4>, fc="<STR_LIT:none>", ec="<STR_LIT>")<EOL>
Samples x,y,z,r are created by:
b = s.blocks_particle(#)
h = runner.sample_state(s, b, stepout=0.05, N=2000, doprint=True)
z,y,x,r = h.get_histogram().T