"Marcin bug" bugfix#1124
Conversation
Marcin discovered that extrapolation/blending can cause haywire intensities for high Teffs and low mus. This was the consequence of limb darkening extrapolation defaulting to ATM instead of LD extrapolation method, causing the intensities to go crazy. The fix is to use LD extrapolation instead of ATM extrapolation.
|
I'm not sure I understand the fix. The options for both methods are the same, so is it a problem of mixing |
|
It fixes the problem in the test case I ran. However, when I disable blending entirely using I also want to make sure I fully understand the underlying mechanics of this fix. Why is the Additionally, why do we apply this change specifically to |
|
Extrapolation (and subsequently blending) rely on extrapolated atmospheric limb darkening coefficients to apply LD correction to blackbody intensities. The reason for this is that blackbody intensities have no inherent limb darkening so we need to appropriate model atmosphere limb darkening. While on-grid, this is straight-forward because the values are all defined. But when off-grid, we need to extrapolate and the question, then, is how. The default was linear extrapolation in LD space, which causes blow-up. LDs should always use 'nearest' extrapolation except when just marginally off-grid; the fix thus ought to work whenever ld_extrapolation_mode is set to 'nearest', irrespective of blending. This is especially pronounced when mu is small (close to the limb) and Teff is above grid values. |
|
So, after the fix, when I tried to use extrapolation by setting: However, when I went back to the pre-fix version and run the code with: Also, in the fixed version, when someone decides to use: Shouldn't we then just hard-code: |
|
This might be a bigger discussion to have than it seems at first glance. What would you expect to happen if atm parameters are off-grid, LD method is set to 'interp', and blending method is set to 'blackbody' or to 'none'? How exactly should limb darkening be handled? The current implementation uses ld_extrapolation_method to determine LD coefficients, i.e. when the LD method is non-interp. This fix uses ld_extrapolation_method for the case when LD method is set to 'interp'. But that implies that we must always extrapolate intensities (specific and normal), the ratio of which is then the limb darkening correction. Perhaps we shouldn't allow 'interp' for off-grid extrapolation, but how do we prescribe that from the user's point of view? We would need yet another set of parameters to give us the fallback option for LDs, which sounds messy. Forcing Inorm and Imu to 'nearest' is indeed another possibility, but that should happen only if extrapolation isn't 'none'. So perhaps something like: But then we're essentially ignoring what the user passes as ld_extrapolation_method. None of these seem ideal to me. |
|
Maybe not ideal but I think the second option while throwing a warning makes most sense. |
|
Sorry you have to explain this to me in detail, I cannot say I fully understand this method. I see your point, but let me ask this question first: do we know what exactly causes the intensity to blow up? Is it division by something close to zero? In this case, it has to be
and I am just trying to understand why this is so drastic. Now for the fix. Your patch only works when blending is on and when So the question is, are we missing a change from I like Dave's idea with a warning. Maybe when a user decides to use EDIT elif atm.name in self.ndp.keys(): # atm in one of the model atmospheres
result = InterpResult.from_ndpolator(
self.ndp[atm.name].ndpolate(
f'imu@{intens_weighting}',
query_pts=query.subset(atm.basic_axis_names + ['mus']).pts,
extrapolation_method=atm_extrapolation_method
)
)I just changed |
| /phoebe/atmospheres/tables/tlusty | ||
| /tests/tests/test_passbands/tables | ||
| /tests/local | ||
| /tests/benchmark |
There was a problem hiding this comment.
pretty sure this is in the repo (although I don't think we use it anymore and probably should clean it up).
Marcin discovered that extrapolation/blending can cause haywire intensities for high Teffs and low mus. This was the consequence of limb darkening extrapolation defaulting to ATM instead of LD extrapolation method, causing the intensities to go crazy. The fix is to use LD extrapolation instead of ATM extrapolation.