jobovy / apogee

Tools for dealing with APOGEE data
BSD 3-Clause "New" or "Revised" License
43 stars 25 forks source link

trouble reading in models #37

Closed aburgasser closed 8 years ago

aburgasser commented 8 years ago

trouble reading in models - the file name it generates here (mm02cp02op02/amm02cp02op02t4750g25v20.mod) isn't on the webpage it calls

In [32]: atm= atlas9.Atlas9Atmosphere(teff=4750.,logg=2.5,metals=-0.25,am=0.25,c ...: m=0.25)

CalledProcessError Traceback (most recent call last) /Users/adam/projects/FAST/apogee/apogee/tools/download.py in _download_file(downloadPath, filePath, dr, verbose, spider) 568 if spider: cmd.append('--spider') --> 569 subprocess.check_call(cmd) 570 if not spider: shutil.move(tmp_savefilename,filePath)

/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/subprocess.py in check_call(*popenargs, **kwargs) 560 cmd = popenargs[0] --> 561 raise CalledProcessError(retcode, cmd) 562 return 0

CalledProcessError: Command '['wget', 'https://data.sdss.org/sas/apogeework/apogee/spectro/redux/speclib/kurucz_filled/mm02cp02op02/amm02cp02op02t4750g25v20.mod', '-O', '/var/folders/xz/cpj3dz_52vg83dmxjgzxx4nh0000gn/T/tmpo08648kq', '--read-timeout=10', '--tries=3', '-q']' returned non-zero exit status 6

During handling of the above exception, another exception occurred:

OSError Traceback (most recent call last)

in () ----> 1 atm= atlas9.Atlas9Atmosphere(teff=4750.,logg=2.5,metals=-0.25,am=0.25,cm=0.25) /Users/adam/projects/FAST/apogee/apogee/modelatm/atlas9.py in __init__(self, teff, logg, metals, am, cm, dr, interp_x, atmfile) 53 # If it's a grid point, load the file 54 elif self._isGrid: ---> 55 self._loadGridPoint() 56 else: 57 self._loadByInterpolation(interp_x=interp_x) /Users/adam/projects/FAST/apogee/apogee/modelatm/atlas9.py in _loadGridPoint(self) 249 teff=self._teff,logg=self._logg, 250 metals=self._metals, --> 251 cfe=self._cm,afe=self._am,dr=self._dr) 252 atContent= readAtlas9(filePath) 253 # Unpack /Users/adam/projects/FAST/apogee/apogee/tools/download.py in modelAtmosphere(lib, teff, logg, metals, cfe, nfe, afe, vmicro, dr, spider) 438 _dr_string(dr)), 439 _base_url(dr=dr)) --> 440 _download_file(downloadPath,filePath,dr,spider=spider) 441 return None 442 /Users/adam/projects/FAST/apogee/apogee/tools/download.py in _download_file(downloadPath, filePath, dr, verbose, spider) 576 raise 577 elif ntries > _MAX_NTRIES: --> 578 raise IOError('File %s does not appear to exist on the server ...' % (os.path.basename(filePath))) 579 elif not 'exit status 4' in str(e): 580 interrupted= True OSError: File amm02cp02op02t4750g25v20.mod does not appear to exist on the server ...
aburgasser commented 8 years ago

Update: fixed my .nrec file and made sure I had login set properly, but didn't fix issue:

In [1]: from apogee.modelatm import atlas9 ...: atm= atlas9.Atlas9Atmosphere(teff=4750.,logg=2.5,metals=-0.25,am=0.25,cm ...: =0.25)

...:

CalledProcessError Traceback (most recent call last) /Users/adam/projects/FAST/apogee/apogee/tools/download.py in _download_file(downloadPath, filePath, dr, verbose, spider) 569 if spider: cmd.append('--spider') --> 570 subprocess.check_call(cmd) 571 if not spider: shutil.move(tmp_savefilename,filePath)

/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/subprocess.py in check_call(_popenargs, *_kwargs) 560 cmd = popenargs[0] --> 561 raise CalledProcessError(retcode, cmd) 562 return 0

CalledProcessError: Command '['wget', 'https://data.sdss.org/sas/apogeework/apogee/spectro/redux/speclib/kurucz_filled/mm02cp02op02/amm02cp02op02t4750g25v20.mod', '-O', '/var/folders/xz/cpj3dz_52vg83dmxjgzxx4nh0000gn/T/tmp8a7j8d5t', '--read-timeout=10', '--tries=3', '-q']' returned non-zero exit status 8

During handling of the above exception, another exception occurred:

OSError Traceback (most recent call last)

in () 1 from apogee.modelatm import atlas9 ----> 2 atm= atlas9.Atlas9Atmosphere(teff=4750.,logg=2.5,metals=-0.25,am=0.25,cm=0.25) /Users/adam/projects/FAST/apogee/apogee/modelatm/atlas9.py in **init**(self, teff, logg, metals, am, cm, dr, interp_x, atmfile) 53 # If it's a grid point, load the file 54 elif self._isGrid: ---> 55 self._loadGridPoint() 56 else: 57 self._loadByInterpolation(interp_x=interp_x) /Users/adam/projects/FAST/apogee/apogee/modelatm/atlas9.py in _loadGridPoint(self) 249 teff=self._teff,logg=self._logg, 250 metals=self._metals, --> 251 cfe=self._cm,afe=self._am,dr=self._dr) 252 atContent= readAtlas9(filePath) 253 # Unpack /Users/adam/projects/FAST/apogee/apogee/tools/download.py in modelAtmosphere(lib, teff, logg, metals, cfe, nfe, afe, vmicro, dr, spider) 439 _dr_string(dr)), 440 _base_url(dr=dr)) --> 441 _download_file(downloadPath,filePath,dr,spider=spider) 442 return None 443 /Users/adam/projects/FAST/apogee/apogee/tools/download.py in _download_file(downloadPath, filePath, dr, verbose, spider) 577 raise 578 elif ntries > _MAX_NTRIES: --> 579 raise IOError('File %s does not appear to exist on the server ...' % (os.path.basename(filePath))) 580 elif not 'exit status 4' in str(e): 581 interrupted= True OSError: File amm02cp02op02t4750g25v20.mod does not appear to exist on the server ...
jobovy commented 8 years ago

Turned out to be another Python 3 error, because Python 3 round 0.5 differently from Python 2:

http://stackoverflow.com/questions/10825926/python-3-x-rounding-behavior