import numpy as np from matplotlib import pyplot import sys sys.path.append("../") from synth import synth from synth import util import core import experiments N = 100 MAXPHASE = 10 # pb = synth.plane_box(N, 10, 1.0, 20) bk = np.random.normal(0.0, 1.0, size=(N, N)) pb = synth.sphere(N, 35, 2.0, MAXPHASE * np.pi, bk) # pb = synth.spirals(N=5, MAXPHASE=MAXPHASE*np.pi) # pb_wrapped = util.wrap_phase(pb).astype(np.float32) pb_wrapped = experiments.data.default(2) pyplot.ion() pb_wrapped.shape = (1, pb_wrapped.shape[0], pb_wrapped.shape[1]) temps = [100.0, 80.0, 60.0, 40.0, 30.0, 20.0, 10.0, 1.0] mrfs = core.pt.PT(pb_wrapped, MAXPHASE, temps) imdata = [] for ti in range(len(temps)): ax = pyplot.subplot(np.ceil(len(temps) / 4.0), 4, ti + 1) imresult = mrfs.chains[ti].latentPhase
import sys sys.path.append("../") import tables from synth import synth from synth import util import core import experiments outputTable = tables.openFile("output_noise.h5", 'w') N = 128 MAXPHASE = 5 #pb = synth.plane_box(N, 10, 1.0, 20) bk = np.random.normal(0.0, 1.0, size = (N, N)) * 1.5 pb = synth.sphere(N, 48, 2.0, MAXPHASE*np.pi) pb += bk t = outputTable.createArray("/", "truth", pb) t.attrs.maxphase = MAXPHASE #pb = synth.spirals(N=5, MAXPHASE=MAXPHASE*np.pi) pb_wrapped = util.wrap_phase(pb).astype(np.float32) #pb_wrapped = experiments.data.default(4) pyplot.ion() pb_wrapped.shape = (1, pb_wrapped.shape[0], pb_wrapped.shape[1]) t = outputTable.createArray("/", "data", pb_wrapped) temps = [40., 30., 25., 20., 15, 10., 5., 1.] mrfs = core.pt.PT(pb_wrapped, MAXPHASE, temps)