Skip to content

Commit

Permalink
Cache result from yamlCamera.makeCamera
Browse files Browse the repository at this point in the history
Constructing a camera from YAML can take a long time
(10 seconds for imsim) but the resulting object is
immutable.  Caching can significantly speed up code
that creates multiple cameras (in particular gen2 to 3
conversion code).
  • Loading branch information
timj committed Jul 13, 2020
1 parent 0a0a97d commit 829b3ef
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/lsst/obs/base/yamlCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import yaml

from functools import lru_cache
import numpy as np
import lsst.afw.cameraGeom as cameraGeom
import lsst.geom as geom
Expand All @@ -31,6 +32,7 @@
__all__ = ["makeCamera"]


@lru_cache(maxsize=20)
def makeCamera(cameraFile):
"""An imaging camera (e.g. the LSST 3Gpix camera)
Expand Down

0 comments on commit 829b3ef

Please sign in to comment.