Science target templates

Science target templates#

The companion python package ScopeSim-Templates contains a library of helper functions for generating ScopeSim-friendly Source objects for various common astronomical sources.

For more information, please see the ScopeSim-Templates documentation

import numpy as np
import matplotlib.pyplot as plt

import scopesim_templates as sim_tp
Downloading file 'default_filters.yml' from 'https://scopesim.univie.ac.at/spextra/database/default_filters.yml' to '/home/docs/.spextra_cache'.
Downloading file 'default_spectra.yml' from 'https://scopesim.univie.ac.at/spextra/database/default_spectra.yml' to '/home/docs/.spextra_cache'.
Downloading file 'default_curves.yml' from 'https://scopesim.univie.ac.at/spextra/database/default_curves.yml' to '/home/docs/.spextra_cache'.
Downloading file 'index.yml' from 'https://scopesim.univie.ac.at/spextra/database/index.yml' to '/home/docs/.spextra_cache'.

A basic star cluster#

my_cluster = sim_tp.stellar.clusters.cluster(
    mass=1000.0,    # [Msun]
    distance=8000,  # [pc]
    core_radius=1,  # [pc]
)
my_cluster.plot()
imf - sample_imf: Setting maximum allowed mass to 1000
imf - sample_imf: Loop 0 added 1.09e+03 Msun to previous total of 0.00e+00 Msun
Downloading file 'pickles98_full.fits' from 'https://scopesim.univie.ac.at/pyckles/pickles98_full.fits' to '/home/docs/.astar/pyckles'.
Downloading file 'filter_systems/etc/index.yml' from 'https://scopesim.univie.ac.at/spextra/database/filter_systems/etc/index.yml' to '/home/docs/.spextra_cache'.
Downloading file 'filter_systems/etc/V.dat' from 'https://scopesim.univie.ac.at/spextra/database/filter_systems/etc/V.dat' to '/home/docs/.spextra_cache'.
Downloading file 'libraries/ref/index.yml' from 'https://scopesim.univie.ac.at/spextra/database/libraries/ref/index.yml' to '/home/docs/.spextra_cache'.
Downloading file 'libraries/ref/vega.fits' from 'https://scopesim.univie.ac.at/spextra/database/libraries/ref/vega.fits' to '/home/docs/.spextra_cache'.
<Axes: xlabel='x [arcsec]', ylabel='y [arcsec]'>
../_images/753ea6765eb095bbf0efa2c45fb91fe46b1f76a5f555ab8cdf816989d9458028.png

A basic elliptical galaxy#

# See the docstring of `elliptical` for more keywords
my_elliptical = sim_tp.extragalactic.galaxies.elliptical(
    half_light_radius=30,   # [arcsec]
    pixel_scale=0.1,        # [arcsec]
    filter_name="Ks",
    amplitude=10,
    normalization="total",  # [Ks=10 for integrated flux]
    n=4,                    # Sersic index    
    ellipticity=0.5,
    angle=30,               # [deg]
)

plt.figure(figsize=(12, 5))
plt.subplot(121)
plt.imshow(my_elliptical.fields[0].data, norm="log",
           extent=[-25.6, 25.6, -25.6, 25.6])
plt.xlabel("[arcsec]")
plt.subplot(122)
wave = np.arange(5000, 25000)   # [angstrom]
plt.plot(wave, my_elliptical.spectra[0](wave))
plt.xlabel("Wavelength [Angstrom]")
py.warnings - WARNING: /home/docs/checkouts/readthedocs.org/user_builds/scopesim/envs/stable/lib/python3.11/site-packages/spextra/downloads.py:62: FutureWarning: The download_file function is deprecated and will be removed in v1.0. Please use retriever.fetch instead.
  download_file(origin, local_path)

Downloading file 'brown14_full.fits' from 'https://scopesim.univie.ac.at/pyckles/brown14_full.fits' to '/home/docs/.astar/pyckles'.
Downloading data from 'http://svo2.cab.inta-csic.es/theory/fps3/fps.php?ID=2MASS/2MASS.Ks' to file '/home/docs/.spextra_cache/svo_filters/2MASS/2MASS.Ks'.
SHA256 hash of downloaded file: ac4009af55a5dabbebfc04a40440075d41c36aceb78da3f240a314b8998ec7ac
Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.
Text(0.5, 0, 'Wavelength [Angstrom]')
../_images/bab307edf737c2889a4b566005699c26974f540517136fe1a4d74d88fec804a4.png