Example #1
0
import numpy as np
import os
import matplotlib.pyplot as plt

import lamost
import utils


catalog = lamost.load_catalog()
wavelengths = lamost.common_wavelengths
N, P = (len(catalog), wavelengths.size)

# Open the data arrays
all_observed_flux = np.memmap(
    os.path.join(lamost.LAMOST_PATH, "observed_flux.memmap"),
    mode="r", dtype='float32', shape=(N, P))

all_observed_ivar = np.memmap(
    os.path.join(lamost.LAMOST_PATH, "observed_ivar.memmap"),
    mode="r", dtype='float32', shape=(N, P))

all_model_flux = np.memmap(
    os.path.join(lamost.LAMOST_PATH, "model_flux.memmap"),
    mode="r", dtype="float32", shape=(N, P))


# Plot a special star.
star_index = 93

observed_flux = all_observed_flux[star_index]
observed_ivar = all_observed_ivar[star_index]
from astropy.io import fits
from astropy.table import Table
from scipy import (interpolate, optimize as op)
import logging
from vectorizer import polynomial

plt.close("all")
star_index = 245603

mg1, mg2 = 5160, 5190





catalog =lamost.load_catalog()

catalogbig = lamost.load_catalog('Ho2017_Catalog.fits')
wavelengths = lamost.common_wavelengths
N, P = (len(catalog), wavelengths.size)

all_observed_flux = np.memmap(
    os.path.join(lamost.LAMOST_PATH, "observed_flux.memmap"),
    mode="r", dtype='float32', shape=(N, P))

all_observed_ivar = np.memmap(
    os.path.join(lamost.LAMOST_PATH, "observed_ivar.memmap"),
    mode="r", dtype='float32', shape=(N, P))

all_model_flux = np.memmap(
    os.path.join(lamost.LAMOST_PATH, "model_flux.memmap"),