本文整理汇总了Python中lsst.sims.photUtils.Bandpass.multiplyThroughputs方法的典型用法代码示例。如果您正苦于以下问题:Python Bandpass.multiplyThroughputs方法的具体用法?Python Bandpass.multiplyThroughputs怎么用?Python Bandpass.multiplyThroughputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lsst.sims.photUtils.Bandpass
的用法示例。
在下文中一共展示了Bandpass.multiplyThroughputs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildMirror
# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import multiplyThroughputs [as 别名]
def buildMirror(mirrorDir, addLosses=True):
"""
Build a mirror throughput curve.
Assumes there are *Losses.dat subdirectory with loss files
and a m*_Ideal.dat file with the mirror throughput.
Returns a bandpass object.
If addLosses is True, the *_Ideal.dat file is multiplied by the *_Losses/*.dat files.
"""
# Read the mirror reflectance curve.
mirrorfile = glob(os.path.join(mirrorDir, 'm*Ideal.dat'))
if len(mirrorfile) != 1:
raise ValueError('Expected a single mirror file in directory %s, found: ' %mirrorDir, mirrorfile)
mirrorfile = mirrorfile[0]
mirror = Bandpass()
mirror.readThroughput(mirrorfile)
if addLosses:
loss = _readLosses(mirrorDir)
wavelen, sb = mirror.multiplyThroughputs(loss.wavelen, loss.sb)
mirror.setBandpass(wavelen, sb)
# Verify that no values go significantly below zero.
belowzero = np.where(mirror.sb < 0)
# If there are QE values significantly < 0, raise an exception.
if mirror.sb[belowzero] < belowZeroThreshhold:
raise ValueError('Found values in mirror response significantly below zero')
# If they are just small errors in interpolation, set to zero.
mirror.sb[belowzero] = 0
return mirror
示例2: buildVendorDetector
# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import multiplyThroughputs [as 别名]
def buildVendorDetector(vendorDir, addLosses=True):
"""
Builds a detector response from the files in vendorDir, by reading the *_QE.dat
and *_Losses subdirectory for a single version of the detector.
Returns a Bandpass object.
If addLosses is True, the QE curve is multiplied by the losses in the *Losses.dat files.
If addLosses is False, the QE curve does not have any losses included.
"""
# Read the QE file.
qefile = glob(os.path.join(vendorDir, '*_QE.dat'))
if len(qefile) != 1:
raise ValueError('Expected a single QE file in this directory, found: ', qefile)
qefile = qefile[0]
qe = Bandpass()
qe.readThroughput(qefile)
if addLosses:
loss = _readLosses(vendorDir)
wavelength, sb = qe.multiplyThroughputs(loss.wavelen, loss.sb)
qe.setBandpass(wavelength, sb)
# Verify that no values go significantly below zero.
belowzero = np.where(qe.sb < 0)
# If there are QE values significantly < 0, raise an exception.
if qe.sb[belowzero] < belowZeroThreshhold:
raise ValueError('Found values in QE response significantly below zero.')
# If they are just small errors in interpolation, set to zero.
qe.sb[belowzero] = 0
return qe
示例3: buildLens
# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import multiplyThroughputs [as 别名]
def buildLens(lensDir, addLosses=True):
"""
Build the lens throughput curve from the files in lensDir.
Returns a bandpass object.
The coatings for the lens are in *_Coatings, the loss files are in *_Losses.
The borosilicate glass throughput is in l*_Glass.dat; this file is smoothed using the
savitzsky_golay function.
The glass response is multiplied by the coatings and (if addLosses is True),
also the loss curves.
"""
lens = Bandpass()
# Read the glass base file.
glassfile = glob(os.path.join(lensDir, 'l*_Glass.dat'))
if len(glassfile) != 1:
raise ValueError('Expected a single glass file in this directory, found: ', glassfile)
glassfile = glassfile[0]
glass = Bandpass()
glass.readThroughput(glassfile)
# Smooth the glass response.
smoothSb = savitzky_golay(glass.sb, 31, 3)
lens = Bandpass()
lens.setBandpass(glass.wavelen, smoothSb)
# Read the broad band antireflective (BBAR) coatings files.
bbars = _readCoatings(lensDir)
# Multiply the bbars by the glass.
wavelen, sb = lens.multiplyThroughputs(bbars.wavelen, bbars.sb)
lens.setBandpass(wavelen, sb)
# Add losses.
if addLosses:
loss = _readLosses(lensDir)
wavelen, sb = lens.multiplyThroughputs(loss.wavelen, loss.sb)
lens.setBandpass(wavelen, sb)
# Verify that no values go significantly below zero.
belowzero = np.where(lens.sb < 0)
# If there are QE values significantly < 0, raise an exception.
if lens.sb[belowzero] < belowZeroThreshhold:
raise ValueError('Found values in lens throughput significantly below zero.')
# If they are just small errors in interpolation, set to zero.
lens.sb[belowzero] = 0
return lens