       @selectIds [@opts.data.first.uid]
     subjects = _(@opts.data).filter (d) => 
       d.uid in @opts.selectedIds
-    @loadSpectralLines(subjects[0])
+
+  loadSpectra: (plate, mjd, fiber) =>
+    request = new XMLHttpRequest()
+    url = "http://api.sdds3.org/spectrum?plate=#{plate}&mjd=#{mjd}&fiber=#{fiber}&fields=best_fit,wavelengths,flux&format=json"
+    request.open("GET", url, true)
+    request.onload = (e) =>
+      spectra
 
   loadSpectralLines: (subject) =>
     request = new XMLHttpRequest()

        .style("stroke-width", 0.5)


if typeof require is 'function' and typeof module is 'object' and typeof exports is 'object'
  module.exports = Spectra
else
  window.Ubret['Spectra'] = Spectra@opts.selector.append('svg')
class Spectra extends Ubret.BaseTool

  name: "Spectra"
  
