astropy / SPISEA

Stellar Population Synthesis Modeling
https://spisea.readthedocs.io/en/stable/index.html
64 stars 33 forks source link

Issue with running quick start notebook #7

Closed shashankdholakia closed 4 years ago

shashankdholakia commented 5 years ago

I was able to get the package to install and import without errors in the jupyter notebook.

Importing gives the warning:

/Users/shashank/anaconda3/lib/python3.7/site-packages/pysynphot/locations.py:346: UserWarning: Extinction files not found in /Users/shashank/cdbs/extinction
  warnings.warn('Extinction files not found in %s' % (extdir, ))
/Users/shashank/anaconda3/lib/python3.7/site-packages/pysynphot/refs.py:118: UserWarning: No graph or component tables found; functionality will be SEVERELY crippled. No files found for /Users/shashank/cdbs/mtab/*_tmg.fits
  'functionality will be SEVERELY crippled. ' + str(e))
/Users/shashank/anaconda3/lib/python3.7/site-packages/pysynphot/refs.py:125: UserWarning: No thermal tables found, no thermal calculations can be performed. No files found for /Users/shashank/cdbs/mtab/*_tmt.fits
  'no thermal calculations can be performed. ' + str(e))

When the 5Myr cluster isochrone cell is run (second code cell), it does run for a long time, and says (full traceback pasted below, minus some of the code output above this:

Isochrone generation took 225.748130 s.
Making photometry for isochrone: log(t) = 6.70  AKs = 0.80  dist = 4000
     Starting at:  2019-11-20 13:14:25.265573   Usually takes ~5 minutes
Starting filter: wfc3,ir,f127m   Elapsed time: 0.00 seconds
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-37a3686eb573> in <module>
     18 my_iso = synthetic.IsochronePhot(logAge, AKs, dist, metallicity=0,
     19                             evo_model=evo_model, atm_func=atm_func,
---> 20                             red_law=red_law, filters=filt_list)

~/PyPopStar/popstar/synthetic.py in __init__(self, logAge, AKs, distance, metallicity, evo_model, atm_func, wd_atm_func, red_law, mass_sampling, iso_dir, min_mass, max_mass, rebin, recomp, filters)
    953 
    954             # Make photometry
--> 955             self.make_photometry(rebin=rebin, vega=vega)
    956         else:
    957             try:

~/PyPopStar/popstar/synthetic.py in make_photometry(self, rebin, vega)
    987             print( prt_fmt.format(ii, time.time() - startTime))
    988 
--> 989             filt = get_filter_info(ii, rebin=rebin, vega=vega)
    990             filt_name = get_filter_col_name(ii)
    991 

~/PyPopStar/popstar/synthetic.py in get_filter_info(name, vega, rebin)
   1373 
   1374     else:
-> 1375         filt = ObsBandpass(name)
   1376 
   1377         # Convert to ArraySpectralElement for resampling.

~/anaconda3/lib/python3.7/site-packages/pysynphot/obsbandpass.py in ObsBandpass(obstring, graphtable, comptable, component_dict)
     42     ##ObsModeBandpass or a TabularSpectralElement will be returned.
     43     ob=ObservationMode(obstring,graphtable=graphtable,
---> 44                        comptable=comptable,component_dict=component_dict)
     45     if len(ob) > 1:
     46         return ObsModeBandpass(ob)

~/anaconda3/lib/python3.7/site-packages/pysynphot/observationmode.py in __init__(self, obsmode, method, graphtable, comptable, component_dict)
    305             comptable = refs.COMPTABLE
    306 
--> 307         BaseObservationMode.__init__(self, obsmode, method, graphtable)
    308 
    309 #        ct = CompTable(comptable)

~/anaconda3/lib/python3.7/site-packages/pysynphot/observationmode.py in __init__(self, obsmode, method, graphtable)
    111             gt = refs.GRAPHDICT[graphtable]
    112         else:
--> 113             gt = GraphTable(graphtable)
    114             refs.GRAPHDICT[graphtable] = gt
    115 

~/anaconda3/lib/python3.7/site-packages/pysynphot/tables.py in __init__(self, GFile)
     83         # the default value of None is not useful; pyfits.open(None) does not work.
     84         if GFile is None :
---> 85             raise TypeError('initializing GraphTable with GFile=None; possible bad/missing CDBS')
     86 
     87         gp = pyfits.open(GFile)

TypeError: initializing GraphTable with GFile=None; possible bad/missing CDBS
shashankdholakia commented 5 years ago

I have added the following lines to my bash profile:

export PYTHONPATH=$PYTHONPATH:/Users/shashank/PyPopStar
export PYSYN_CDBS=/Users/shashank/cdbs
export POPSTAR_MODELS=/Users/shashank/

Note that the evolution directory is actually /Users/shashank/evolution. If the directory is changed to this, it immediately errors out with: FileNotFoundError: [Errno 2] No such file or directory: '/Users/shashank/evolution/evolution/merged/baraffe_pisa_ekstrom_parsec/z015_rot/iso_6.70.fits'

mwhosek commented 5 years ago

Hello,

Thank you for your feedback!

Regarding your first comment: It looks like you are missing the cdbs/mtab directory. This is part of the synphot1.tar.gz file you downloaded from STSci (see "Set Up CDBS directory" section of Installation instructions). When you unzip that file, you will find the mtab directory under /grp/hst/cdbs/mtab. Move mtab to your PYSYN_CDBS directory and that error should be fixed.

Regarding your second comment:

You are correct that the POPSTAR_MODELS environment variable should point to the directory where your evolution/ directory exists, rather than the evolution directory itself. This was a typo in the documentation, and has been fixed. So, the "FileNotFoundError" should go away when you set

export POPSTAR_MODELS=/Users/shashank/

-Matt