code: def compute_distances(data):
      """Compute the distances to select stars in the sdss_sspp sample.
  
      Distance are determined using empirical color/magnitude fits from
      Ivezic et al 2008, ApJ 684:287
  
      Extinction correcctions come from Berry et al 2011, arXiv 1111.4985
  
      This distance only works for stars with log(g) > 3.3
      Other stars will have distance=-1
      """
      # extinction terms from Berry et al
      Ar = data["Ar"]
      # Au = 1.810 * Ar
      Ag = 1.400 * Ar
      Ai = 0.759 * Ar
      # Az = 0.561 * Ar
  
      # compute corrected mags and colors
      gmag = data["gpsf"] - Ag
      rmag = data["rpsf"] - Ar
      imag = data["ipsf"] - Ai
      gi = gmag - imag
  
      # compute distance fit from Ivezic et al
      FeH = data["FeH"]
      Mr0 = (
          -5.06
          + 14.32 * gi
          - 12.97 * gi**2
          + 6.127 * gi**3
          - 1.267 * gi**4
          + 0.0967 * gi**5
      )
      FeHoffset = 4.50 - 1.11 * FeH - 0.18 * FeH**2
      Mr = Mr0 + FeHoffset
      dist = 0.01 * 10 ** (0.2 * (rmag - Mr))
  
      # stars with log(g) < 3.3 don't work for this fit: set distance to -1
      dist[data["logg"] < 3.3] = -1
  
      return dist
  
imports: import os
  import numpy
  from astropy.table import Table
  from .None import get_data_home
label_desc: Use image node_id 1 for calling a global function with example usage: compute_distances(data) and returns: dist