diff --git a/.travis.yml b/.travis.yml index fba9eb4..4f0676f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: python python: - "2.7" - - "3.4" + - "3.6" # - "nightly" # currently points to 3.6-dev sudo: false @@ -30,4 +30,4 @@ script: - export MPLBACKEND=Agg - nosetests -v tests/test_skymap.py - nosetests -v tests/test_density.py - - nosetests -v tests/test_jcalc.py \ No newline at end of file + - nosetests -v tests/test_jcalc.py diff --git a/dmsky/data/targets/dwarfs/defaults.yaml b/dmsky/data/targets/dwarfs/defaults.yaml index 8f96d0a..4b63fe4 100644 --- a/dmsky/data/targets/dwarfs/defaults.yaml +++ b/dmsky/data/targets/dwarfs/defaults.yaml @@ -902,7 +902,7 @@ carina_III: name: 'carina_III' color: 'cyan' ra: 114.6298 - dec: −57.8997 + dec: 57.8997 distance: 27.8 dsigma: 0.6 major_axis: 3.75 diff --git a/dmsky/data/targets/dwarfs/koposov2018.yaml b/dmsky/data/targets/dwarfs/koposov2018.yaml index 259dff6..9d6fb36 100644 --- a/dmsky/data/targets/dwarfs/koposov2018.yaml +++ b/dmsky/data/targets/dwarfs/koposov2018.yaml @@ -1,7 +1,7 @@ # https://arxiv.org/abs/1804.06430 hydrus_I: # Table 1 in Koposov et al. 2018 - # log10(J(0.5deg)) = 18.33 [+0.38,−0.34] + # log10(J(0.5deg)) = 18.33 [+0.38,0.34] koposov2018_nfw: j_integ: 2.14e18 j_sigma: 0.36 diff --git a/dmsky/library.py b/dmsky/library.py index 77857f4..723cbcc 100644 --- a/dmsky/library.py +++ b/dmsky/library.py @@ -84,7 +84,11 @@ def load_library(cls, paths): for path in paths: # Should use logging print("Using %s for %s" % (path, cls.__name__)) - subdirs = [path] + next(os.walk(path))[1] + try: + subdirs = [path] + next(os.walk(path))[1] + except StopIteration: + print("Path %s does have any subdirectories" % path) + pass for subdir in subdirs: infiles = glob.glob(join(path, subdir) + '/*.yaml') for f in infiles: diff --git a/dmsky/utils/tools.py b/dmsky/utils/tools.py index 827ad01..4ff8093 100644 --- a/dmsky/utils/tools.py +++ b/dmsky/utils/tools.py @@ -14,7 +14,7 @@ def yaml_load(filename): raise Exception('File does not exist: %s' % (filename)) try: ret = yaml.load(open(filename), Loader=yaml.CLoader) - except IOError: + except (IOError, AttributeError): ret = yaml.load(open(filename), Loader=yaml.Loader) return ret @@ -33,7 +33,7 @@ def yaml_dump(x, filename): try: out.write(yaml.dump(x, Dumper=yaml.CDumper)) - except IOError: + except (IOError, AttributeError): out.write(yaml.dump(x, Dumper=yaml.Dumper)) out.close() diff --git a/tests/test_density.py b/tests/test_density.py index 6462f76..0cd07d0 100644 --- a/tests/test_density.py +++ b/tests/test_density.py @@ -26,15 +26,17 @@ # Plot the different profiles def test_densities(): fig,ax = plt.subplots() + y_min = 1e-4 for i,cls in enumerate(classes): if cls == 'DensityProfile': continue dp = dmsky.density.factory(cls) dp.set_rho_r(1,dp.rs) + denp = dp(radius).clip(y_min, np.inf) print(dp) # Small offset for visualization epsilon = i*0.2e-1 #epsilon = 0 - plt.plot(radius,dp(radius) * (1+epsilon),'-',label=cls) + plt.plot(radius, denp * (1+epsilon),'-',label=cls) print('') ax.set_yscale('log') ax.set_xscale('log')