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

air=True in grid_tools causing weird wavelength bug #65

Open
iancze opened this issue Apr 14, 2016 · 3 comments
Open

air=True in grid_tools causing weird wavelength bug #65

iancze opened this issue Apr 14, 2016 · 3 comments
Labels

Comments

@iancze
Copy link
Collaborator

iancze commented Apr 14, 2016

Steps to reproduce:

import numpy as np
import Starfish
from Starfish.grid_tools import PHOENIXGridInterfaceNoAlpha

grid = PHOENIXGridInterfaceNoAlpha(wl_range=[900, 50000], air=False)
wl = grid.wl

print("Air is {}: Maximum change in wavelength {:.3f} AA".format(False, np.max(np.diff(wl))))
print("Air is {}: Minimum change in wavelength {:.3f} AA".format(False, np.min(np.diff(wl))))
print()

grid = PHOENIXGridInterfaceNoAlpha(wl_range=[900, 50000], air=True)
wl = grid.wl

print("Air is {}: Maximum change in wavelength {:.3f} AA".format(True, np.max(np.diff(wl))))
print("Air is {}: Minimum change in wavelength {:.3f} AA".format(True, np.min(np.diff(wl))))

Output

Air is False: Maximum change in wavelength 0.225 AA
Air is False: Minimum change in wavelength 0.006 AA

Air is True: Maximum change in wavelength 743.863 AA
Air is True: Minimum change in wavelength -1293.716 AA

Obviously, the wavelength grid should be monotonic. I'm not really sure what's causing this, but it seems to be related to applying the vacuum_to_air method to a larger range of wavelengths than just the optical.

@iancze iancze added the bug label Apr 14, 2016
@gully
Copy link
Collaborator

gully commented Mar 2, 2017

It seems like there's a resonance feature that reorders the wavelengths at one index location:

vac_air_demo

Not sure how to handle this, though these are exceptionally short wavelengths, so it's unlikely that you have data there. Still it's problematic if you're trying to integrate the function or something.

@iancze
Copy link
Collaborator Author

iancze commented Mar 2, 2017

Ah, your plot makes the issue clearer. I think the problem is that the vacuum to air conversion we are using is not valid outside of optical wavelengths.

@jason-neal
Copy link
Collaborator

The Ciddor 1996 formula used is valid for the wavelength range between 0.23 and 1.7μm. Found in the conclusion here as the actual paper is behind a paywall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants