Skip to content

Commit

Permalink
update CSP magsystem test for latest filter zps
Browse files Browse the repository at this point in the history
  • Loading branch information
kbarbary committed Apr 13, 2017
1 parent db09784 commit 082d1e2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 46 deletions.
35 changes: 19 additions & 16 deletions sncosmo/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,22 +715,25 @@ def load_spectral_magsys_fits(relpath, name=None):


def load_csp(name=None):

# this file contains the csp zeropoints and standards
fname = get_pkg_data_filename('data/bandpasses/csp/csp_filter_info.dat')
data = np.genfromtxt(fname, names=True, dtype=None, skip_header=3)
bandnames = data['name']
refsystems = data['reference_sed']
offsets = data['natural_mag']

# In Python 3, convert to native strings (Unicode)
if six.PY3:
bandnames = np.char.decode(bandnames)
refsystems = np.char.decode(refsystems)

bands = {name: (magsys, offset) for name, magsys, offset in
zip(bandnames, refsystems, offsets)}
return CompositeMagSystem(bands=bands, name=name)
# Values transcribed from
# http://csp.obs.carnegiescience.edu/data/filters
# on 13 April 2017
return CompositeMagSystem(bands={'cspu': ('bd17', 10.519),
'cspg': ('bd17', 9.644),
'cspr': ('bd17', 9.352),
'cspi': ('bd17', 9.250),
'cspb': ('vega', 0.030),
'cspv3014': ('vega', 0.0096),
'cspv3009': ('vega', 0.0096),
'cspv9844': ('vega', 0.0096),
'cspys': ('vega', 0.),
'cspjs': ('vega', 0.),
'csphs': ('vega', 0.),
'cspk': ('vega', 0.),
'cspyd': ('vega', 0.),
'cspjd': ('vega', 0.),
'csphd': ('vega', 0.)},
name=name)


def load_ab_b12(name=None):
Expand Down
20 changes: 0 additions & 20 deletions sncosmo/data/bandpasses/csp/csp_filter_info.dat

This file was deleted.

22 changes: 12 additions & 10 deletions sncosmo/tests/test_magsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,21 @@ def test_spectralmagsystem():
def test_csp_magsystem():
csp = sncosmo.get_magsystem('csp')

# filter zeropoints (copied from file)
zps = {"cspu": 13.044,
"cspg": 15.135,
"cspr": 14.915,
"cspi": 14.781,
"cspb": 14.344,
"cspv3014": 14.540,
"cspv3009": 14.493,
"cspv9844": 14.450,
# filter zeropoints (copied from
# http://csp.obs.carnegiescience.edu/data/filters
# on 13 April 2017)
zps = {"cspu": 12.986,
"cspg": 15.111,
"cspr": 14.902,
"cspi": 14.535,
"cspb": 14.328,
"cspv3014": 14.437,
"cspv3009": 14.388,
"cspv9844": 14.439,
"cspys": 13.921,
"cspjs": 13.836,
"csphs": 13.510,
"cspk": 11.967,
"cspk": 11.968,
"cspyd": 13.770,
"cspjd": 13.866,
"csphd": 13.502}
Expand Down

0 comments on commit 082d1e2

Please sign in to comment.