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

Fix opachord.py to avoid nan in the gradient of ArtTransPure model #464

Merged
merged 4 commits into from
Jan 15, 2024

Conversation

sh-tada
Copy link
Collaborator

@sh-tada sh-tada commented Jan 15, 2024

This pull request resolves the issue (#463) of NaN values in the gradient of the ArtTransPure transmission spectra model with respect to temperature, gravity_btm, radius_btm, and mean molecular weight. The NaN values originated from the jnp.sqrt function in exojax/spec/opachord.py.

To address this, I implemented jnp.tril before the jnp.sqrt operation. This modification zeros out irrelevant values, ensuring proper gradient calculations. Setting k=-1 in jnp.tril also zeroes the diagonal.

Fixes #463

@sh-tada sh-tada added the bug Something isn't working label Jan 15, 2024
@HajimeKawahara HajimeKawahara added this to the v1.5 milestone Jan 15, 2024
Copy link
Owner

@HajimeKawahara HajimeKawahara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test file shown in #463?
maybe in integration/unittest_long/transmission/

@sh-tada
Copy link
Collaborator Author

sh-tada commented Jan 15, 2024

I added transmission_grad_test.py in integration/unittest_long/transmission/.
If necessary, I will change the file name.

@HajimeKawahara
Copy link
Owner

The newly added file is not pytest file. maybe remove _test from the filename?

@sh-tada
Copy link
Collaborator Author

sh-tada commented Jan 15, 2024

I modified the filename and Nx.

Copy link
Owner

@HajimeKawahara HajimeKawahara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@HajimeKawahara HajimeKawahara merged commit 974a489 into HajimeKawahara:develop Jan 15, 2024
2 checks passed
@sh-tada sh-tada deleted the trans_tdiff_tada branch January 15, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants