stars¶
-
simcado.source.
stars
(spec_types='A0V', mags=0, filter_name='Ks', x=None, y=None, **kwargs)[source]¶ Creates a simcado.Source object for a bunch of stars.
- Parameters
- spec_typesstr, list of strings
the spectral type(s) of the stars, e.g. “A0V”, “G5III” Default is “A0V”
- magsfloat, array
[mag] magnitudes of the stars.
- filter_namestr,
Filter in which the magnitude is given. Can be the name of any filter curve file in the simcado/data folder, or a path to a custom ASCII file
- x, yarrays
[arcsec] x and y coordinates of the stars on the focal plane
- Returns
- source
simcado.Source
- source
Examples
Create a
Source
object for a random group of stars>>> import numpy as np >>> from simcado.source import stars >>> >>> spec_types = ["A0V", "G2V", "K0III", "M5III", "O8I"] >>> ids = np.random.randint(0,5, size=100) >>> star_list = [spec_types[i] for i in ids] >>> mags = np.random.normal(20, 3, size=100) >>> >>> src = stars(spec_types, mags, filter_name="Ks")
If we don’t specify any coordinates all stars have the position (0, 0). All positions are in arcsec. There are two possible ways to add positions. If we know them to begin with we can add them when generating the source full of stars
>>> x, y = np.random.random(-20, 20, size=(100,2)).tolist() >>> src = stars(star_list, mags, filter_name="Ks", x=x, y=y)
Or we can add them to the
Source
object directly (although, there are less checks to make sure the dimensions match here):>>> src.x, src.y = x, y