code: def getCatalogFile(catalog_dir, mc_source_id):
      
      catalog_infiles = sorted(glob.glob(catalog_dir + '/*catalog*.fits'))
      mc_source_id_array = []
      catalog_infile_index_array = []
      for ii, catalog_infile in enumerate(catalog_infiles):
          mc_source_id_min = int(os.path.basename(catalog_infile).split('.')[0].split('mc_source_id_')[-1].split('-')[0])
          mc_source_id_max = int(os.path.basename(catalog_infile).split('.')[0].split('mc_source_id_')[-1].split('-')[1])
          assert (mc_source_id_max > mc_source_id_min) & (mc_source_id_min >= 1), 'Found invalue MC_SOURCE_ID values in filenames'
          mc_source_id_array.append(np.arange(mc_source_id_min, mc_source_id_max + 1))
          catalog_infile_index_array.append(np.tile(ii, 1 + (mc_source_id_max - mc_source_id_min)))
  
      mc_source_id_array = np.concatenate(mc_source_id_array)
      catalog_infile_index_array = np.concatenate(catalog_infile_index_array)
  
      assert len(mc_source_id_array) == len(np.unique(mc_source_id_array)), 'Found non-unique MC_SOURCE_ID values in filenames'
      assert np.in1d(mc_source_id, mc_source_id_array), 'Requested MC_SOURCE_ID value not among files'
      mc_source_id_index = np.nonzero(mc_source_id == mc_source_id_array)[0]
      return catalog_infiles[catalog_infile_index_array[mc_source_id_index]]
docs: Inputs:
          catalog_dir = string corresponding to directory containing the stellar catalog infiles
          mc_source_id = integer corresponding the target MC_SOURCE_ID value
      Outputs:
          catalog_infile = string corresponding to filename of stellar catalog containing mc_source_id