Example #1
0
def print_freqs():
	log = logarithmic()
	timeseries = np.linspace(0.,500.,2048)
	ntheta,nphi = 30,30
	for i in np.arange(4.,ntheta+1)/(ntheta+1):
		for j in .5*np.pi*np.arange(15.,nphi+1)/(nphi+1):
			# if(i>0.9 and j>np.pi*0.45):
			# if(j>np.pi/4.):
			# if(i>0.59 and j>np.pi/2.*0.9):
			print np.arccos(i),j
			st,ct = np.sin(np.arccos(i)),i
			sp,cp = np.sin(j),np.cos(j)
			combo = cp*cp*st*st+sp*sp*st*st/log.qy2+ct*ct/log.qz2
			r = np.sqrt((np.exp(1.)-0.1)/combo)
			initial = np.array([r*cp*st,r*sp*st,r*ct,0.0001,0.0001,0.0001])
			# initial = np.array([0.111937987197,0.0104758765442,1.12993449025,0.0001,0.0001,0.0001])
			results = odeint(pot.orbit_derivs2,initial,timeseries,args=(log,),rtol=1e-5,atol=1e-5)
			# print(log.H(initial),log.H(results[-1]))
			plots(timeseries,results)
			# freq = find_freqs(timeseries,results)
			L = find_actions(results, timeseries, N_matrix = 4, ifloop=True,ifprint = False)
			# if(L==None):
				# break
			(act,ang,n_vec,toy_aa,para),loop = L
			E = eval_mean_error_functions(act,ang,n_vec,toy_aa,timeseries,withplot=False)/np.std(timeseries)
			# ctas(ang,n_vec,toy_aa,timeseries)
			# print freq[0],freq[1],freq[2]
			print ang[3],ang[4],ang[5],initial[0],initial[1],initial[2],act[0],act[1],act[2] #,E[0],E[1],E[2],E[3],E[4],E[5] #,freq[0],freq[1],freq[2]
			exit()
Example #2
0
def print_freqs():
    log = logarithmic()
    timeseries = np.linspace(0., 500., 2048)
    ntheta, nphi = 30, 30
    for i in np.arange(4., ntheta + 1) / (ntheta + 1):
        for j in .5 * np.pi * np.arange(15., nphi + 1) / (nphi + 1):
            # if(i>0.9 and j>np.pi*0.45):
            # if(j>np.pi/4.):
            # if(i>0.59 and j>np.pi/2.*0.9):
            print np.arccos(i), j
            st, ct = np.sin(np.arccos(i)), i
            sp, cp = np.sin(j), np.cos(j)
            combo = cp * cp * st * st + sp * sp * st * st / log.qy2 + ct * ct / log.qz2
            r = np.sqrt((np.exp(1.) - 0.1) / combo)
            initial = np.array(
                [r * cp * st, r * sp * st, r * ct, 0.0001, 0.0001, 0.0001])
            # initial = np.array([0.111937987197,0.0104758765442,1.12993449025,0.0001,0.0001,0.0001])
            results = odeint(pot.orbit_derivs2,
                             initial,
                             timeseries,
                             args=(log, ),
                             rtol=1e-5,
                             atol=1e-5)
            # print(log.H(initial),log.H(results[-1]))
            plots(timeseries, results)
            # freq = find_freqs(timeseries,results)
            L = find_actions(results,
                             timeseries,
                             N_matrix=4,
                             ifloop=True,
                             ifprint=False)
            # if(L==None):
            # break
            (act, ang, n_vec, toy_aa, para), loop = L
            E = eval_mean_error_functions(
                act, ang, n_vec, toy_aa, timeseries,
                withplot=False) / np.std(timeseries)
            # ctas(ang,n_vec,toy_aa,timeseries)
            # print freq[0],freq[1],freq[2]
            print ang[3], ang[4], ang[5], initial[0], initial[1], initial[
                2], act[0], act[1], act[
                    2]  #,E[0],E[1],E[2],E[3],E[4],E[5] #,freq[0],freq[1],freq[2]
            exit()
Example #3
0
				print("Longer integration")
		# 	print(results.T[-1])
				L = find_actions(results, np.linspace(0.,len(results)/100.,len(results)), N_matrix = 6, ifloop=True,ifprint = False)
				# print(len(results))
			(act,ang,n_vec,toy_aa,para),loop = L
			print(len(results),loop)
			checks,maxgap = ced(n_vec,ua(toy_aa.T[3:].T,np.ones(3)))
			counter=counter+1
		# if(counter==10):
			# continue
		# print(ang)
		minfreq = np.min(np.abs(ang[3:6]))
		if(8.*2.*np.pi/minfreq>10.):
			print(i,px,pz,"Fewer than 8 fundamental periods")
		T = np.linspace(0.,len(results)/100.,len(results))
		errors = eval_mean_error_functions(act,ang,n_vec,toy_aa,T,withplot=False)/np.sqrt(len(T))
		print LM.H(initial),i,px,pz,act[0],act[1],act[2],' '.join(map(str, loop)),ang[3],ang[4],ang[5], errors[0],errors[1], LM.H(unrotate_coords(results[-1]))
		



		# check_angle_solution(ang,n_vec,toy_aa,timeseries)
		# plt.plot(toy_aa.T[3],toy_aa.T[4],'.')
		# plt.show()
		# plt.plot(toy_aa.T[3],toy_aa.T[5],'.')
		# plt.show()
		# plt.plot(results.T[0],results.T[1],'.');plt.show()
		# F = pot.orbit_integrate(initial,80.,LM)
		# results = np.array([rotate_coords(p) for p in F[0]])
		# print(len(results))
		# plt.plot(results.T[0],results.T[1])
Example #4
0
                                 N_matrix=6,
                                 ifloop=True,
                                 ifprint=False)
                # print(len(results))
            (act, ang, n_vec, toy_aa, para), loop = L
            print(len(results), loop)
            checks, maxgap = ced(n_vec, ua(toy_aa.T[3:].T, np.ones(3)))
            counter = counter + 1
        # if(counter==10):
        # continue
        # print(ang)
        minfreq = np.min(np.abs(ang[3:6]))
        if (8. * 2. * np.pi / minfreq > 10.):
            print(i, px, pz, "Fewer than 8 fundamental periods")
        T = np.linspace(0., len(results) / 100., len(results))
        errors = eval_mean_error_functions(
            act, ang, n_vec, toy_aa, T, withplot=False) / np.sqrt(len(T))
        print LM.H(initial), i, px, pz, act[0], act[1], act[2], ' '.join(
            map(str,
                loop)), ang[3], ang[4], ang[5], errors[0], errors[1], LM.H(
                    unrotate_coords(results[-1]))

        # check_angle_solution(ang,n_vec,toy_aa,timeseries)
        # plt.plot(toy_aa.T[3],toy_aa.T[4],'.')
        # plt.show()
        # plt.plot(toy_aa.T[3],toy_aa.T[5],'.')
        # plt.show()
        # plt.plot(results.T[0],results.T[1],'.');plt.show()
        # F = pot.orbit_integrate(initial,80.,LM)
        # results = np.array([rotate_coords(p) for p in F[0]])
        # print(len(results))
        # plt.plot(results.T[0],results.T[1])