예제 #1
0
def test_abbr(name='Padova'):
    """ Test that parameters can be set by abbreviation. """
    iso = isochrone.factory(name,**abbr_kwargs)

    for k,v in abbr_kwargs.items():
        setattr(iso,k,v)

    for k,v in abbr_kwargs.items():
        iso.setp(k,v)
예제 #2
0
def test_abbr(name='Padova'):
    """ Test that parameters can be set by abbreviation. """
    iso = isochrone.factory(name, **abbr_kwargs)

    for k, v in abbr_kwargs.items():
        setattr(iso, k, v)

    for k, v in abbr_kwargs.items():
        iso.setp(k, v)
예제 #3
0
def test_composite():
    isochrones = [
        dict(name='Padova',**default_kwargs),
        dict(name='Dotter',**default_kwargs)
    ]
    iso = isochrone.factory("Composite",isochrones=isochrones)

    iso.distance_modulus = alt_kwargs['distance_modulus']
    assert iso.distance_modulus == alt_kwargs['distance_modulus']

    assert np.all(iso.age == np.ones(len(isochrones))*default_kwargs['age'])
    assert np.all(iso.metallicity == np.ones(len(isochrones))*default_kwargs['metallicity'])
    
    iso.sample()
예제 #4
0
def test_download():
    """Test isochrone download."""
    try:
        from urllib.error import URLError
    except ImportError:
        from urllib2 import URLError

    for name in dotter[1:]: #padova[1:]+dotter[1:]:
        iso = isochrone.factory(name,**default_kwargs)
        try:
            iso.download(outdir='./tmp/'+name.lower(),force=True)
        except URLError as e:
            logger.error("%s: Server is down.\n%s"%(name,str(e)))
        except RuntimeError as e:
            logger.error("%s: %s"%(name,str(e)))
예제 #5
0
def test_composite():
    isochrones = [
        dict(name='Padova', **default_kwargs),
        dict(name='Dotter', **default_kwargs)
    ]
    iso = isochrone.factory("Composite", isochrones=isochrones)

    iso.distance_modulus = alt_kwargs['distance_modulus']
    assert iso.distance_modulus == alt_kwargs['distance_modulus']

    assert np.all(iso.age == np.ones(len(isochrones)) * default_kwargs['age'])
    assert np.all(iso.metallicity == np.ones(len(isochrones)) *
                  default_kwargs['metallicity'])

    iso.sample()
예제 #6
0
def test_download():
    """Test isochrone download."""
    try:
        from urllib.error import URLError
    except ImportError:
        from urllib2 import URLError

    for name in dotter[1:]:  #padova[1:]+dotter[1:]:
        iso = isochrone.factory(name, **default_kwargs)
        try:
            iso.download(outdir='./tmp/' + name.lower(), force=True)
        except URLError as e:
            logger.error("%s: Server is down.\n%s" % (name, str(e)))
        except RuntimeError as e:
            logger.error("%s: %s" % (name, str(e)))
예제 #7
0
def set_parameters(name):
    iso = isochrone.factory(name,**default_kwargs)

    # Test that parameters are set in construction
    for k,v in default_kwargs.items():
        assert getattr(iso,k) == v

    # Test that parameters are set through setattr
    for k,v in alt_kwargs.items():
        setattr(iso,k,v)
        assert getattr(iso,k) == v

    # Test that parameters are set through setp
    for k,v in default_kwargs.items():
        iso.setp(k,v)
        assert getattr(iso,k) == v

    iso.sample()
예제 #8
0
def set_parameters(name):
    iso = isochrone.factory(name, **default_kwargs)

    # Test that parameters are set in construction
    for k, v in default_kwargs.items():
        assert getattr(iso, k) == v

    # Test that parameters are set through setattr
    for k, v in alt_kwargs.items():
        setattr(iso, k, v)
        assert getattr(iso, k) == v

    # Test that parameters are set through setp
    for k, v in default_kwargs.items():
        iso.setp(k, v)
        assert getattr(iso, k) == v

    iso.sample()
예제 #9
0
def test_surveys():
    """ Create isochrones with different surveys """
    for s in survey:
        for name in ['Dotter2016']:
            iso = isochrone.factory(name,survey=s)
예제 #10
0
def test_surveys():
    """ Create isochrones with different surveys """
    for s in survey:
        for name in ['Dotter2016']:
            iso = isochrone.factory(name, survey=s)