phangs_get_galaxy_distance.pro 708 Bytes
function phangs_get_galaxy_distance,galaxy,file=file
  use_file=!dustem_wrap_soft_dir+'LabTools/IRAP/AH/phangs_sample_table_v1p6.fits'
  if keyword_set(file) then use_file=file
  ngals_in=n_elements(galaxy)
  str=phangs_read_sample_table(file=use_file)
  match,strtrim(strupcase(galaxy),2), strtrim(strupcase(str.name),2),inidx,galidx,count=found
  if found eq 0 and ngals_in eq 1 then begin
     message,'Galaxy: '+galaxy+' not found.',/info
     stop
  end
  if found eq 0 and ngals_in gt 1 then begin
     message,'No galaxies found.',/info
     stop
  end
  one_str={name:'',dist:-1.}
  dstr=replicate(one_str,found)
  dstr.name=str[galidx].name
  dstr.dist=str[galidx].dist
  return,dstr
  the_end:
end