Exemplo n.º 1
0
def build_coeff_tables():
    """
    Use the latest throughput values to build Table 2. Requires LSST stack installed and
    syseng_throughputs setup
    """
    from calcM5 import calcM5
    import bandpassUtils as bu
    from lsst.utils import getPackageDir
    defaultDirs = bu.setDefaultDirs(
        rootDir=getPackageDir('syseng_throughputs'))
    addLosses = True
    atmosphere = bu.readAtmosphere(defaultDirs['atmosphere'],
                                   atmosFile='atmos_10_aerosol.dat')
    hardware, system = bu.buildHardwareAndSystem(defaultDirs,
                                                 addLosses,
                                                 atmosphereOverride=atmosphere)
    m5_vals = calcM5(hardware,
                     system,
                     atmosphere,
                     title='',
                     return_t2_values=True)
    np.savez('m5_vals.npz', m5_vals=m5_vals)
    # end of dark sky legend line
    plt.legend(loc=(0.01, 0.69), handles=handles, fancybox=True, numpoints=1, fontsize='small')
    plt.ylim(0, 1)
    plt.xlim(300, 1100)
    plt.xlabel('Wavelength (nm)')
    plt.ylabel('Fractional Throughput Response')
    plt.title('System total response curves %s' %(title))
    return m5


if __name__ == '__main__':

    # Set the directories for each component.
    # Note that this sets the detector to be the 'generic detector' (minimum of each vendor).
    throughputDir = os.getenv('LSST_THROUGHPUTS_DEFAULT')
    defaultDirs = bu.setDefaultDirs()

    # Build the system and hardware throughput curves (without aerosols, with X=1.0).
    atmosphere = bu.readAtmosphere(defaultDirs['atmosphere'], atmosFile='atmos_10_aerosol.dat')
    hardware = {}
    system = {}
    for f in ['u', 'g', 'r', 'i', 'z', 'y']:
        hardware[f] = Bandpass()
        system[f] = Bandpass()
        hardware[f].readThroughputList(componentList=['detector.dat', 'filter_'+f+'.dat','lens1.dat', 'lens2.dat', 'lens3.dat', 'm1.dat', 'm2.dat', 'm3.dat'],
                                       rootDir=throughputDir)
        system[f].wavelen, system[f].sb = hardware[f].multiplyThroughputs(atmosphere.wavelen, atmosphere.sb)

    m5 = calcM5(hardware, system, atmosphere, title='')

Exemplo n.º 3
0
    else:
        fwhm_system = 0.4 * airmass_correction
        fwhm_atmo = fwhm_500 * wavelen_correction * airmass_correction
    # Calculate combined FWHMeff.
    fwhm_eff = 1.16 * np.sqrt(fwhm_system**2 + 1.04 * fwhm_atmo**2)
    # Translate to FWHMgeom.
    fwhm_geom = 0.822 * fwhm_eff + 0.052
    return fwhm_eff, fwhm_geom



if __name__ == '__main__':

    # Set the directories for each component.
    # Note that this sets the detector to be the 'generic detector' (minimum of each vendor).
    defaultDirs = bu.setDefaultDirs(rootDir = '..')
    # To use a particular vendor, uncomment one of the following lines or edit as necessary.
    # defaultDirs['detector'] = 'vendor1'
    # defaultDirs['detector'] = 'vendor2'

    # Add losses to each component?
    addLosses = True

    # Build the system and hardware throughput curves (without aerosols, with X=1.0).
    #atmosphere = bu.readAtmosphere(defaultDirs['atmosphere'], atmosFile='atmos_10.dat')
    #hardware, system = bu.buildHardwareAndSystem(defaultDirs, addLosses, atmosphereOverride=atmosphere)
    #m5 = calcM5(hardware, system, atmosphere, title='')

    atmosphere = bu.readAtmosphere(defaultDirs['atmosphere'], atmosFile='atmos_10_aerosol.dat')
    hardware, system = bu.buildHardwareAndSystem(defaultDirs, addLosses, atmosphereOverride=atmosphere)
    m5 = calcM5(hardware, system, atmosphere, title='')
import numpy as np
from lsst.sims.photUtils import Bandpass, Sed
import bandpassUtils as bu

# throughput files:
# atmos_std.dat, atmos_10.dat
# darksky.dat
# detector.dat
# filter_[ugrizy].dat
# lens[123].dat
# m[123].dat
# total_[ugrizy].dat
# hardware_[ugrizy].dat

# Read the data needed from the syseng_throughput repo.
defaultDirs = bu.setDefaultDirs()
addLosses = True

detector = bu.buildDetector(defaultDirs['detector'], addLosses)
filters = bu.buildFilters(defaultDirs['filters'], addLosses)
lens1 = bu.buildLens(defaultDirs['lens1'], addLosses)
lens2 = bu.buildLens(defaultDirs['lens2'], addLosses)
lens3 = bu.buildLens(defaultDirs['lens3'], addLosses)
m1 = bu.buildMirror(defaultDirs['mirror1'], addLosses)
m2 = bu.buildMirror(defaultDirs['mirror2'], addLosses)
m3 = bu.buildMirror(defaultDirs['mirror3'], addLosses)
atmos_std = bu.readAtmosphere(defaultDirs['atmosphere'],
                              atmosFile='pachonModtranAtm_12_aerosol.dat')
atmos_10 = bu.readAtmosphere(defaultDirs['atmosphere'],
                             atmosFile='atmos_10_aerosol.dat')
darksky = Sed()
Exemplo n.º 5
0
from lsst.sims.photUtils import Bandpass
import bandpassUtils as bu

# This script will combine the individual components of the camera and telescope,
# generating all intermediate files as well as final combined system and hardware curves.
#  Note that it does NOT replace the files in $SYSENG_THROUGHPUTS/intermediateFiles,
#  but merely uses those files as a comparison point, making plots that compare the
#  new values to the old ones.
# If you DO you want to replace the intermediate files, look at the ipython notebooks.


if __name__ == '__main__':

    # 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')

    # end of dark sky legend line
    plt.legend(loc=(0.01, 0.69), handles=handles, fancybox=True, numpoints=1, fontsize="small")
    plt.ylim(0, 1)
    plt.xlim(300, 1100)
    plt.xlabel("Wavelength (nm)")
    plt.ylabel("Fractional Throughput Response")
    if title == "Vendor combo":
        title = ""
    plt.title("System total response curves %s" % (title))
    plt.savefig("../plots/system+sky" + title + ".png", format="png", dpi=600)
    return m5


if __name__ == "__main__":

    defaultDirs = bu.setDefaultDirs(rootDir="..")
    addLosses = True

    hardware = {}
    system = {}
    m5 = {}
    atmosphere = bu.readAtmosphere(defaultDirs["atmosphere"], atmosFile="atmos_10_aerosol.dat")
    hardware["combo"], system["combo"] = bu.buildHardwareAndSystem(defaultDirs, atmosphereOverride=atmosphere)
    m5["combo"] = calcM5(hardware["combo"], system["combo"], atmosphere, title="combo")
    genericDetector = defaultDirs["detector"]
    for det in [1, 2]:
        defaultDirs["detector"] = os.path.join(genericDetector, "vendor%d" % det)
        hardware[det], system[det] = bu.buildHardwareAndSystem(defaultDirs, atmosphereOverride=atmosphere)
        m5[det] = calcM5(hardware[det], system[det], atmosphere, title="vendor%d" % (det))

    # Show what these look like (print m5 limits on throughput curves)