If you have been previously writing code that used visit
, simply changing that to expId
will be enough.
So what am I doing wrong:
Using w_2020_04:
In [1]: import lsst.daf.persistence as dafPersist
In [2]: butlerDir = "/datasets/DC2/repo/rerun/w_2019_50/DM-22665/multi"
...: butler = dafPersist.Butler(butlerDir)
CameraMapper INFO: Loading exposure registry from /datasets/DC2/repo/registry.sqlite3
CameraMapper INFO: Loading calib registry from /datasets/DC2/repo/CALIB/calibRegistry.sqlite3
visiCameraMapper INFO: Loading calib registry from /datasets/DC2/repo/CALIB/calibRegistry.sqlite3
LsstCamMapper WARN: Unable to find valid calib root directory
LsstCamMapper WARN: Unable to find valid calib root directory
In [3]: visitDataId = {"visit": 179972, "detector": 7, "filter": "u"}
In [4]: exp = butler.get("calexp", visitDataId)
In [5]: exp
Out[5]: <lsst.afw.image.exposure.exposure.ExposureF at 0x7f5324aab618>
but using w_2020_05 (note “visit” -> “expId”):
In [1]: import lsst.daf.persistence as dafPersist
In [2]: butlerDir = "/datasets/DC2/repo/rerun/w_2019_50/DM-22665/multi"
...: butler = dafPersist.Butler(butlerDir)
CameraMapper INFO: Loading exposure registry from /datasets/DC2/repo/registry.sqlite3
CameraMapper INFO: Loading calib registry from /datasets/DC2/repo/CALIB/calibRegistry.sqlite3
CameraMapper INFO: Loading calib registry from /datasets/DC2/repo/CALIB/calibRegistry.sqlite3
LsstCamMapper WARN: Unable to find valid calib root directory
LsstCamMapper WARN: Unable to find valid calib root directory
In [3]: visitDataId = {"expId": 179972, "detector": 7, "filter": "u"}
In [4]: exp = butler.get("calexp", visitDataId)
---------------------------------------------------------------------------
OperationalError Traceback (most recent call last)
<ipython-input-4-7192716177fa> in <module>
----> 1 exp = butler.get("calexp", visitDataId)
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/daf_persistence/19.0.0-1-g6fe20d0+5/python/lsst/daf/persistence/butler.py in get(self, datasetType, dataId, immediate, **rest)
1372 dataId.update(**rest)
1373
-> 1374 location = self._locate(datasetType, dataId, write=False)
1375 if location is None:
1376 raise NoResults("No locations for get:", datasetType, dataId)
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/daf_persistence/19.0.0-1-g6fe20d0+5/python/lsst/daf/persistence/butler.py in _locate(self, datasetType, dataId, write)
1291 components = components[1:]
1292 try:
-> 1293 location = repoData.repo.map(datasetType, dataId, write=write)
1294 except NoResults:
1295 continue
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/daf_persistence/19.0.0-1-g6fe20d0+5/python/lsst/daf/persistence/repository.py in map(self, *args, **kwargs)
237 if self._mapper is None:
238 raise RuntimeError("No mapper assigned to Repository")
--> 239 loc = self._mapper.map(*args, **kwargs)
240 if not loc:
241 return None
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/daf_persistence/19.0.0-1-g6fe20d0+5/python/lsst/daf/persistence/mapper.py in map(self, datasetType, dataId, write)
161 """
162 func = getattr(self, 'map_' + datasetType)
--> 163 return func(self.validate(dataId), write)
164
165 def canStandardize(self, datasetType):
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/obs_base/19.0.0-20-g6de566f+1/python/lsst/obs/base/cameraMapper.py in mapClosure(dataId, write, mapper, mapping)
383 if not hasattr(self, "map_" + datasetType):
384 def mapClosure(dataId, write=False, mapper=weakref.proxy(self), mapping=mapping):
--> 385 return mapping.map(mapper, dataId, write)
386 setattr(self, "map_" + datasetType, mapClosure)
387 if not hasattr(self, "query_" + datasetType):
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/obs_base/19.0.0-20-g6de566f+1/python/lsst/obs/base/mapping.py in map(self, mapper, dataId, write)
150 Location of object that was mapped.
151 """
--> 152 actualId = self.need(iter(self.keyDict.keys()), dataId)
153 usedDataId = {key: actualId[key] for key in self.keyDict.keys()}
154 path = mapper._mapActualToPath(self.template, actualId)
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/obs_base/19.0.0-20-g6de566f+1/python/lsst/obs/base/mapping.py in need(self, properties, dataId)
314 return newId
315
--> 316 lookups = self.lookup(newProps, newId)
317 if len(lookups) != 1:
318 raise NoResults("No unique lookup for %s from %s: %d matches" %
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/obs_base/19.0.0-20-g6de566f+1/python/lsst/obs/base/mapping.py in lookup(self, properties, dataId)
259 # here we transform that to {(lowKey, highKey): value}
260 lookupDataId[(self.range[1], self.range[2])] = dataId[self.obsTimeName]
--> 261 result = self.registry.lookup(properties, self.tables, lookupDataId, template=self.template)
262 if not removed:
263 return result
/software/lsstsw/stack_20191101/stack/miniconda3-4.5.12-4d7b902/Linux64/daf_persistence/19.0.0-1-g6fe20d0+5/python/lsst/daf/persistence/registries.py in lookup(self, lookupProperties, reference, dataId, **kwargs)
363 cmd += " WHERE " + " AND ".join(whereList)
364 cursor = self.conn.cursor()
--> 365 cursor.execute(cmd, valueList)
366 return [row for row in cursor.fetchall()]
367
OperationalError: no such column: expId
I should also note that I get the same error even if I use “visit” as the key string in the above.