def __init__(self, fname, acqimage): if fname is None: if acqimage.is_type("GMOS_N"): fname = ConfigSpace.lookup_path("Gemini/GMOS/MDF/gnifu_slits_mdf.fits") elif acqimage.is_type("GMOS_S"): fname = ConfigSpace.lookup_path("Gemini/GMOS/MDF/gsifu_slits_mdf.fits") else: raise ValueError("Only GMOS North and South supported") self.ad = AstroData(fname) bundle_map = defaultdict(list) self.num_fibers = 0 for record in self.ad.data: block = record.field("BLOCK") bundle_idx = block.split("_")[0] bundle_map[bundle_idx].append(record) self.num_fibers += 1 self.bundles = [] for block, fibers in bundle_map.items(): bundle = FiberBundle(block, fibers) self.bundles.append(bundle) self.bundles.sort()