code: def mock_fluxratio(candsfile, mockcandsfile, dmbin=0):
      
  
      loc, prop = read_candidates(candsfile)
      loc2, prop2 = read_candidates(mockcandsfile)
  
      dmselect = np.where(loc[:,2] == dmbin)[0]
      mocki = [i for i in loc2[:,1].astype(int)]  # known transients
      rat = []; newloc = []; newprop = []
      for i in mocki:
          try:
              detind = list(loc[dmselect,1]).index(i)   # try to find detection
              rat.append(prop[dmselect][detind][1]/prop2[mocki.index(i)][1])
              newloc.append(list(loc2[mocki.index(i)]))
              newprop.append(list(prop2[mocki.index(i)]))
          except ValueError:
              pass
  
      return rat, np.array(newloc), newprop
docs: Associates mock cands with detections in candsfile by integration.
      Returns ratio of detected to expected flux for all associations.