Changeset 634

Show
Ignore:
Timestamp:
09/19/08 15:35:13 (2 months ago)
Author:
laidler
Message:

#123: New implementation of extinction in reddening.py module; relies on extinction curves in PYSYN_CDBS/grid/extinction. Will failover to original implementation retained in extinction.py for gal1/smc/lmc/xgal; will temporarily use new implementation of MWAvg extinction law if gal3 is specified, for purposes of commissioning tests.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pysynphot/lib/__init__.py

    r589 r634  
    147147#Complicated spectral elements 
    148148from obsbandpass import ObsBandpass 
    149 from extinction import Extinction 
     149from reddening import Extinction 
    150150#Observations 
    151151from observation import Observation 
     
    155155#Get Vega 
    156156from spectrum import Vega 
     157#Get cache  
     158import Cache 
    157159 
    158160def _test(): 
  • trunk/pysynphot/lib/locations.py

    r585 r634  
    1 import os, warnings 
     1import os, warnings, glob 
    22 
    3      
     3    
     4 
     5def _refTable(template): 
     6    names = glob.glob(os.path.join(rootdir,template)) 
     7    names.sort() 
     8    try: 
     9        return names[-1] 
     10    except IndexError: 
     11        msg= "No files found for %s."%os.path.join('PYSYN_CDBS',template) 
     12        raise IOError(msg) 
     13  
    414#Replace cdbs_roots lookup with an environment variable 
    515try: 
     
    1727KUR_TEMPLATE = os.path.join(rootdir,'grid','*') 
    1828 
    19  
     29#Vega 
    2030VegaFile = os.path.join(specdir,'alpha_lyr_stis_003.fits') 
    2131 
     32#Reddening Laws 
     33extdir=os.path.join(rootdir,'grid','extinction') 
    2234 
     35 
     36RedLaws={'mwavg':   'milkyway_diffuse_*.fits', 
     37         'mwdense': 'milkyway_dense_*.fits', 
     38         'lmcavg':  'lmc_diffuse_*.fits', 
     39         'lmc30dor':'lmc_30dorshell_*.fits', 
     40         'smcbar':  'smc_bar_*.fits', 
     41         'xgalsb':  'xgal_starburst_*.fits' 
     42           } 
     43 
     44for k in RedLaws: 
     45    try: 
     46        RedLaws[k]=_refTable(os.path.join(extdir,RedLaws[k])) 
     47    except IOError: 
     48        pass 
     49     
    2350#Define wavecat file explicitly 
    2451wavecat = os.path.join(specdir,'wavecat.dat') 
    2552 
    26 def getBandFileName(band): 
    27     return os.path.join(specdir,band.replace(',','_')+'.fits') 
    2853 
    2954def irafconvert(iraffilename): 
  • trunk/pysynphot/lib/observationmode.py

    r551 r634  
    1515import planck 
    1616import wavetable 
     17from locations import _refTable 
    1718 
    1819#Flag to control verbosity 
     
    2425 
    2526# Component tables are defined here. 
    26 def _refTable(template): 
    27     names = glob.glob(os.path.join(rootdir,template)) 
    28     names.sort() 
    29     try: 
    30         return names[-1] 
    31     except IndexError: 
    32         msg= "No files found for %s."%os.path.join('PYSYN_CDBS',template) 
    33         raise IOError(msg) 
    3427try: 
    3528    GRAPHTABLE = _refTable(os.path.join('mtab','*_tmg.fits')) 
     
    346339        c1 = float(coefficients[1]) 
    347340        c2 = (c1 - c0) / 1999.0    # arbitraily copied from synphot.... 
     341        #In synphot.countrate/calcstep.x, it was NSPEC-1, where 
     342        #NSPEC was hardcoded to 2000 as the number of bins into 
     343        #which the wavelength set should be divided by default 
    348344        c3 = c2 
    349345        if len(coefficients) > 2: 
  • trunk/pysynphot/lib/spparser.py

    r569 r634  
    22from spark import GenericASTBuilder, GenericASTMatcher 
    33import spectrum 
    4 import extinction 
     4import reddening 
    55import observationmode 
    66import locations 
     
    261261            elif fname == 'ebmvx': 
    262262                # extinction 
    263                 tree.value = extinction.Extinction(args[0], args[1]) 
     263                tree.value = reddening.Extinction(args[0],args[1]) 
     264                                 
    264265            else: 
    265266                tree.value = "would call %s with the following args: %s" % (fname, repr(args))