Skip to content

Commit

Permalink
Merge pull request #17 from fermiPy/dmcat-dev
Browse files Browse the repository at this point in the history
Dmcat dev
  • Loading branch information
eacharles authored Jul 9, 2019
2 parents 04d94b5 + d4b89ed commit 69fcf83
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: python

python:
- "2.7"
- "3.4"
- "3.6"
# - "nightly" # currently points to 3.6-dev

sudo: false
Expand Down Expand Up @@ -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
- nosetests -v tests/test_jcalc.py
2 changes: 1 addition & 1 deletion dmsky/data/targets/dwarfs/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dmsky/data/targets/dwarfs/koposov2018.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 5 additions & 1 deletion dmsky/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions dmsky/utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()

Expand Down
4 changes: 3 additions & 1 deletion tests/test_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 69fcf83

Please sign in to comment.