zkbt / chromatic

Tools for visualizing spectrosopic light curves, with flux as a function of wavelength and time.
MIT License
14 stars 4 forks source link

bug in using `wavelength=` in `get_phoenix_photons` #182

Closed zkbt closed 2 years ago

zkbt commented 2 years ago

@will-waalkes identified some deeply weird behavior. Sometimes, the first time get_phoenix_photons gets called with wavelength=, it seems not to be loading the correct resolution background library, but often it fixes itself for subsequent calls.

A small example showing this:

from chromatic import *

for i in range(2):
    w = np.linspace(.7, .71, 1000)*u.micron
    wamb, s_amb = get_phoenix_photons(temperature=int(3900.), wavelength = w,logg=4.4, metallicity=0.0)
    wspot, s_spot = get_phoenix_photons(temperature=int(3100.), wavelength = w,logg=4.4, metallicity=0.0)

    plt.plot(wspot,s_spot)
    plt.plot(wamb,s_amb)
    plt.show();

image image

I think I need to go through and carefully check the web of ifs and trys that are supposed to handle the background library management.

zkbt commented 2 years ago

OK, @will-waalkes , I think I fixed this bug with #183 . Please try pulling down the latest version of develop and using it. When I run the code snippet above, now the plots look like: image image