From 9473b3c4fc57ead0cbfed6664c108dce4f0f0216 Mon Sep 17 00:00:00 2001 From: Alvin Chua Date: Fri, 9 Nov 2018 15:26:16 -0800 Subject: [PATCH] version 0.3.1 --- .gitignore | 4 +++- AAKwrapper/AAKwrapper.pyx | 21 +++++++++++---------- Makefile | 5 +++-- examples/AAKdemo.py | 2 +- include/AAKPhase.h | 2 +- include/AAKpy.h | 2 +- src/exec/AAK_Phase.cc | 8 +++++--- src/suite/AAKPhase.cc | 3 ++- src/suite/AAKpy.cc | 4 ++-- 9 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index e3a563e..12f0f58 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,8 @@ bin/* lib/* *~ -build/* AAKwrapper/AAKwrapper.cpp AAKwrapper/__pycache__/* +AAKwrapper.egg-info/* +build/* +dist/* diff --git a/AAKwrapper/AAKwrapper.pyx b/AAKwrapper/AAKwrapper.pyx index 040cb8c..62d1642 100644 --- a/AAKwrapper/AAKwrapper.pyx +++ b/AAKwrapper/AAKwrapper.pyx @@ -39,7 +39,7 @@ cdef extern from "AAKpy.h": double AAKwave(SetPar& AAK, double *t, double *hI, double *hII) cdef extern from "AAKpy.h": - double AAKphase(SetPar &AAK, double *t, double *phase_r, double *phase_theta, double *phase_phi, double *omega_r, double *omega_theta, double *omega_phi) + double AAKphase(SetPar &AAK, double *t, double *phase_r, double *phase_theta, double *phase_phi, double *omega_r, double *omega_theta, double *omega_phi, double *eccentricity) def wave(pars = {}): cdef SetPar setpar @@ -113,14 +113,15 @@ def phase(pars = {}): setpar.alpha = pars['alpha'] setpar.D = pars['D'] - cdef numpy.ndarray[double,ndim=1] t = numpy.zeros(setpar.length, 'd') - cdef numpy.ndarray[double,ndim=1] phase_r = numpy.zeros(setpar.length, 'd') - cdef numpy.ndarray[double,ndim=1] phase_theta = numpy.zeros(setpar.length, 'd') - cdef numpy.ndarray[double,ndim=1] phase_phi = numpy.zeros(setpar.length, 'd') - cdef numpy.ndarray[double,ndim=1] omega_r = numpy.zeros(setpar.length, 'd') - cdef numpy.ndarray[double,ndim=1] omega_theta = numpy.zeros(setpar.length, 'd') - cdef numpy.ndarray[double,ndim=1] omega_phi = numpy.zeros(setpar.length, 'd') + cdef numpy.ndarray[double,ndim=1] t = numpy.zeros(setpar.length, 'd') + cdef numpy.ndarray[double,ndim=1] phase_r = numpy.zeros(setpar.length, 'd') + cdef numpy.ndarray[double,ndim=1] phase_theta = numpy.zeros(setpar.length, 'd') + cdef numpy.ndarray[double,ndim=1] phase_phi = numpy.zeros(setpar.length, 'd') + cdef numpy.ndarray[double,ndim=1] omega_r = numpy.zeros(setpar.length, 'd') + cdef numpy.ndarray[double,ndim=1] omega_theta = numpy.zeros(setpar.length, 'd') + cdef numpy.ndarray[double,ndim=1] omega_phi = numpy.zeros(setpar.length, 'd') + cdef numpy.ndarray[double,ndim=1] eccentricity = numpy.zeros(setpar.length, 'd') - cdef double timing = AAKphase(setpar, &t[0], &phase_r[0], &phase_theta[0], &phase_phi[0], &omega_r[0], &omega_theta[0], &omega_phi[0]) + cdef double timing = AAKphase(setpar, &t[0], &phase_r[0], &phase_theta[0], &phase_phi[0], &omega_r[0], &omega_theta[0], &omega_phi[0], &eccentricity[0]) - return t, phase_r, phase_theta, phase_phi, omega_r, omega_theta, omega_phi, timing + return t, phase_r, phase_theta, phase_phi, omega_r, omega_theta, omega_phi, eccentricity, timing diff --git a/Makefile b/Makefile index 0d03199..b79e76b 100755 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ TOP = . BIN = $(TOP)/bin INC = $(TOP)/include LIB = $(TOP)/lib -PYBUILD = $(TOP)/build PYFILES = $(TOP)/AAKwrapper SRC = $(TOP)/src @@ -120,7 +119,9 @@ KSOBJS = AAK.o AAKPhase.o AK.o GKTrajFast.o KSParMap.o KSTools.o AAKpy.o clean : dummy $(RM) $(BIN)/* $(RM) $(LIB)/* - $(RM) -r $(PYBUILD)/* $(RM) -r $(PYFILES)/__pycache__ $(RM) $(PYFILES)/*.cpp $(RM) $(PYFILES)/*.so + $(RM) -rf AAKwrapper.egg-info + $(RM) -rf build + $(RM) -rf dist \ No newline at end of file diff --git a/examples/AAKdemo.py b/examples/AAKdemo.py index 0c16748..4690f76 100644 --- a/examples/AAKdemo.py +++ b/examples/AAKdemo.py @@ -54,6 +54,6 @@ print("Computing phases...") -t, phase_r, phase_theta, phase_phi, omega_r, omega_theta, omega_phi, timing = AAKwrapper.phase(pars) +t, phase_r, phase_theta, phase_phi, omega_r, omega_theta, omega_phi, eccentricity, timing = AAKwrapper.phase(pars) print("Time taken: {}".format(timing)) diff --git a/include/AAKPhase.h b/include/AAKPhase.h index 762422b..163e71d 100644 --- a/include/AAKPhase.h +++ b/include/AAKPhase.h @@ -13,6 +13,6 @@ void PNevolutionPhase(double *t, double *e, double *v, double *M, double *S, double *gim, double *Phi, double *alp, double *nu, double *gimdotvec, double *Phidotvec, double *alpdotvec, double timestep, int vlength, double *par, double e_traj[], double v_map[], double M_phys, double M_map[], double S_phys, double S_map[], double dt_map[], int steps, int *i_plunge, int *i_buffer, bool backint); -void GenPhase(double *t, double *phase_r, double *phase_theta, double *phase_phi, double *omega_r, double *omega_theta, double *omega_phi, double timestep, int vlength, double e_traj[], double v_map[], double M_phys, double M_map[], double mu, double S_phys, double S_map[], double dist, double inc, double gim0, double Phi0, double qS, double phiS, double alp0, double qK, double phiK, double dt_map[], int steps, bool backint, bool mich, bool traj); +void GenPhase(double *t, double *phase_r, double *phase_theta, double *phase_phi, double *omega_r, double *omega_theta, double *omega_phi, double *eccentricity, double timestep, int vlength, double e_traj[], double v_map[], double M_phys, double M_map[], double mu, double S_phys, double S_map[], double dist, double inc, double gim0, double Phi0, double qS, double phiS, double alp0, double qK, double phiK, double dt_map[], int steps, bool backint, bool mich, bool traj); #endif diff --git a/include/AAKpy.h b/include/AAKpy.h index d8d6bce..417f0e1 100644 --- a/include/AAKpy.h +++ b/include/AAKpy.h @@ -16,6 +16,6 @@ double AAKwave(SetPar &AAK, double *t, double *hI, double *hII); -double AAKphase(SetPar &AAK, double *t, double *phase_r, double *phase_theta, double *phase_phi, double *omega_r, double *omega_theta, double *omega_phi); +double AAKphase(SetPar &AAK, double *t, double *phase_r, double *phase_theta, double *phase_phi, double *omega_r, double *omega_theta, double *omega_phi, double *eccentricity); #endif diff --git a/src/exec/AAK_Phase.cc b/src/exec/AAK_Phase.cc index 0ab6aa7..ba7e60f 100644 --- a/src/exec/AAK_Phase.cc +++ b/src/exec/AAK_Phase.cc @@ -58,7 +58,7 @@ int main(int argc, char *argv[]){ dt_map[i-1]=traj3[i].t*SOLARMASSINSEC*AAK.M*AAK.M/AAK.mu; } - double *t,*phase_r,*phase_theta,*phase_phi,*omega_r,*omega_theta,*omega_phi; + double *t,*phase_r,*phase_theta,*phase_phi,*omega_r,*omega_theta,*omega_phi,*eccentricity; t=(double*)malloc(AAK.length*sizeof(double)); phase_r=(double*)malloc(AAK.length*sizeof(double)); phase_theta=(double*)malloc(AAK.length*sizeof(double)); @@ -66,7 +66,8 @@ int main(int argc, char *argv[]){ omega_r=(double*)malloc(AAK.length*sizeof(double)); omega_theta=(double*)malloc(AAK.length*sizeof(double)); omega_phi=(double*)malloc(AAK.length*sizeof(double)); - GenPhase(t,phase_r,phase_theta,phase_phi,omega_r,omega_theta,omega_phi,AAK.dt,AAK.length,e_traj,v_map,AAK.M,M_map,AAK.mu,AAK.s,s_map,AAK.D,AAK.iota,AAK.gamma,Phi,AAK.theta_S,AAK.phi_S,AAK.alpha,AAK.theta_K,AAK.phi_K,dt_map,steps,AAK.backint,AAK.LISA,false); + eccentricity=(double*)malloc(AAK.length*sizeof(double)); + GenPhase(t,phase_r,phase_theta,phase_phi,omega_r,omega_theta,omega_phi,eccentricity,AAK.dt,AAK.length,e_traj,v_map,AAK.M,M_map,AAK.mu,AAK.s,s_map,AAK.D,AAK.iota,AAK.gamma,Phi,AAK.theta_S,AAK.phi_S,AAK.alpha,AAK.theta_K,AAK.phi_K,dt_map,steps,AAK.backint,AAK.LISA,false); ticks=clock()-ticks; double secs=((double)ticks)/CLOCKS_PER_SEC; @@ -79,7 +80,7 @@ int main(int argc, char *argv[]){ strcat(filename,"_wave.dat"); if(CheckFile(filename)==1) fprintf(stderr,"Output warning: Overwriting %s\n",filename); file=fopen(filename,"w"); - for(int i=0;i