scopesim_templates.stellar.stellar.star#
- scopesim_templates.stellar.stellar.star(filter_name, amplitude, spec_type='A0V', x=0, y=0, library='pyckles')#
Create a scopesim.Source object for a list of stars with given amplitudes.
Note
If amplitudes have no units, vega magnitudes are assumed
- Parameters:
filter_name (str) – For scaling the stars. Use either common names or Spanish-VO identifiers.
amplitudes (list of Quanitity, float) – [mag, Jy] amplitudes for the list of stars. Acceptable astropy.units: [u.mag, u.ABmag, u.Janksy]. If no units are given, Vega magnitudes are assumed
spec_types (list of strings) – the spectral type(s) of the stars, e.g. “A0V”, “G5III”
x (arrays of float) – [arcsec] x and y coordinates of the stars on the focal plane
y (arrays of float) – [arcsec] x and y coordinates of the stars on the focal plane
ra (float) – coordinates of the center of the field
dec (float) – coordinates of the center of the field
library (str) – Library where the spectroscopic types are taken. By default are taken from the pickles library using the
pycklespackage. Other libraries available are kurucz, bosz/lr, bosz/mr, bosz/hr, etc for MIR coverage and different spectral resolutions. Please see thespextrapackage for more information
- Returns:
src
- Return type:
scopesim.Source
Examples
Create a
Sourceobject for a random group of stars:>>> import numpy as np >>> import astropy.units as u >>> from scopesim_templates.stellar import stars >>> >>> n = 100 >>> spec_types = ["A0V", "G2V", "K0III", "M5III", "O8I"] * (n // 5) >>> ids = np.random.randint(0, 5, size=n) >>> star_list = [spec_types[i] for i in ids] >>> mags = np.random.normal(loc=20, scale=3, size=n) * u.mag >>> x, y = np.random.random(size=(2, n)) >>> >>> src = stars("Ks", mags, spec_types, x, y)
The final positions table is kept in the
<Source>.fieldsattribute:>>> my_pos_table = src.fields[0]
Each star in this table has an associated spectrum kept in the
<Source>.spectraattribute. These stars are connected to the spectra in the list by the “ref” column in the.fieldstable:>>> list(src.spectra.values()) [SpextrumNone, SpextrumNone, SpextrumNone, SpextrumNone, SpextrumNone]
The stars can be scaled in units of u.mag, u.ABmag or u.Jansky. Any filter listed on the spanish VO filter profile service can be used for the scaling (
http://svo2.cab.inta-csic.es/theory/fps/). SVO filter names need to be in the following formatobservatory/instrument.filter:>>> amplitudes = np.linspace(1, 3631, n) * u.Jansky >>> filter_name = "Paranal/HAWKI.Ks" >>> my_source = stars(filter_name, amplitudes, spec_types, x=x, y=y)