"Mo", "Tc", "Mo", "Ru", "Rh", "Pd", "Ag", "Cd", "Sn", "Te",
                "Ba", "La", "Ce", "Pr", "Nd", "Sm", "Eu", "Gd", "Tb", "Dy",
                "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "W", "Os", "Ir", "Pt",
                "Au", "Hg", "Pb", "Bi", "Th", "U")

# Start logging our progress
logging.basicConfig(
    level=logging.INFO,
    format='[%(asctime)s] %(levelname)s:%(filename)s:%(message)s',
    datefmt='%d/%m/%Y %H:%M:%S')
logger = logging.getLogger(__name__)
logger.info("Synthesizing SAGA spectra")

# Instantiate base synthesizer
synthesizer = Synthesizer(library_name="saga_sample",
                          logger=logger,
                          docstring=__doc__)


def valid_float(n):
    try:
        test = re.match("<?(.*)+-.*", n)
        if test is not None:
            n = test.group(1)
        n = float(n)
    except ValueError:
        return None
    except TypeError:
        return None
    return n
# List of elements whose abundances we pass to TurboSpectrum
element_list = ("[C/H]", "[N/H]", "[O/H]", "[Na/H]", "[Mg/H]", "[Al/H]",
                "[Si/H]", "[Ca/H]", "[Ti/H]", "[Mn/H]", "[Co/H]", "[Ni/H]",
                "[Ba/H]", "[Sr/H]")

# Start logging our progress
logging.basicConfig(
    level=logging.INFO,
    format='[%(asctime)s] %(levelname)s:%(filename)s:%(message)s',
    datefmt='%d/%m/%Y %H:%M:%S')
logger = logging.getLogger(__name__)
logger.info("Synthesizing APOKASC grid of spectra")

# Instantiate base synthesizer
synthesizer = Synthesizer(library_name="apokasc_training_set",
                          logger=logger,
                          docstring=__doc__)

# Table supplies list of stars in the APOKASC training set, giving the stellar labels for each star in the training set
stellar_data = Table.read("../../4MOST_testspectra/trainingset_param.tab",
                          format="ascii")

# Iterate over the spectra we're supposed to be synthesizing
star_list = []
for star in stellar_data:
    # Look up stellar parameters of the star we're about to synthesize
    metadata = synthesizer.astropy_row_to_dict(star)

    star_data = {
        "name": metadata["Starname"],
        "stellar_mass": metadata['Mass'] if 'Mass' in metadata else 1,
"""

import logging

from lib.base_synthesizer import Synthesizer
from fourgp_speclib import SpectrumLibrarySqlite

# Start logging our progress
logging.basicConfig(level=logging.INFO, format='[%(asctime)s] %(levelname)s:%(filename)s:%(message)s',
                    datefmt='%d/%m/%Y %H:%M:%S')
logger = logging.getLogger(__name__)
logger.info("Synthesizing spectra of pepsi")

# Instantiate base synthesizer
synthesizer = Synthesizer(library_name="turbo_pepsi_replica_3label",
                          logger=logger,
                          docstring=__doc__)

spectra = SpectrumLibrarySqlite.open_and_search(
        library_spec='pepsi_4fs_hrs/',
        workspace='/home/travegre/Projects/4GP/4most-4gp-scripts/workspace/',
        extra_constraints={"continuum_normalised": True}
    )
pepsi_library, pepsi_library_items = [spectra[i] for i in ("library", "items")]
# Load test set
pepsi_library_ids = [i["specId"] for i in pepsi_library_items]

spectra = [pepsi_library.open(ids=i).extract_item(0) for i in pepsi_library_ids]
print(spectra)

star_list = []
Exemplo n.º 4
0
import logging

from lib.base_synthesizer import Synthesizer

# Start logging our progress
logging.basicConfig(
    level=logging.INFO,
    format='[%(asctime)s] %(levelname)s:%(filename)s:%(message)s',
    datefmt='%d/%m/%Y %H:%M:%S')
logger = logging.getLogger(__name__)
logger.info(
    "Synthesizing spectra for some pollution sources for cross-talk tests")

# Instantiate base synthesizer
synthesizer = Synthesizer(library_name="pollution_sources_turbospec",
                          logger=logger,
                          docstring=__doc__)

star_list = [
    {
        'name': "rc,fe_h=-3",
        'Teff': 4500,
        'logg': 3,
        '[Fe/H]': -3,
        'extra_metadata': {}
    },
    {
        'name': "to,fe_h=-3",
        'Teff': 6250,
        'logg': 4,
        '[Fe/H]': -3,