Git Product home page Git Product logo

apogee_tools's Introduction

apogee_tools

Forward modeling tools for APOGEE VLM star spectra. Project is currently under construction, but documentation for working modules can be found at read the docs.

Contributors:

  • Christian Aganze (UCSD)
  • Jessica Birky (UCSD)
  • Adam Burgasser, PI (UCSD)
  • Dino Chih-Chun Hsu (UCSD)
  • Elizabeth Moreno (Guanajuato)
  • Chris Theissen (UCSD)

apogee_tools's People

Contributors

chihchunhsu avatar ctheissen avatar jbirky avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

apogee_tools's Issues

multiParamSearch instructions and error

In:

params = ['TEFF', 'LOGG', 'M_H']
ranges = [[-10000,4000], [0,5], [-2,2]]
source_table = multiParamSearch(par=params, select=ranges)

multiParamSearch -> ap.multiParamSearch

and in this command I got:

NameError Traceback (most recent call last)
in ()
1 params = ['TEFF', 'LOGG', 'M_H']
2 ranges = [[-10000,4000], [0,5], [-2,2]]
----> 3 source_table = ap.multiParamSearch(par=params, select=ranges)

/Users/adam/python_codes/apogee_tools/apogee_tools/search.py in multiParamSearch(**kwargs)
204 # Concatenate frames of all data release searches and save
205 if save == True:
--> 206 data_table.to_csv('tables/'+output)
207
208 return data

NameError: name 'data_table' is not defined

getModel is currently broken. Wrong path specified to models.

Just wanted to post this up there for future releases. Currently the getModel function points to models stored in os.path.realpath(file). However, the file exists in apogee_tools/apogee_tools/utils, whilst the model files exist in apogee_tools/libraries.

optimizeVSINI

ap.optimizeVSINI(data1,mdl)

same issue as optimizeRV,
/Users/caganze/Research/apogee_all/apogee_tools/apogee_tools/spec_tools.py in optimizeVSINI(spec, mspec, **kwargs)
684 mask = np.where((m_wave > xrange[0]) & (m_wave < xrange[1]))
685 m_wave, m_flux = m_wave[mask], m_flux[mask]
--> 686 mspec = Spectrum(wave=m_wave, flux=m_flux, params=params)
687
688 chi_vals = {}

NameError: name 'Spectrum' is not defined

I think
from .core import*
might fix this

Problem reading in apVisit spectra

I have all the visit spectra downloaded for 2M03290406+3117075. When I attempt to read in the first visit, I get an error:

Traceback (most recent call last):
File "test.py", line 169, in
data = ap.Spectrum(id='2M03122509+0021585-0', type='apvisit')
File "/Users/admin/Desktop/astro_code/apogee_tools/apogee_tools/core.py", line 189, in init
openFile = fits.open(self.file)
File "/Users/admin/anaconda3/lib/python3.5/site-packages/astropy/io/fits/hdu/hdulist.py", line 166, in fitsopen
lazy_load_hdus, **kwargs)
File "/Users/admin/anaconda3/lib/python3.5/site-packages/astropy/io/fits/hdu/hdulist.py", line 404, in fromfile
lazy_load_hdus=lazy_load_hdus, **kwargs)
File "/Users/admin/anaconda3/lib/python3.5/site-packages/astropy/io/fits/hdu/hdulist.py", line 1044, in _readfrom
raise IOError('Empty or corrupt FITS file')
OSError: Empty or corrupt FITS file

Issue with getModel

mdl = ap.getModel(params=[3200, 5.0, 0.0], grid='BTSETTLb', xrange=[15200,16940])

returns
/Users/caganze/Research/apogee_all/apogee_tools/apogee_tools/spec_tools.py in load_flux(self, parameters)
93 '''
94
---> 95 key = self.key_name.format(*parameters)
96 with h5py.File(self.filename, "r") as hdf5:
97 try:

AttributeError: 'NoneType' object has no attribute 'format'

Import Error

import apogee_tools as ap

----> 1 import apogee_tools as ap

/Users/caganze/Research/apogee_all/apogee_tools/apogee_tools/init.py in ()
1 from future import absolute_import, division, print_function, unicode_literals
2
----> 3 from .core import *
4 from .spec_tools import *
5 from .lsf import *

/Users/caganze/Research/apogee_all/apogee_tools/apogee_tools/core.py in ()
18
19 from apogee_tools.spec_tools import _rvShift
---> 20 from libraries import features
21
22 #Get the path of apogee_tools file

ImportError: cannot import name 'features'
I just updated the module, i get this error, perhaps you could from .features import* ? Thanks

apvisit download not working?

in your instructions I tried:

data = ap.Spectrum(id='2M03290406+3117075-0', type='apvisit')

and got

OSError Traceback (most recent call last)
in ()
----> 1 data = ap.Spectrum(id='2M03290406+3117075-0', type='apvisit')

/Users/adam/python_codes/apogee_tools/apogee_tools/core.py in init(self, **kwargs)
187 """
188
--> 189 openFile = fits.open(self.file)
190
191 self.HDU0 = openFile[0]

/Users/adam/anaconda3/lib/python3.5/site-packages/astropy/io/fits/hdu/hdulist.py in fitsopen(name, mode, memmap, save_backup, cache, lazy_load_hdus, **kwargs)
164
165 return HDUList.fromfile(name, mode, memmap, save_backup, cache,
--> 166 lazy_load_hdus, **kwargs)
167
168

/Users/adam/anaconda3/lib/python3.5/site-packages/astropy/io/fits/hdu/hdulist.py in fromfile(cls, fileobj, mode, memmap, save_backup, cache, lazy_load_hdus, **kwargs)
402 return cls._readfrom(fileobj=fileobj, mode=mode, memmap=memmap,
403 save_backup=save_backup, cache=cache,
--> 404 lazy_load_hdus=lazy_load_hdus, **kwargs)
405
406 @classmethod

/Users/adam/anaconda3/lib/python3.5/site-packages/astropy/io/fits/hdu/hdulist.py in _readfrom(cls, fileobj, data, mode, memmap, save_backup, cache, lazy_load_hdus, **kwargs)
1042 # raise and exception
1043 if not read_one and mode in ('readonly', 'denywrite'):
-> 1044 raise IOError('Empty or corrupt FITS file')
1045
1046 if not lazy_load_hdus:

OSError: Empty or corrupt FITS file

the command:
data = ap.Spectrum(id='2M03290406+3117075', type='aspcap')
worked fine

optimizeRV

ap.optimizeRV(data, mdl)
has an error
/Users/caganze/Research/apogee_all/apogee_tools/apogee_tools/spec_tools.py in optimizeRV(sp1, sp2, **kwargs
612 #Turn cross-correlated spectrum into spectrum object
--> 613 cc_sp1 = Spectrum(wave=shift_wave, flux=flux1, sigmas=sp1.sigmas, name=sp1.name)
614
615 return rv, cc_sp1, sp2

NameError: name 'Spectrum' is not defined

I think you need to import Spectrum from core.py
i think you could just use
from .core import* in spec_tools.py ?

'BASE' is not defined in the 'getModel' function

mdl = ap.getModel(params=[3200, 5.0, 0.0], grid='PHOENIX', xrange=[15200,16940])

NameError Traceback (most recent call last)
in ()
----> 1 mdl = ap.getModel(params=[3200, 5.0, 0.0], grid='PHOENIX', xrange=[15200,16940])

/Users/dinohsu/projects/apogee_all/apogee_tools/apogee_tools/utils/read.py in getModel(**kwargs)
228
229 grid = kwargs.get('grid', 'BTSETTLb')
--> 230 grid_lib = BASE + '/libraries/' + grid + '_APOGEE.hdf5'
231
232 params = kwargs.get('params', [3000, 5.0, 0.0])

NameError: name 'BASE' is not defined

designation names

right now it seems that designations are labeled as:

2M00034394+8606422

but will crash for the more standard format

J00034394+8606422

I would suggest either changing to the standard format ("J" instead of "2M") or having a more flexible converter (e.g., drop everything in front of the last letter in the sequence)

rotation_broaden fix

The number of points for the rotational broadening and LSF should be odd. Here is some fix in rotation_broaden.py:

on line 68 (under the lsf_rotate function):

	nwid = npts // 2.

on line 114-121 (under the broaden function):

	elif gaussian: 
		if np.ceil(20.*vbroad/vres) % 2 == 0:
			x    = np.arange(np.ceil(20.*vbroad/vres)+1)
		else:
			x    = np.arange(np.ceil(20.*vbroad/vres))
		x    = (x / np.max(x)-0.5)*20.
		
		kern = np.exp(-0.5*x**2) 
	else:
		if np.ceil(20.*vbroad/vres) % 2 == 0:
			x    = np.arange(np.ceil(20.*vbroad/vres)+1)*10.
		else:
			x    = np.arange(np.ceil(20.*vbroad/vres))*10.

No default "alpha" set in getTelluric

I get the following error:

  File "/Users/ctheissen/repos/apogee_tools/apogee_tools/forward_model/telluric.py", line 50, in getTelluric
    tell_flux = np.array(tellurics[1].data['trans'])**(alpha)
NameError: name 'alpha' is not defined

Presumably it is because the alpha parameter is not set by default in the function.

Download issue

ap.download('2M15141711+0044474', type='apStar')
and
ap.download('2M15141711+0044474', type='aspcap')

returns
TypeError: buffer is too small for requested array

but ap.download('2M15141711+0044474', type='apVisit') works fine downloading the files.

smoothVSINI not working

mdl = ap.getModel( params=[3200, 5.0, 0.0], grid='BTSETTLb', xrange=[15200,16940])
ap.smoothVSINI(mdl)

Raise the error below:

PyAValError Traceback (most recent call last)
in ()
----> 1 ap.smoothVSINI(data)

/Users/dinohsu/projects/apogee_all/apogee_tools/apogee_tools/spec_tools.py in smoothVSINI(mspec, **kwargs)
649
650 #Perform rotational broadening using PyAstronomy; return flux
--> 651 rflux = pyasl.rotBroad(n_wave, n_flux, limb, vsini)
652
653 #Save broadened spectrum to new spectrum object

/Users/dinohsu/anaconda/lib/python3.6/site-packages/PyAstronomy/pyasl/asl/rotBroad.py in rotBroad(wvl, flux, epsilon, vsini, edgeHandling)
103 solution="Use evenly spaced input array."))
104 if vsini <= 0.0:
--> 105 raise(PE.PyAValError("vsini must be positive.", where="pyasl.rotBroad"))
106 if (epsilon < 0) or (epsilon > 1.0):
107 raise(PE.PyAValError("Linear limb-darkening coefficient, epsilon, should be '0 < epsilon < 1'.",

PyAValError:

A PyA error occurred:

Type of error: PyA Value Error
What happened?
vsini must be positive.
Where did it happen?
pyasl.rotBroad

Issue with Download

ap.download('2M15141711+0044474', type='aspcap')
data = ap.Spectrum(id='2M15141711+0044474', type='aspcap') data.plot(items=['spectrum', 'apModel', 'noise'], save=True)

returns
FileNotFoundError: [Errno 2] No such file or directory: '/Users/caganze/Research/apogee_all/apogee_data/aspcap_data/aspcapStar-r6-l30e.2-2M15141711+0044474.fits'

search.py only 3 params

Lines 311-314 of search.py, only takes 3 params

Save data frame to csv file and save to the 'output' directory specified by keyword argument

tmin, tmax = select[0][0], select[0][1]
lmin, lmax = select[1][0], select[1][1]
mmin, mmax = select[2][0], select[2][1]

Issue with apogee_data path

My computer is formatting the path in a weird way
Running
ap.download('2M15141711+0044474', type='aspcap')

Returns the following error
FileNotFoundError: [Errno 2] No such file or directory: '/Users/caganze/Research/apogee_all/apogee_data/:/allStar-l30e.2.fits'

The colon (:) between my path and the file shouldn't be there

error on search.py

Commands:

params = ['TEFF']
ranges = [[0,3600]]
source_table = ap.multiParamSearch(par=params, select=ranges, save_dir='/Users/adam/Desktop/tmp.csv',model='MARCS')

Error:

in ()
1 params = ['TEFF']
2 ranges = [[0,3600]]
----> 3 source_table = ap.multiParamSearch(par=params, select=ranges, save_dir='/Users/adam/Desktop/tmp.csv',model='MARCS')

/Users/adam/python_codes/apogee_tools/apogee_tools/utils/search.py in multiParamSearch(**kwargs)
324 # Save data frame to csv file and save to the 'output' directory specified by keyword argument
325 tmin, tmax = select[0][0], select[0][1]
--> 326 lmin, lmax = select[1][0], select[1][1]
327 mmin, mmax = select[2][0], select[2][1]
328

IndexError: list index out of range

wget

For some users, there seems to be a certificate issue

wget https://data.sdss.org/sas/dr13/apogee/spectro/redux/r6/allVisit-l30e.2.fits

I get a certificate error
ERROR: cannot verify data.sdss.org's certificate, issued by ‘CN=Go Daddy Secure Certificate Authority - G2,OU=http://certs.godaddy.com/repository/,O=GoDaddy.com\\, Inc.,L=Scottsdale,ST=Arizona,C=US’:
Self-signed certificate encountered.
To connect to data.sdss.org insecurely, use `--no-check-certificate'.

to resolve this I need to run
wget https://data.sdss.org/sas/dr13/apogee/spectro/redux/r6/allVisit-l30e.2.fits --no-check-certificate

You could make this option the default for downloading using wget

error on data.plot()

Got the following error when trying to plot a spectrum:

ap.download('2M00034394+8606422', type='aspcap')
data = ap.Spectrum(id='2M00034394+8606422', type='aspcap')

check

data.wave
array([15152.21067174, 15152.42000872, 15152.62934858, ...,
16943.06589879, 16943.29997751, 16943.53405947])
data.plot()

error below - it seems there is an issue with running LaTeX, somewhere the string b'lp' is being fed in....?


RuntimeError Traceback (most recent call last)
in ()
----> 1 data.plot()

/Users/adam/python_codes/apogee_tools/apogee_tools/core.py in plot(self, **kwargs)
369 if title != None:
370 plt.title(title, fontsize=20)
--> 371 plt.tight_layout()
372
373 if save == True:

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/pyplot.py in tight_layout(pad, h_pad, w_pad, rect)
1385
1386 fig = gcf()
-> 1387 fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
1388
1389

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/figure.py in tight_layout(self, renderer, pad, h_pad, w_pad, rect)
1750 renderer,
1751 pad=pad, h_pad=h_pad, w_pad=w_pad,
-> 1752 rect=rect)
1753
1754 self.subplots_adjust(**kwargs)

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/tight_layout.py in get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, pad, h_pad, w_pad, rect)
347 subplot_list=subplot_list,
348 ax_bbox_list=ax_bbox_list,
--> 349 pad=pad, h_pad=h_pad, w_pad=w_pad)
350
351 if rect is not None:

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/tight_layout.py in auto_adjust_subplotpars(fig, renderer, nrows_ncols, num1num2_list, subplot_list, ax_bbox_list, pad, h_pad, w_pad, rect)
124 ax_bbox_list,
125 num1num2_list):
--> 126 tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots])
127 tight_bbox = TransformedBbox(tight_bbox_raw,
128 fig.transFigure.inverted())

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/tight_layout.py in (.0)
124 ax_bbox_list,
125 num1num2_list):
--> 126 tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots])
127 tight_bbox = TransformedBbox(tight_bbox_raw,
128 fig.transFigure.inverted())

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_base.py in get_tightbbox(self, renderer, call_axes_locator)
3672 bb.append(self._right_title.get_window_extent(renderer))
3673
-> 3674 bb_xaxis = self.xaxis.get_tightbbox(renderer)
3675 if bb_xaxis:
3676 bb.append(bb_xaxis)

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axis.py in get_tightbbox(self, renderer)
1075 ticks_to_draw = self._update_ticks(renderer)
1076 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
-> 1077 renderer)
1078
1079 self._update_label_position(ticklabelBoxes, ticklabelBoxes2)

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axis.py in _get_tick_bboxes(self, ticks, renderer)
1058 for tick in ticks:
1059 if tick.label1On and tick.label1.get_visible():
-> 1060 extent = tick.label1.get_window_extent(renderer)
1061 ticklabelBoxes.append(extent)
1062 if tick.label2On and tick.label2.get_visible():

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/text.py in get_window_extent(self, renderer, dpi)
959 raise RuntimeError('Cannot get window extent w/o renderer')
960
--> 961 bbox, info, descent = self._get_layout(self._renderer)
962 x, y = self.get_unitless_position()
963 x, y = self.get_transform().transform_point((x, y))

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/text.py in _get_layout(self, renderer)
350 tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp',
351 self._fontproperties,
--> 352 ismath=False)
353 offsety = (lp_h - lp_bl) * self._linespacing
354

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in get_text_width_height_descent(self, s, prop, ismath)
227 fontsize = prop.get_size_in_points()
228 w, h, d = texmanager.get_text_width_height_descent(s, fontsize,
--> 229 renderer=self)
230 return w, h, d
231

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/texmanager.py in get_text_width_height_descent(self, tex, fontsize, renderer)
673 else:
674 # use dviread. It sometimes returns a wrong descent.
--> 675 dvifile = self.make_dvi(tex, fontsize)
676 dvi = dviread.Dvi(dvifile, 72 * dpi_fraction)
677 try:

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/texmanager.py in make_dvi(self, tex, fontsize)
420 'string:\n%s\nHere is the full report generated by '
421 'LaTeX: \n\n' % repr(tex.encode('unicode_escape')) +
--> 422 report))
423 else:
424 mpl.verbose.report(report, 'debug')

RuntimeError: LaTeX was not able to process the following string:
b'lp'
Here is the full report generated by LaTeX:

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./d5924ddf5eca094d188857522ec37f30.tex
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.

! LaTeX Error: File `article.cls' not found.

Type X to quit or to proceed,
or enter new name. (Default extension: cls)

Enter file name:
! Emergency stop.
<read *>

l.2 \usepackage
{type1cm}^^M
No pages of output.
Transcript written on d5924ddf5eca094d188857522ec37f30.log.

Error in callback <function install_repl_displayhook..post_execute at 0x11cb9c268> (for post_execute):

RuntimeError Traceback (most recent call last)
/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/pyplot.py in post_execute()
146 def post_execute():
147 if matplotlib.is_interactive():
--> 148 draw_all()
149
150 # IPython >= 2

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/_pylab_helpers.py in draw_all(cls, force)
148 for f_mgr in cls.get_all_fig_managers():
149 if force or f_mgr.canvas.figure.stale:
--> 150 f_mgr.canvas.draw_idle()
151
152 atexit.register(Gcf.destroy_all)

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/backend_bases.py in draw_idle(self, *args, **kwargs)
2024 if not self._is_idle_drawing:
2025 with self._idle_draw_cntx():
-> 2026 self.draw(*args, **kwargs)
2027
2028 def draw_cursor(self, event):

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in draw(self)
472
473 try:
--> 474 self.figure.draw(self.renderer)
475 finally:
476 RendererAgg.lock.release()

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
60 def draw_wrapper(artist, renderer, *args, **kwargs):
61 before(artist, renderer)
---> 62 draw(artist, renderer, *args, **kwargs)
63 after(artist, renderer)
64

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/figure.py in draw(self, renderer)
1157 dsu.sort(key=itemgetter(0))
1158 for zorder, a, func, args in dsu:
-> 1159 func(*args)
1160
1161 renderer.close_group('figure')

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
60 def draw_wrapper(artist, renderer, *args, **kwargs):
61 before(artist, renderer)
---> 62 draw(artist, renderer, *args, **kwargs)
63 after(artist, renderer)
64

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe)
2317
2318 for zorder, a in dsu:
-> 2319 a.draw(renderer)
2320
2321 renderer.close_group('axes')

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
60 def draw_wrapper(artist, renderer, *args, **kwargs):
61 before(artist, renderer)
---> 62 draw(artist, renderer, *args, **kwargs)
63 after(artist, renderer)
64

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axis.py in draw(self, renderer, *args, **kwargs)
1108 ticks_to_draw = self._update_ticks(renderer)
1109 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
-> 1110 renderer)
1111
1112 for tick in ticks_to_draw:

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axis.py in _get_tick_bboxes(self, ticks, renderer)
1058 for tick in ticks:
1059 if tick.label1On and tick.label1.get_visible():
-> 1060 extent = tick.label1.get_window_extent(renderer)
1061 ticklabelBoxes.append(extent)
1062 if tick.label2On and tick.label2.get_visible():

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/text.py in get_window_extent(self, renderer, dpi)
959 raise RuntimeError('Cannot get window extent w/o renderer')
960
--> 961 bbox, info, descent = self._get_layout(self._renderer)
962 x, y = self.get_unitless_position()
963 x, y = self.get_transform().transform_point((x, y))

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/text.py in _get_layout(self, renderer)
350 tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp',
351 self._fontproperties,
--> 352 ismath=False)
353 offsety = (lp_h - lp_bl) * self._linespacing
354

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in get_text_width_height_descent(self, s, prop, ismath)
227 fontsize = prop.get_size_in_points()
228 w, h, d = texmanager.get_text_width_height_descent(s, fontsize,
--> 229 renderer=self)
230 return w, h, d
231

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/texmanager.py in get_text_width_height_descent(self, tex, fontsize, renderer)
673 else:
674 # use dviread. It sometimes returns a wrong descent.
--> 675 dvifile = self.make_dvi(tex, fontsize)
676 dvi = dviread.Dvi(dvifile, 72 * dpi_fraction)
677 try:

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/texmanager.py in make_dvi(self, tex, fontsize)
420 'string:\n%s\nHere is the full report generated by '
421 'LaTeX: \n\n' % repr(tex.encode('unicode_escape')) +
--> 422 report))
423 else:
424 mpl.verbose.report(report, 'debug')

RuntimeError: LaTeX was not able to process the following string:
b'lp'
Here is the full report generated by LaTeX:

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./d5924ddf5eca094d188857522ec37f30.tex
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.

! LaTeX Error: File `article.cls' not found.

Type X to quit or to proceed,
or enter new name. (Default extension: cls)

Enter file name:
! Emergency stop.
<read *>

l.2 \usepackage
{type1cm}^^M
No pages of output.
Transcript written on d5924ddf5eca094d188857522ec37f30.log.


RuntimeError Traceback (most recent call last)
/Users/adam/anaconda3/lib/python3.5/site-packages/IPython/core/formatters.py in call(self, obj)
305 pass
306 else:
--> 307 return printer(obj)
308 # Finally look for special method names
309 method = get_real_method(obj, self.print_method)

/Users/adam/anaconda3/lib/python3.5/site-packages/IPython/core/pylabtools.py in (fig)
225
226 if 'png' in formats:
--> 227 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
228 if 'retina' in formats or 'png2x' in formats:
229 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))

/Users/adam/anaconda3/lib/python3.5/site-packages/IPython/core/pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
117
118 bytes_io = BytesIO()
--> 119 fig.canvas.print_figure(bytes_io, **kw)
120 data = bytes_io.getvalue()
121 if fmt == 'svg':

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2178 orientation=orientation,
2179 dryrun=True,
-> 2180 **kwargs)
2181 renderer = self.figure._cachedRenderer
2182 bbox_inches = self.figure.get_tightbbox(renderer)

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
525
526 def print_png(self, filename_or_obj, *args, **kwargs):
--> 527 FigureCanvasAgg.draw(self)
528 renderer = self.get_renderer()
529 original_dpi = renderer.dpi

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in draw(self)
472
473 try:
--> 474 self.figure.draw(self.renderer)
475 finally:
476 RendererAgg.lock.release()

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
60 def draw_wrapper(artist, renderer, *args, **kwargs):
61 before(artist, renderer)
---> 62 draw(artist, renderer, *args, **kwargs)
63 after(artist, renderer)
64

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/figure.py in draw(self, renderer)
1157 dsu.sort(key=itemgetter(0))
1158 for zorder, a, func, args in dsu:
-> 1159 func(*args)
1160
1161 renderer.close_group('figure')

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
60 def draw_wrapper(artist, renderer, *args, **kwargs):
61 before(artist, renderer)
---> 62 draw(artist, renderer, *args, **kwargs)
63 after(artist, renderer)
64

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe)
2317
2318 for zorder, a in dsu:
-> 2319 a.draw(renderer)
2320
2321 renderer.close_group('axes')

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
60 def draw_wrapper(artist, renderer, *args, **kwargs):
61 before(artist, renderer)
---> 62 draw(artist, renderer, *args, **kwargs)
63 after(artist, renderer)
64

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axis.py in draw(self, renderer, *args, **kwargs)
1108 ticks_to_draw = self._update_ticks(renderer)
1109 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
-> 1110 renderer)
1111
1112 for tick in ticks_to_draw:

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/axis.py in _get_tick_bboxes(self, ticks, renderer)
1058 for tick in ticks:
1059 if tick.label1On and tick.label1.get_visible():
-> 1060 extent = tick.label1.get_window_extent(renderer)
1061 ticklabelBoxes.append(extent)
1062 if tick.label2On and tick.label2.get_visible():

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/text.py in get_window_extent(self, renderer, dpi)
959 raise RuntimeError('Cannot get window extent w/o renderer')
960
--> 961 bbox, info, descent = self._get_layout(self._renderer)
962 x, y = self.get_unitless_position()
963 x, y = self.get_transform().transform_point((x, y))

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/text.py in _get_layout(self, renderer)
350 tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp',
351 self._fontproperties,
--> 352 ismath=False)
353 offsety = (lp_h - lp_bl) * self._linespacing
354

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in get_text_width_height_descent(self, s, prop, ismath)
227 fontsize = prop.get_size_in_points()
228 w, h, d = texmanager.get_text_width_height_descent(s, fontsize,
--> 229 renderer=self)
230 return w, h, d
231

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/texmanager.py in get_text_width_height_descent(self, tex, fontsize, renderer)
673 else:
674 # use dviread. It sometimes returns a wrong descent.
--> 675 dvifile = self.make_dvi(tex, fontsize)
676 dvi = dviread.Dvi(dvifile, 72 * dpi_fraction)
677 try:

/Users/adam/anaconda3/lib/python3.5/site-packages/matplotlib/texmanager.py in make_dvi(self, tex, fontsize)
420 'string:\n%s\nHere is the full report generated by '
421 'LaTeX: \n\n' % repr(tex.encode('unicode_escape')) +
--> 422 report))
423 else:
424 mpl.verbose.report(report, 'debug')

RuntimeError: LaTeX was not able to process the following string:
b'lp'
Here is the full report generated by LaTeX:

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./d5924ddf5eca094d188857522ec37f30.tex
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.

! LaTeX Error: File `article.cls' not found.

Type X to quit or to proceed,
or enter new name. (Default extension: cls)

Enter file name:
! Emergency stop.
<read *>

l.2 \usepackage
{type1cm}^^M
No pages of output.
Transcript written on d5924ddf5eca094d188857522ec37f30.log.

<matplotlib.figure.Figure at 0x1b03a34a8>

plotModel

ap.plotModel(data1)

/Users/caganze/Research/apogee_all/apogee_tools/apogee_tools/spec_tools.py in load_flux(self, parameters)
95 '''
96 print(parameters)
---> 97 key = self.key_name.format(*parameters)
98 with h5py.File(self.filename, "r") as hdf5:
99 try:

TypeError: iteration over a 0-d array

Problem importing apogee_tools

input: import apogee_tools as ap

Output:
Traceback (most recent call last):
File "", line 1, in
File "/Users/Elizabeth/python/apogee_tools/apogee_tools/init.py", line 5, in
from .cannon_tools.run_cannon import labelToSpec, loadLabels, initializeTrainingSet, runCannon, crossValidate
File "/Users/Elizabeth/python/apogee_tools/apogee_tools/cannon_tools/run_cannon.py", line 360
nlabels = len(labels)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.