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

Implementing render functions #77

Closed
wants to merge 2 commits into from
Closed

Implementing render functions #77

wants to merge 2 commits into from

Conversation

dfm
Copy link
Member

@dfm dfm commented Oct 18, 2023

After this PR, the following code:

import matplotlib.pyplot as plt
import jax.numpy as jnp
from jaxoplanet.experimental.starry.render import render

y = jnp.array(
    [1.00,  0.22,  0.19,  0.11,  0.11,  0.07,  -0.11, 0.00,  -0.05,
     0.12,  0.16,  -0.05, 0.06,  0.12,  0.05,  -0.10, 0.04,  -0.02,
     0.01,  0.10,  0.08,  0.15,  0.13,  -0.11, -0.07, -0.14, 0.06,
     -0.19, -0.02, 0.07,  -0.02, 0.07,  -0.01, -0.07, 0.04,  0.00]
)
img = render(5, 500, 0.0, 0.0, 0.0, y)
plt.imshow(img, origin="lower")
plt.savefig("render.png", dpi=100, bbox_inches="tight");

produces this image:

render

which we can compare to the starry docs:

@shashankdholakia
Copy link
Contributor

Sorry for lurking--been using this render function and I noticed a possible typo in left_project that makes this function fail for rotation angles different from 0:

def left_project(deg, M, theta, inc, obl):
# Note that here we are using the fact that R . M = (M^T . R^T)^T
MT = jnp.transpose(M)
# Rotate to the polar frame
MT = dot_rotation_matrix(deg, 1.0, 0.0, 0.0, -0.5 * jnp.pi)(MT)
MT = dot_rotation_matrix(deg, None, None, 1.0, -theta)(MT)
# Rotate to the sky frame
MT = dot_rotation_matrix(deg, 1.0, 0.0, 0.0, 0.5 * jnp.pi)(MT)
MT = dot_rotation_matrix(deg, None, None, 1.0, -obl)(MT)
MT = dot_rotation_matrix(
deg, -jnp.cos(obl), -jnp.sin(obl), 0.0, 0.5 * jnp.pi - inc
)(MT)
return M.T

Last line should return MT, not M.T?

@dfm
Copy link
Member Author

dfm commented Nov 16, 2023

That seems like it would be better, doesn't it! Would you be willing to open a small PR to that branch?

@dfm
Copy link
Member Author

dfm commented Feb 10, 2024

Superseded by #111

@dfm dfm closed this Feb 10, 2024
@lgrcia lgrcia deleted the render branch October 18, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants