def setUp(self):
        # this also functions as test_makeDefaultLatissButler(), but we may as
        # well catch the butler once it's made so it can be reused if needed,
        # given how hard it is to made it robustly

        # TODO: if/when RFC-811 passes, update this to use the env var
        possiblePaths = LATISS_REPO_LOCATION_MAP.values()
        paths = [path for path in possiblePaths if os.path.exists(path)]
        # can only be in one place, will need changing if we ever have repo
        # paths that are the same in the repo map
        assert len(paths) == 1
        butlerPath = paths[0]
        LATISS_REPO_LOCATION_MAP_INVERSE = {
            v: k
            for (k, v) in LATISS_REPO_LOCATION_MAP.items()
        }
        location = LATISS_REPO_LOCATION_MAP_INVERSE[butlerPath]

        with self.assertRaises(RuntimeError):
            makeDefaultLatissButler('')
            makeDefaultLatissButler('ThisIsNotAvalidLocation')

        # butler stuff
        butler = makeDefaultLatissButler(location)
        self.assertIsInstance(butler, dafButler.Butler)
        self.butler = butler

        # dict-like dataIds
        self.rawDataId = getMostRecentDataId(self.butler)
        self.fullId = fillDataId(butler, self.rawDataId)
        self.assertIn('exposure', self.fullId)
        self.assertIn('day_obs', self.fullId)
        self.assertIn('seq_num', self.fullId)
        self.expIdOnly = {'exposure': self.fullId['exposure'], 'detector': 0}
        self.dayObsSeqNumIdOnly = {
            'day_obs': getDayObs(self.fullId),
            'seq_num': getSeqNum(self.fullId),
            'detector': 0
        }

        # expRecords
        self.expRecordNoDetector = getExpRecordFromDataId(
            self.butler, self.rawDataId)
        self.assertIsInstance(self.expRecordNoDetector,
                              dafButler.dimensions.DimensionRecord)
        self.assertFalse(hasattr(self.expRecordNoDetector, 'detector'))
        # just a crosscheck on the above to make sure other things are correct
        self.assertTrue(hasattr(self.expRecordNoDetector, 'instrument'))

        # data coordinates
        # popping here because butler.registry.expandDataId cannot have
        # day_obs or seq_num present right now
        rawDataIdNoDayObSeqNum = _assureDict(self.rawDataId)
        if dayObsKey := _get_dayobs_key(rawDataIdNoDayObSeqNum):
            rawDataIdNoDayObSeqNum.pop(dayObsKey)
Exemplo n.º 2
0
 def __init__(self, location, doRaise=False):
     self.dataProduct = 'quickLookExp'
     self.watcher = Watcher(location, self.dataProduct)
     self.uploader = Uploader()
     self.butler = makeDefaultLatissButler(location)
     self.log = logging.getLogger("specExaminerChannel")
     self.channel = 'summit_specexam'
     self.doRaise = doRaise
Exemplo n.º 3
0
 def __init__(self, location, doRaise=False):
     self.dataProduct = 'quickLookExp'
     self.watcher = Watcher(location, self.dataProduct)
     self.uploader = Uploader()
     self.butler = makeDefaultLatissButler(location)
     self.log = logging.getLogger("monitorChannel")
     self.channel = 'auxtel_monitor'
     self.fig = plt.figure(figsize=(12, 12))
     self.doRaise = doRaise
Exemplo n.º 4
0
 def __init__(self, location, fireflyDisplay, **kwargs):
     """"""
     self.butler = makeDefaultLatissButler(location)
     self.display = fireflyDisplay
     repoDir = LATISS_REPO_LOCATION_MAP[location]
     self.bestEffort = BestEffortIsr(repoDir, **kwargs)
     self.writeQuickLookImages = None
     self.overlayAmps = False  # do the overlay?
     self.measureFromChipCenter = False
Exemplo n.º 5
0
    def __init__(self, location, **kwargs):
        self.butler = makeDefaultLatissButler(location)
        repoDir = LATISS_REPO_LOCATION_MAP[location]
        self._bestEffort = BestEffortIsr(repoDir, **kwargs)
        qfmTaskConfig = QuickFrameMeasurementTaskConfig()
        self._quickMeasure = QuickFrameMeasurementTask(config=qfmTaskConfig)

        self.spectrumHalfWidth = 100
        self.spectrumBoxLength = 20
        self._spectrumBoxOffsets = [882, 1170, 1467]
        self._setColors(len(self._spectrumBoxOffsets))
Exemplo n.º 6
0
 def __init__(self, location, doRaise=False):
     if not HAS_EFD_CLIENT:
         from lsst.rapid.analysis.utils import EFD_CLIENT_MISSING_MSG
         raise RuntimeError(EFD_CLIENT_MISSING_MSG)
     self.dataProduct = 'raw'
     self.watcher = Watcher(location, self.dataProduct)
     self.uploader = Uploader()
     self.butler = makeDefaultLatissButler(location)
     self.client = EfdClient('summit_efd')
     self.log = logging.getLogger("mountTorqueChannel")
     self.channel = 'auxtel_mount_torques'
     self.fig = plt.figure(figsize=(16, 16))
     self.doRaise = doRaise
Exemplo n.º 7
0
    def __init__(self, location, dayObs, deferLoadingData=False):
        self._supressAstroMetadataTranslatorWarnings()  # call early

        self.butler = makeDefaultLatissButler(location)
        if isinstance(dayObs, str):
            dayObs = sanitize_day_obs(dayObs)
            print('Converted string-format dayObs to integer for Gen3')
        self.dayObs = dayObs
        self.data = {}
        self.stars = None
        self.cMap = None
        if not deferLoadingData:
            self.rebuild()
Exemplo n.º 8
0
 def __init__(self, location, dataProduct, **kwargs):
     self.butler = makeDefaultLatissButler(location)
     self.dataProduct = dataProduct
     self.log = logging.getLogger("watcher")
Exemplo n.º 9
0
def animateDay(butler, dayObs, outputPath, dataProductToPlot='quickLookExp'):
    outputFilename = f'{dayObs}.mp4'

    onSkyIds = getLatissOnSkyDataIds(butler, startDate=dayObs, endDate=dayObs)
    logger.info(f"Found {len(onSkyIds)} on sky ids for {dayObs}")

    onSkyIds = [
        updateDataIdOrDataCord(dataId, detector=0) for dataId in onSkyIds
    ]

    animator = Animator(butler,
                        onSkyIds,
                        outputPath,
                        outputFilename,
                        dataProductToPlot=dataProductToPlot,
                        remakePngs=False,
                        debug=False,
                        clobberVideoAndGif=True,
                        plotObjectCentroids=True,
                        useQfmForCentroids=True)
    animator.run()


if __name__ == '__main__':
    # TODO: DM-34239 Move this to be a butler-driven test
    outputPath = '/home/mfl/animatorOutput/main/'
    butler = makeDefaultLatissButler('NCSA')

    day = 20211104
    animateDay(butler, day, outputPath)
Exemplo n.º 10
0
 def __init__(self, location, **kwargs):
     self.butler = makeDefaultLatissButler(location)
     repoDir = LATISS_REPO_LOCATION_MAP[location]
     self._bestEffort = BestEffortIsr(repoDir, **kwargs)