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)
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)
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()
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)))
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()
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)))
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()
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()
def test_surveys(): """ Create isochrones with different surveys """ for s in survey: for name in ['Dotter2016']: iso = isochrone.factory(name,survey=s)
def test_surveys(): """ Create isochrones with different surveys """ for s in survey: for name in ['Dotter2016']: iso = isochrone.factory(name, survey=s)