Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlouden committed Aug 21, 2016
1 parent 9e21df5 commit ee7af5a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
1 change: 1 addition & 0 deletions c_src/_web.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ static PyObject *web_calc_substellar(PyObject *self, PyObject *args)

Py_DECREF(c_array);
free(c);
free(output);

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion c_src/web.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ double *calc_substellar(double phase, double *coords){
lambda0 = lambda0 + 2*M_PI;
}

phi0 = atan2(coords[1],coords[2]);
phi0 = atan(coords[1]/coords[2]);

output[0] = lambda0;
output[1] = phi0;
Expand Down
33 changes: 13 additions & 20 deletions spiderman/params.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import numpy as np
import spiderman as sp
import spiderman._web as _web

class ModelParams(object):

def __init__(self,brightness_model='xi'):
Expand Down Expand Up @@ -65,25 +68,15 @@ def format_bright_params(self):
return brightness_params

def calc_phase(self,t):
phase = ((t-self.t0)/self.per)
if(phase > 1):
phase = phase - np.floor(phase)
if(phase < 0):
phase = phase + np.ceil(phase) + 1
print(phase)
self.phase = phase
self.phase = _web.calc_phase(t,self.t0,self.per)

def calc_substellar(self,t,coords):
star_x = 0.0-coords[0]
star_y = 0.0-coords[1]
star_z = 0.0-coords[2]
def calc_substellar(self,t):
self.calc_phase(t)
lambda0 = (np.pi + self.phase*2*np.pi)
phi0 = np.arctan2(star_y,star_z)
if(lambda0 > 2*np.pi):
lambda0 = lambda0 - 2*np.pi;
if(lambda0 < -2*np.pi):
lambda0 = lambda0 + 2*np.pi;
print(lambda0)
self.lambda0 = lambda0
self.phi0 = phi0
coords = sp.separation_of_centers(t,self)
print(coords)
substellar = _web.calc_substellar(self.phase,np.array(coords))
self.lambda0 = substellar[0]
self.phi0 = substellar[1]
print(self.phase)
print(self.lambda0)
print(self.phi0)
3 changes: 1 addition & 2 deletions spiderman/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def line_intersect(x1,y1,x2,y2,r2):

def generate_planet(sp,t):
brightness_params = sp.format_bright_params()
coords = separation_of_centers(t,sp)
sp.calc_substellar(t,coords)
sp.calc_substellar(t)
return np.array(_web.generate_planet(sp.n_layers,sp.lambda0,sp.phi0,sp.p_u1,sp.p_u2,sp.brightness_type,brightness_params))

def blocked(n_layers,x2,y2,r2):
Expand Down

0 comments on commit ee7af5a

Please sign in to comment.