Skip to content

Commit

Permalink
Renamed the SpectralIP class into SIS.
Browse files Browse the repository at this point in the history
  • Loading branch information
hpparvi committed Aug 6, 2015
1 parent f494cfa commit 2bd5474
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ docs/_build/

# PyBuilder
target/

*~
notebooks/.ipynb_checkpoints/
12 changes: 7 additions & 5 deletions src/ldtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
if not exists(ldtk_cache):
os.mkdir(ldtk_cache)


## Constants
## =========

Expand Down Expand Up @@ -430,9 +430,11 @@ def filter_names(self):
## Utility classes
## ===============

class SpectralIP(object):
def __init__(self, dfile):
with pf.open(dfile) as hdul:
class SIS(object):
"""Simple wrapper for a specific intensity spectrum file."""
def __init__(self, fname):
self.filename = fname
with pf.open(fname) as hdul:
self.wl0 = hdul[0].header['crval1'] * 1e-1 # Wavelength at d[:,0] [nm]
self.dwl = hdul[0].header['cdelt1'] * 1e-1 # Delta wavelength [nm]
self.nwl = hdul[0].header['naxis1'] # Number of samples
Expand All @@ -441,7 +443,7 @@ def __init__(self, dfile):
self.z = sqrt(1-self.mu**2)
self.wl = self.wl0 + arange(self.nwl)*self.dwl

def intensity_profile(self, l0, l1):
def intensity_profile(self, l0=0, l1=1e5):
ip = self.data[:,(self.wl>l0)&(self.wl<l1)].mean(1)
return ip/ip[-1]

Expand Down

0 comments on commit 2bd5474

Please sign in to comment.