def addAerosol(atmosphere, X, tau0=0.05, alpha=1.0, wavelen0=440.0, plotAtmosphere=True): # Calculate the aerosol contribution -- sb with aerosols = sb*exp(-tau) tau = tau0 * np.power((wavelen0/atmosphere.wavelen), alpha) # Generate new atmosphere bandpass with aerosols. atmosphere_aerosol = Bandpass() atmosphere_aerosol.setBandpass(wavelen = atmosphere.wavelen, sb = atmosphere.sb * np.exp(-tau*X)) if plotAtmosphere: # Plot for a check: atmodict = {'Original atmosphere':atmosphere, 'With aerosols': atmosphere_aerosol} bu.plotBandpasses(atmodict) return atmosphere_aerosol
def addAerosol(atmosphere, X, tau0=0.05, alpha=1.0, wavelen0=440.0, plotAtmosphere=True): # Calculate the aerosol contribution -- sb with aerosols = sb*exp(-tau) tau = tau0 * np.power((wavelen0 / atmosphere.wavelen), alpha) # Generate new atmosphere bandpass with aerosols. atmosphere_aerosol = Bandpass() atmosphere_aerosol.setBandpass(wavelen=atmosphere.wavelen, sb=atmosphere.sb * np.exp(-tau * X)) if plotAtmosphere: # Plot for a check: atmodict = { 'Original atmosphere': atmosphere, 'With aerosols': atmosphere_aerosol } bu.plotBandpasses(atmodict) return atmosphere_aerosol
# Build the separate vendor detectors. qevendors = {} # Add losses into the throughputs? addLosses = True qevendors['loss'] = {} # Vendor 1 qevendors['loss'][1] = bu.buildVendorDetector( os.path.join(defaultDirs['detector'], 'vendor1'), addLosses) # Vendor 2 qevendors['loss'][2] = bu.buildVendorDetector( os.path.join(defaultDirs['detector'], 'vendor2'), addLosses) # Generic 'minimum' detector throughputs. qevendors['loss']['Min'] = bu.buildDetector(defaultDirs['detector'], addLosses) bu.plotBandpasses(qevendors['loss'], title='Combining Vendor Detector Responses Losses') qevendors['noloss'] = {} # Add losses into the throughputs? addLosses = False # Build the separate vendor detectors. # Vendor 1 qevendors['noloss'][1] = bu.buildVendorDetector( os.path.join(defaultDirs['detector'], 'vendor1'), addLosses) # Vendor 2 qevendors['noloss'][2] = bu.buildVendorDetector( os.path.join(defaultDirs['detector'], 'vendor2'), addLosses) # Generic 'minimum' detector throughputs. qevendors['noloss']['Min'] = bu.buildDetector(defaultDirs['detector'], addLosses) bu.plotBandpasses(qevendors['noloss'],
# Get the names of the directories containing each component. # (returns a dictionary). defaultDirs = bu.setDefaultDirs(rootDir = '..') # Build the separate vendor detectors. qevendors = {} # Add losses into the throughputs? addLosses=True qevendors['loss'] = {} # Vendor 1 qevendors['loss'][1] = bu.buildVendorDetector(os.path.join(defaultDirs['detector'], 'vendor1'), addLosses) # Vendor 2 qevendors['loss'][2] = bu.buildVendorDetector(os.path.join(defaultDirs['detector'], 'vendor2'), addLosses) # Generic 'minimum' detector throughputs. qevendors['loss']['Min'] = bu.buildDetector(defaultDirs['detector'], addLosses) bu.plotBandpasses(qevendors['loss'], title='Combining Vendor Detector Responses Losses') qevendors['noloss'] = {} # Add losses into the throughputs? addLosses = False # Build the separate vendor detectors. # Vendor 1 qevendors['noloss'][1] = bu.buildVendorDetector(os.path.join(defaultDirs['detector'], 'vendor1'), addLosses) # Vendor 2 qevendors['noloss'][2] = bu.buildVendorDetector(os.path.join(defaultDirs['detector'], 'vendor2'), addLosses) # Generic 'minimum' detector throughputs. qevendors['noloss']['Min'] = bu.buildDetector(defaultDirs['detector'], addLosses) bu.plotBandpasses(qevendors['noloss'], title='Combining Vendor Detector Responses No Losses')
defaultDirs = bu.setDefaultDirs() addLosses = True allPlots = False photParams = PhotometricParameters() lsstDefaults = LSSTdefaults() # Build the detectors. qevendors = {} qevendors[1] = bu.buildVendorDetector(os.path.join(defaultDirs['detector'], 'vendor1'), addLosses) qevendors[2] = bu.buildVendorDetector(os.path.join(defaultDirs['detector'], 'vendor2'), addLosses) qevendors['combo'] = bu.buildGenericDetector(defaultDirs['detector'], addLosses) if allPlots: bu.plotBandpasses(qevendors, title='Vendor Detector Responses') # Build the other components. lens1 = bu.buildLens(defaultDirs['lens1'], addLosses) lens2 = bu.buildLens(defaultDirs['lens2'], addLosses) lens3 = bu.buildLens(defaultDirs['lens3'], addLosses) filters = bu.buildFilters(defaultDirs['filters'], addLosses) mirror1 = bu.buildMirror(defaultDirs['mirror1'], addLosses) mirror2 = bu.buildMirror(defaultDirs['mirror2'], addLosses) mirror3 = bu.buildMirror(defaultDirs['mirror3'], addLosses) atmosphere = bu.buildAtmosphere(defaultDirs['atmosphere']) # Plot all components. if allPlots: plt.figure() plt.plot(qevendors['combo'].wavelen, qevendors['combo'].sb, 'k-', linewidth=2, label='Detector')
# Add losses into the throughputs? addLosses = True throughputs = {} # Build the separate vendor detectors. qevendors = {} # Vendor 1 qevendors[1] = bu.buildVendorDetector(os.path.join(defaultDirs['detector'], 'vendor1'), addLosses) # Vendor 2 qevendors[2] = bu.buildVendorDetector(os.path.join(defaultDirs['detector'], 'vendor2'), addLosses) # Generic 'minimum' detector throughputs. qevendors['Min'] = bu.buildDetector(defaultDirs['detector'], addLosses) throughputs['detector'] = qevendors['Min'] bu.plotBandpasses(qevendors, title='Combining Vendor Detector Responses') # Read the previously generated 'intermediate' file and plot the comparison. comparison = Bandpass() oldDetector = '../intermediateFiles/components/camera/detThroughput.dat' comparison.readThroughput(oldDetector) # Plot old and new detectors. plotDict = {'New Detector':throughputs['detector'], 'Old Detector':comparison} bu.plotBandpasses(plotDict, title='Compare Detector Throughputs') # Build and compare the lens throughput curves, for lens1/2/3. for lens in ('lens1', 'lens2', 'lens3'): throughputs[lens] = bu.buildLens(defaultDirs[lens], addLosses) # Read the old intermediate file version. comparison.readThroughput('../intermediateFiles/components/camera/%sThroughput.dat' %(lens))
addLosses = True throughputs = {} # Build the separate vendor detectors. qevendors = {} # Vendor 1 qevendors[1] = bu.buildVendorDetector( os.path.join(defaultDirs['detector'], 'vendor1'), addLosses) # Vendor 2 qevendors[2] = bu.buildVendorDetector( os.path.join(defaultDirs['detector'], 'vendor2'), addLosses) # Generic 'minimum' detector throughputs. qevendors['Min'] = bu.buildDetector(defaultDirs['detector'], addLosses) throughputs['detector'] = qevendors['Min'] bu.plotBandpasses(qevendors, title='Combining Vendor Detector Responses') # Read the previously generated 'intermediate' file and plot the comparison. comparison = Bandpass() oldDetector = '../intermediateFiles/components/camera/detThroughput.dat' comparison.readThroughput(oldDetector) # Plot old and new detectors. plotDict = { 'New Detector': throughputs['detector'], 'Old Detector': comparison } bu.plotBandpasses(plotDict, title='Compare Detector Throughputs') # Build and compare the lens throughput curves, for lens1/2/3. for lens in ('lens1', 'lens2', 'lens3'): throughputs[lens] = bu.buildLens(defaultDirs[lens], addLosses)