Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes and a bug? #7

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ env:
# The following versions are the 'default' for tests, unless
# overridden underneath. They are defined here in order to save having
# to repeat them for all configurations.
- PYTHON_VERSION=3.7
- PYTHON_VERSION=3.8
- NUMPY_VERSION=stable
- ASTROPY_VERSION=stable
- MAIN_CMD='python setup.py'
Expand Down
11 changes: 6 additions & 5 deletions fleck/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def sort_plot_points(xy_coord, k0=0):
n = len(xy_coord)
distance_matrix = squareform(pdist(xy_coord, metric='euclidean'))
mask = np.ones(n, dtype='bool')
sorted_order = np.zeros(n, dtype=np.int)
sorted_order = np.zeros(n, dtype=np.int32)
indices = np.arange(n)

i = 0
Expand Down Expand Up @@ -236,7 +236,7 @@ def light_curve(self, spot_lons, spot_lats, spot_radii, inc_stellar,
inc_stellar, times=times,
planet=planet,
time_ref=time_ref)

# Compute the distance of each spot from the stellar centroid, mask
# any spots that are "behind" the star, in other words, x < 0
r = np.ma.masked_array(np.hypot(tilted_spots.y.value,
Expand Down Expand Up @@ -348,14 +348,14 @@ def spherical_to_cartesian(self, spot_lons, spot_lats, inc_stellar,
# Generate array of rotation matrices to rotate the spots about the
# stellar rotation axis
if times is None or (hasattr(times, '__len__') and times[0] is None):
rotate = rotation_matrix(self.phases[:, np.newaxis, np.newaxis],
rotate = rotation_matrix(self.phases[..., np.newaxis, np.newaxis],
axis='z')
else:
if time_ref is None:
time_ref = 0
rotational_phase = 2 * np.pi * ((times - time_ref) /
self.rotation_period) * u.rad
rotate = rotation_matrix(rotational_phase[:, np.newaxis, np.newaxis],
rotate = rotation_matrix(rotational_phase[..., np.newaxis, np.newaxis],
axis='z')

rotated_spots = cartesian.transform(rotate)
Expand Down Expand Up @@ -747,7 +747,8 @@ def generate_spots(min_latitude, max_latitude, spot_radius, n_spots,
delta_latitude = max_latitude - min_latitude
if n_inclinations is not None and inclinations is None:
inc_stellar = np.arccos(np.random.rand(n_inclinations))
inc_stellar *= np.sign(np.random.uniform(-1, 1, n_inclinations)) * u.deg
inc_stellar = inc_stellar * np.sign(np.random.uniform(-1, 1, n_inclinations)) * u.rad
inc_stellar = inc_stellar.to(u.deg)
else:
n_inclinations = len(inclinations) if not inclinations.isscalar else 1
inc_stellar = inclinations
Expand Down