spacetelescope / synphot_refactor

Synthetic photometry using Astropy
http://synphot.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
39 stars 25 forks source link

Retrieve the files from CRDS #227

Closed msrdinesh closed 4 years ago

msrdinesh commented 4 years ago

Hii, I am new to synphot, I was trying to follow this tutorial I got the error while following the code:

from matplotlib import pyplot as plt
from astropy import units as u

import numpy as np
import synphot as syn
import stsynphot as stsyn
import os
syn.conf.vega_file
stsyn.Vega.plot(right=20000, left=1000, flux_unit=syn.units.FLAM, title='Vega Spectrum')

ErrorMessage :

AttributeError Traceback (most recent call last)

in ----> 1 stsyn.Vega.plot(right=20000, left=1000, flux_unit=syn.units.FLAM, title='Vega Spectrum') AttributeError: 'NoneType' object has no attribute 'plot'

I couldn't follow the instruction of configuration block (retrieving files from CRDS). Also, at a few places, it was written "pysynphot" instead of "synphot".

Please explain the steps for retrieving the CRDS files or any resources to do so. Thanks in advance!

pllim commented 4 years ago

Hi. If your goal is to patch #206 as you indicated yesterday, you do not need stsynphot. But if you want to run the tutorial anyway, you need to refer to https://stsynphot.readthedocs.io/en/latest/ for instructions to get the data. Hope this helps.

msrdinesh commented 4 years ago

Hii, to run the following code snipped mentioned in the issue, sirius_spec = syn.SourceSpectrum.from_file(os.path.join(os.environ['PYSYN_CDBS'], 'calspec', 'sirius_stis_001.fits')) I think, we need the data. So, I was trying the understand how to retrieve data for synphot.

pllim commented 4 years ago

What do you need the data for exactly? Can you please clarify?

msrdinesh commented 4 years ago

In the issue 206. Please see 5th line in the code. sirius_spec = syn.SourceSpectrum.from_file(os.path.join(os.environ['PYSYN_CDBS'], 'calspec', 'sirius_stis_001.fits')) when I run this line, I got the following error

WARNING: Failed to load Vega spectrum from /grp/hst/cdbs//calspec/alpha_lyr_stis_009.fits;

Functionality involving Vega will be cripped: [Errno 2] No such file or directory: '/grp/hst/cdbs//calspec/alpha_lyr_stis_009.fits' [stsynphot.spectrum] Traceback (most recent call last): File "test.py", line 7, in sirius_spec = syn.SourceSpectrum.from_file(os.path.join(os.environ['PYSYN_CDBS'], 'calspec', 'sirius_stis_001.fits')) File "/home/msrdinesh/anaconda3/lib/python3.7/os.py", line 678, in getitem raise KeyError(key) from None KeyError: 'PYSYN_CDBS'

Please help me on how to handle this. I thought it can be solved if we retrieve data from CRDS.

pllim commented 4 years ago

Instructions on how to set up the data should be in https://stsynphot.readthedocs.io/en/latest/#installation-and-setup

msrdinesh commented 4 years ago

Ok, thanks @pllim for your patience, I will read and work on it.

msrdinesh commented 4 years ago

I have downloaded the files from this website and placed them manually. It worked.