Пример #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)
Пример #2
0
    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='')


    plt.show()
        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)
    plt.figure()
    for f in filterlist:
        for det in [1, 2]:
            if det == 1:
                linestyle = ":"
                spacer = " "
            else:
Пример #4
0
                os.path.join(throughputDir,
                             'atmos/atmos_%d.dat' % (int(X * 10))))

    atmoskeys = sorted(atmos.keys())
    print title
    print '    %s' % ('    '.join(atmoskeys))
    system = Bandpass()
    effsb = {}
    for f in ['u', 'g', 'r', 'i', 'z', 'y']:
        writestring = '%s ' % f
        for k in atmoskeys:
            system.wavelen, system.sb = hardware[f].multiplyThroughputs(
                atmos[k].wavelen, atmos[k].sb)
            effphi, effsb[k] = system.calcEffWavelen()
            writestring += '%.2f ' % (effsb[k])
        print writestring


if __name__ == '__main__':

    defaultDirs = bu.setDefaultDirs(rootDir='..')
    # To use a particular vendor's detector response curve, uncomment one of the lines below
    defaultDetector = defaultDirs['detector']
    #defaultDirs['detector'] = os.path.join(defaultDetector, 'vendor1')
    #defaultDirs['detector'] = os.path.join(defaultDetector, 'vendor2')

    addLosses = True

    hardware, system = bu.buildHardwareAndSystem(defaultDirs, addLosses)
    calcEffWavelen(hardware, 'Min: Std Atmo')
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()
darksky.readSED_flambda(os.path.join(defaultDirs['atmosphere'], 'darksky.dat'))
hardware, system = bu.buildHardwareAndSystem(defaultDirs, addLosses=addLosses, atmosphereOverride=atmos_std)

# Write the data to disk.
outDir = 'baseline'
if not os.path.isdir(outDir):
    os.makedirs(outDir)

version = subprocess.check_output(['git', 'describe']).strip()
sha1 = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip()
print "version", version, "sha1", sha1
versioninfo = '# Version %s\n'%(version)
versioninfo += '# sha1 %s\n' %(sha1)

header = '# LSST Throughputs files created from syseng_throughputs repo\n'
header += versioninfo
        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)
    plt.figure()
    for f in filterlist:
        for det in [1, 2]:
            if det == 1:
                linestyle = ':'
                spacer= ' '
            else:
    # Plot all components.
    bu.plotBandpasses(throughputs, title='All components')

    # Combine components by hand. Compare to combination returned from bandpassUtils.
    core_sb = (throughputs['detector'].sb * throughputs['lens1'].sb * throughputs['lens2'].sb
            * throughputs['lens3'].sb * throughputs['mirror1'].sb
            * throughputs['mirror2'].sb * throughputs['mirror3'].sb)
    hardware = {}
    system = {}
    for f in filters:
        hardware[f] = Bandpass()
        system[f] = Bandpass()
        wavelen = filters[f].wavelen
        hw_sb = core_sb * filters[f].sb
        hardware[f].setBandpass(wavelen, hw_sb)
        system[f].setBandpass(wavelen, hw_sb*throughputs['atmosphere'].sb)
    # Get combination from bandpassUtils.
    bU_hardware, bU_system = bu.buildHardwareAndSystem(defaultDirs)

    bu.plotBandpasses(hardware)
    bu.plotBandpasses(bU_hardware, linestyle=':', newfig=False,
                      title='BandpassUtils components, hardware')

    bu.plotBandpasses(system)
    plt.plot(throughputs['atmosphere'].wavelen, throughputs['atmosphere'].sb, 'k:')
    plt.figtext(0.22, 0.75, 'Airmass 1.2')
    bu.plotBandpasses(bU_system, linestyle=':', newfig=False,
                      title='BandpassUtils components, system')

    plt.show()
Пример #8
0
    # Combine components by hand. Compare to combination returned from bandpassUtils.
    core_sb = (throughputs['detector'].sb * throughputs['lens1'].sb *
               throughputs['lens2'].sb * throughputs['lens3'].sb *
               throughputs['mirror1'].sb * throughputs['mirror2'].sb *
               throughputs['mirror3'].sb)
    hardware = {}
    system = {}
    for f in filters:
        hardware[f] = Bandpass()
        system[f] = Bandpass()
        wavelen = filters[f].wavelen
        hw_sb = core_sb * filters[f].sb
        hardware[f].setBandpass(wavelen, hw_sb)
        system[f].setBandpass(wavelen, hw_sb * throughputs['atmosphere'].sb)
    # Get combination from bandpassUtils.
    bU_hardware, bU_system = bu.buildHardwareAndSystem(defaultDirs)

    bu.plotBandpasses(hardware)
    bu.plotBandpasses(bU_hardware,
                      linestyle=':',
                      newfig=False,
                      title='BandpassUtils components, hardware')

    bu.plotBandpasses(system)
    plt.plot(throughputs['atmosphere'].wavelen, throughputs['atmosphere'].sb,
             'k:')
    plt.figtext(0.22, 0.75, 'Airmass 1.2')
    bu.plotBandpasses(bU_system,
                      linestyle=':',
                      newfig=False,
                      title='BandpassUtils components, system')
            atmos['%.1f' %X].readThroughput(os.path.join(throughputDir,
                                                         'atmos/atmos_%d.dat' %(int(X*10))))

    atmoskeys = sorted(atmos.keys())
    print title
    print '    %s' %('    '.join(atmoskeys))
    system = Bandpass()
    effsb = {}
    for f in ['u', 'g', 'r', 'i', 'z', 'y']:
        writestring = '%s ' %f
        for k in atmoskeys:
            system.wavelen, system.sb = hardware[f].multiplyThroughputs(atmos[k].wavelen, atmos[k].sb)
            effphi, effsb[k] = system.calcEffWavelen()
            writestring += '%.2f ' %(effsb[k])
        print writestring

if __name__ == '__main__':

    defaultDirs = bu.setDefaultDirs(rootDir = '..')
    # To use a particular vendor's detector response curve, uncomment one of the lines below
    defaultDetector = defaultDirs['detector']
    #defaultDirs['detector'] = os.path.join(defaultDetector, 'vendor1')
    #defaultDirs['detector'] = os.path.join(defaultDetector, 'vendor2')

    addLosses = True

    hardware, system = bu.buildHardwareAndSystem(defaultDirs, addLosses)
    calcEffWavelen(hardware, 'Min: Std Atmo')