class_docstr: A class to open and interact with fits files from SDSS
  
  Parameters
  ----------
  buf : string or file buffer (optional)
      file path, buffer, or url of SDSS spectra fits file
      if None, then initialize an empty instance.
  
  Notes
  -----
  This class only provides access to a subset of the information available
  in the sdss spectra fits file.  The raw fits data can be accessed using
  the fits object directly.  This can be found in the attribute
  ``hdulist``.  For details, please refer to the data description:
  http://www.sdss.org/dr7/dm/flatFiles/spSpec.html
docstr: Return the line ratio index for the given galaxy.
  
  This is the index used in Vanderplas et al 2009, and makes use
  of line-ratio fits from Kewley et al 2001
  
  Parameters
  ----------
  indicator: string ['NII'|'OI'|'SII']
      The emission line to use as an indicator
  
  Returns
  -------
  cln: integer
      The classification of the spectrum based on SDSS pipeline and
      the line ratios.
  
      0 : unknown (SPEC_CLN = 0)
      1 : star (SPEC_CLN = 1)
      2 : absorption galaxy (H-alpha seen in absorption)
      3 : normal galaxy (no significant H-alpha emission or absorption)
      4 : emission line galaxies (below line-ratio curve)
      5 : narrow-line QSO (above line-ratio curve)
      6 : broad-line QSO (SPEC_CLN = 3)
      7 : Sky (SPEC_CLN = 4)
      8 : Hi-z QSO (SPEC_CLN = 5)
      9 : Late-type star (SPEC_CLN = 6)
      10 : Emission galaxy (SPEC_CLN = 7)
  
  ratios: tuple
      The line ratios used to compute this
docstr_tok: ["Return","the","line","ratio","index","for","the","given","galaxy",".","This","is","the","index","used","in","Vanderplas","et","al","2009",",","and","makes","use","of","line-ratio","fits","from","Kewley","et","al","2001","Parameters","--","--","--","--","--","indicator",":","string","[","'NII'|'OI'|'SII","'","]","The","emission","line","to","use","as","an","indicator","Returns","--","--","--","-","cln",":","integer","The","classification","of","the","spectrum","based","on","SDSS","pipeline","and","the","line","ratios",".","0",":","unknown","(","SPEC_CLN","=","0",")","1",":","star","(","SPEC_CLN","=","1",")","2",":","absorption","galaxy","(","H-alpha","seen","in","absorption",")","3",":","normal","galaxy","(","no","significant","H-alpha","emission","or","absorption",")","4",":","emission","line","galaxies","(","below","line-ratio","curve",")","5",":","narrow-line","QSO","(","above","line-ratio","curve",")","6",":","broad-line","QSO","(","SPEC_CLN","=","3",")","7",":","Sky","(","SPEC_CLN","=","4",")","8",":","Hi-z","QSO","(","SPEC_CLN","=","5",")","9",":","Late-type","star","(","SPEC_CLN","=","6",")","10",":","Emission","galaxy","(","SPEC_CLN","=","7",")","ratios",":","tuple","The","line","ratios","used","to","compute","this"]
code: def lineratio_index(self, indicator="NII"):
      """Return the line ratio index for the given galaxy.
  
      This is the index used in Vanderplas et al 2009, and makes use
      of line-ratio fits from Kewley et al 2001
  
      Parameters
      ----------
      indicator: string ['NII'|'OI'|'SII']
          The emission line to use as an indicator
  
      Returns
      -------
      cln: integer
          The classification of the spectrum based on SDSS pipeline and
          the line ratios.
  
          0 : unknown (SPEC_CLN = 0)
          1 : star (SPEC_CLN = 1)
          2 : absorption galaxy (H-alpha seen in absorption)
          3 : normal galaxy (no significant H-alpha emission or absorption)
          4 : emission line galaxies (below line-ratio curve)
          5 : narrow-line QSO (above line-ratio curve)
          6 : broad-line QSO (SPEC_CLN = 3)
          7 : Sky (SPEC_CLN = 4)
          8 : Hi-z QSO (SPEC_CLN = 5)
          9 : Late-type star (SPEC_CLN = 6)
          10 : Emission galaxy (SPEC_CLN = 7)
  
      ratios: tuple
          The line ratios used to compute this
      """
      assert indicator in ["NII", "OI", "SII"]
  
      if self.spec_cln < 2:
          return self.spec_cln, (0, 0)
      elif self.spec_cln > 2:
          return self.spec_cln + 3, (0, 0)
  
      strength_Ha, nsig_Ha = self._get_line_strength("Ha")
      strength_Hb, nsig_Hb = self._get_line_strength("Hb")
      if nsig_Ha < 3 or nsig_Hb < 3:
          return 3, (0, 0)
  
      if strength_Ha < 0 or strength_Hb < 0:
          return 2, (0, 0)
  
      # all that's left is choosing between 4 and 5
      # we do this based on line-ratios
      strength_I, nsig_I = self._get_line_strength(indicator)
      strength_OIII, nsig_OIII = self._get_line_strength("OIII")
  
      log_OIII_Hb = np.log10(strength_OIII / strength_Hb)
      I_Ha = np.log10(strength_I / strength_Ha)
  
      if indicator == "NII":
          if I_Ha >= 0.47 or log_OIII_Hb >= log_OIII_Hb_NII(I_Ha):
              return 5, (I_Ha, log_OIII_Hb)
          else:
              return 4, (I_Ha, log_OIII_Hb)
  
      elif indicator == "OI":
          if I_Ha >= -0.59 or log_OIII_Hb >= log_OIII_Hb_OI(I_Ha):
              return 5, (I_Ha, log_OIII_Hb)
          else:
              return 4, (I_Ha, log_OIII_Hb)
  
      else:
          if I_Ha >= 0.32 or log_OIII_Hb >= log_OIII_Hb_SII(I_Ha):
              return 5, (I_Ha, log_OIII_Hb)
          else:
              return 4, (I_Ha, log_OIII_Hb)
  
imports: import gc
  import numpy
  from scipy.ndimage import gaussian_filter1d, uniform_filter1d
  from scipy import interpolate
  from .None import download_with_progress_bar
label_desc: Use image node_id 19 for calling the SDSSfits obj's underlying member method code with example usage: obj.lineratio_index(indicator) and returns: self,  int,  int, int,  int,  int, int,  int,  int, unknown,  int,  int, int,  I_Ha,  log_OIII_Hb, int,  I_Ha,  log_OIII_Hb, int,  I_Ha,  log_OIII_Hb, int,  I_Ha,  log_OIII_Hb, int,  I_Ha,  log_OIII_Hb, int,  I_Ha,  log_OIII_Hb