def remix(Cs, As): """ Mixing and dealing the complexes. The types of Cs and As are very important.... """ from mystic.tools import flatten_array q = len(Cs) c2, a2 = list(flatten_array(Cs,1)), list(flatten_array(As,1)) a,b = sort_ab_with_b(c2,a2) C2 = sequential_deal(a, q) A2 = [xx.tolist() for xx in sequential_deal(b, q)] return C2, A2
try: xrange except NameError: xrange = range Sk = [ [Cs[i][0]] for i in xrange(q) ] Sak = [ [As[i][0]] for i in xrange(q) ] for iter in xrange(5): # this is parallel print("iteration: %s" % str(iter+1)) for chain in xrange(q): for i in xrange(1000): scem(Cs[chain], As[chain], Sk[chain], Sak[chain], target, 0.1) # need to gather and remix Cs , As = remix(Cs, As) from mystic.tools import flatten_array Sk = [a[100:] for a in Sk] # throw away the first 100 pts of each chain sk = flatten_array(Sk,1) #print("length of sk: %s" % len(sk)) import matplotlib.pyplot as plt plt.plot(sk[:,0],sk[:,1],'r.') plt.show() # end of file
try: xrange except NameError: xrange = range Sk = [ [Cs[i][0]] for i in xrange(q) ] Sak = [ [As[i][0]] for i in xrange(q) ] for iter in xrange(5): # this is parallel print("iteration: %s" % str(iter+1)) for chain in xrange(q): for i in xrange(1000): scem(Cs[chain], As[chain], Sk[chain], Sak[chain], target, 0.1) # need to gather and remix Cs , As = remix(Cs, As) from mystic.tools import flatten_array Sk = [a[100:] for a in Sk] # throw away the first 100 pts of each chain sk = flatten_array(Sk,1) #print("length of sk: %s" % len(sk)) import pylab pylab.plot(sk[:,0],sk[:,1],'r.') pylab.show() # end of file