Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ distribute-*.tar.gz
.project
.pydevproject
.settings
settings.json

docs/.DS_Store
.DS_Store
18 changes: 14 additions & 4 deletions docs/fleck/jax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,22 @@ that we will observe, the stellar inclination, and spectrum of the stellar photo

We can add active regions to the star with `~fleck.jax.ActiveStar.add_spot`

Spot latitudes are signed angles in radians, from ``-pi/2`` to ``pi/2``;
zero is the stellar equator. To convert a colatitude, use
``latitude = pi/2 - colatitude``.

Instead of a spectrum, you can provide a scalar or wavelength-dependent
``contrast`` to ``add_spot``. A contrast below one describes a dark spot;
a contrast above one describes a bright region. Supplying only ``temperature``
uses a blackbody spot spectrum. If no photospheric spectrum is provided,
``T_eff`` and the wavelength grid define a blackbody photosphere.

.. code-block:: python

# add a cool spot:
active_star.add_spot(
lon=-0.2, # [rad]
lat=1.65, # [rad]
lat=np.pi/2 - 1.65, # signed latitude [rad]
rad=0.15, # [R_star]
spectrum=cool.flux.value,
temperature=cool.meta['PHXTEFF']
Expand All @@ -215,7 +225,7 @@ We can add active regions to the star with `~fleck.jax.ActiveStar.add_spot`
# add a hot spot:
active_star.add_spot(
lon=0.95,
lat=1.75,
lat=np.pi/2 - 1.75,
rad=0.08,
spectrum=hot.flux.value,
temperature=hot.meta['PHXTEFF']
Expand Down Expand Up @@ -376,7 +386,7 @@ code cell above, makes a lot of plotting calls to visualize the results of
# add a cool spot:
active_star.add_spot(
lon=-0.2, # [rad]
lat=1.65, # [rad]
lat=np.pi/2 - 1.65, # signed latitude [rad]
rad=0.15, # [R_star]
spectrum=cool.flux.value,
temperature=cool.meta['PHXTEFF']
Expand All @@ -385,7 +395,7 @@ code cell above, makes a lot of plotting calls to visualize the results of
# add a hot spot:
active_star.add_spot(
lon=0.95,
lat=1.75,
lat=np.pi/2 - 1.75,
rad=0.08,
spectrum=hot.flux.value,
temperature=hot.meta['PHXTEFF']
Expand Down
13 changes: 13 additions & 0 deletions fleck/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ def light_curve(self, spot_lons, spot_lats, spot_radii, inc_stellar,
np.cos(Omega) * np.sin(omega + f) * np.cos(I))
Z = planet.a * np.sin(omega + f) * np.sin(I)

# Enforce that the transit chord lies below the stellar equator
# in the same "observer oriented" frame used for the spots/plot.
in_front = (X < 0) & (np.abs(Y) < 1 + planet.rp)
if np.any(in_front):
idx = np.where(in_front)[0]
# approximate mid-transit as the in-front point with minimum |Y|
mid_idx = idx[np.argmin(np.abs(Y[in_front]))]
z_star_mid = -Z[mid_idx]
if z_star_mid > 0:
# Planet is crossing the lat > 0 hemisphere; reflect it
# across the equator so it crosses lat < 0 instead.
Z = -Z

# Create a shapely circle object for the planet's silhouette only
# when the planet is in front of the star, otherwise append `None`
planet_disk = [circle([-Y[i], -Z[i]], planet.rp)
Expand Down
Loading
Loading