<jupyter_start><jupyter_text>Interactive spectraSee how the metal content and logg affect the spectra.<jupyter_code>from __future__ import print_function
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
import os
from astropy.io import fits
def load(teff, logg, feh, xmin=21500, xmax=22000):
    # Replace with path to model files
    name = os.path.join("PHOENIX", "Z{0:+1.10}".format(float(feh)),
        "lte{0:05d}-{1:1.02f}{2:+1.10}.PHOENIX-ACES-AGSS-COND-2011-HiRes.fits".format(teff, float(logg), float(feh)))
    
    if feh == 0:
        name = name.replace("Z+0.0", "Z-0.0")
        name = name.replace("+0.0.PHOENIX", "-0.0.PHOENIX")
    flux = fits.getdata(name)
    wav = fits.getdata(os.path.join("PHOENIX", "WAVE_PHOENIX-ACES-AGSS-COND-2011.fits"))
    mask = (wav < xmax) * (wav > xmin)

    return wav[mask], flux[mask]
      
    
@interact(teff=widgets.IntSlider(min=2300, max=7000, step=100, value=5600),
          logg=widgets.FloatSlider(min=3, max=5.5, step=0.5, value=4.5),
          feh=widgets.FloatSlider(min=-2, max=1, step=0.5, value=0),
          xmin=widgets.FloatSlider(min=9000, max=49000, step=500, value=22000),
          window=widgets.FloatSlider(min=10, max=10000, step=10, value=1000))
def plt_spectrum(teff, logg, feh, xmin=21500, window=1000):
    wav, flux = load(teff, logg, feh, xmin, xmin+window)
    plt.plot(wav, flux)
    plt.ylabel("Flux")
    plt.xlabel("Wavelength (Angstrom)")
    plt.title("Phoenix-ACES Model Spectra")
    plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1615581098339719, 'fraction_numerical': 0.06896551724137931, 'mean_word_length': 4.038585209003215, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '50280', 'license': 'MIT', 'n_tokens_mistral': 685, 'n_tokens_neox': 628, 'n_words': 113, 'path': 'octotribble/Misc/Interactive_Spectra.ipynb', 'repo_name': 'jason-neal/equanimous-octo-tribble', 'size': '1566'}