Exemple #1
0
from sncosmo.magsystems import _MAGSYSTEMS
from sncosmo.models import _SOURCES
"""Test downloading all of the builtins

These tests download lots of files (~1.2 GB as of Oct. 12, 2021) so they
aren't included by default with the regular tests. They can be run with
`tox -e builtins`. This will make sure that the downloads happen in a clean
environment without any caching.
"""

bandpasses = [i['name'] for i in _BANDPASSES.get_loaders_metadata()]
bandpass_interpolators = [
    i['name'] for i in _BANDPASS_INTERPOLATORS.get_loaders_metadata()
]
magsystems = [i['name'] for i in _MAGSYSTEMS.get_loaders_metadata()]
sources = [(i['name'], i['version']) for i in _SOURCES.get_loaders_metadata()]


@pytest.mark.might_download
@pytest.mark.parametrize("name", bandpasses)
def test_builtin_bandpass(name):
    sncosmo.get_bandpass(name)


@pytest.mark.might_download
@pytest.mark.parametrize("name", bandpass_interpolators)
def test_builtin_bandpass_interpolator(name):
    interpolator = _BANDPASS_INTERPOLATORS.retrieve(name)
    interpolator.at(interpolator.minpos())

Exemple #2
0
from astropy.extern import six
from sncosmo.models import _SOURCES


lines = [
    '',
    '  '.join([20*'=', 7*'=', 10*'=', 27*'=', 30*'=', 7*'=', 20*'=']),
    '{0:20}  {1:7}  {2:10}  {3:27}  {4:30}  {5:7}  {6:50}'.format(
        'Name', 'Version', 'Type', 'Subclass', 'Reference', 'Website', 'Notes')
    ]
lines.append(lines[1])

urlnums = {}
allnotes = []
allrefs = []
for m in _SOURCES.get_loaders_metadata():

    reflink = ''
    urllink = ''
    notelink = ''

    if 'note' in m:
        if m['note'] not in allnotes:
            allnotes.append(m['note'])
        notenum = allnotes.index(m['note'])
        notelink = '[{0}]_'.format(notenum + 1)

    if 'reference' in m:
        reflink = '[{0}]_'.format(m['reference'][0])
        if m['reference'] not in allrefs:
            allrefs.append(m['reference'])
Exemple #3
0
import string

from sncosmo.models import _SOURCES

lines = [
    '', '  '.join(
        [20 * '=', 7 * '=', 10 * '=', 27 * '=', 30 * '=', 7 * '=', 20 * '=']),
    '{0:20}  {1:7}  {2:10}  {3:27}  {4:30}  {5:7}  {6:50}'.format(
        'Name', 'Version', 'Type', 'Subclass', 'Reference', 'Website', 'Notes')
]
lines.append(lines[1])

urlnums = {}
allnotes = []
allrefs = []
for m in _SOURCES.get_loaders_metadata():

    reflink = ''
    urllink = ''
    notelink = ''

    if 'note' in m:
        if m['note'] not in allnotes:
            allnotes.append(m['note'])
        notenum = allnotes.index(m['note'])
        notelink = '[{0}]_'.format(notenum + 1)

    if 'reference' in m:
        reflink = '[{0}]_'.format(m['reference'][0])
        if m['reference'] not in allrefs:
            allrefs.append(m['reference'])