Numerical instabilities with occultations of very high order maps
See original GitHub issueHi Rodrigo, I noticed that flux sometimes diverges for occultations in both emitted and reflected light with very high order maps (l > 20). Here’s a reproducible example:
map = starry.Map(ydeg=25, reflected=False)
map.add_spot(amp=0.01, sigma=0.01, lat=41., lon=20.)
xo = np.linspace(-1, 1, 100)
yo = np.linspace(-0.08, -0.132, 100)
zo = np.ones(len(xo))
ro = 0.8552
theta = np.linspace(28.5, 28.7, 100)
flux = map.flux(theta=theta, xo=xo, yo=yo, zo=zo, ro=ro)
fig, ax = plt.subplots(2, 1, figsize=(5, 5))
ax[0].set_xlim(-1.1, 1.1)
ax[0].set_ylim(-1.1, 1.1)
ax[0].axis("off")
ax[0].imshow(map.render(), origin="lower", cmap="plasma", extent=(-1, 1, -1, 1))
npts = len(xo)
for n in list(range(0, npts, npts // 3)) + [npts - 1]:
circ = plt.Circle(
(xo[n], yo[n]), radius=ro, color="k", fill=True, clip_on=False, alpha=0.2
)
ax[0].add_patch(circ)
ax[1].plot(flux, 'k.')
And this is the output:
It’s an edge case that probably doesn’t matter for inference. I noticed it because I generate fake data from very high order maps.
Starry version:'1.0.1.dev43+gf871d249'
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Occultation Mapping of Io's Surface in the Near-infrared. I ...
These observations encode a wealth of information about the volcanic features on its surface. We built a generative model for the observed ...
Read more >The Potential for Discriminating Microphysical Processes in ...
Accurate representation of cloud microphysical processes in numerical weather and climate models has proven challenging, in part because of the highly ...
Read more >FAQs — starry 1.1.1 documentation - Read the Docs
1. I get weird output when I call starry functions. 2. I get a ValueError when instantiating a pymc3 model. 3. How do...
Read more >Maps in reflected light — starry 1.0.0 documentation
The spherical harmonic coefficients of a map in reflected light are an expansion of the object's albedo (instead of its emissivity, ...
Read more >An efficient high-order numerical solver for diffusion equations ...
Strongly anisotropic diffusion problems present a numerical challenge, because errors in the direction parallel to the magnetic field may have significant ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, thanks for finding this. Here’s a slightly simpler version that shows the instability as a function of
k^2
(Equation D23 in the paper):Looks like things are bad for
k^2 > 1
, although the instability sets in a bit before that. My guess is the evaluation of the J integral (Equation D39) gets unstable. It might help to replace the upward/downward recursion with a tridiagonal solver. I’ll look into it.Punting on this for now. Feel free to reopen if a better solution is needed.