LSST Applications  22.0.1,22.0.1+01bcf6a671,22.0.1+046ee49490,22.0.1+05c7de27da,22.0.1+0c6914dbf6,22.0.1+1220d50b50,22.0.1+12fd109e95,22.0.1+1a1dd69893,22.0.1+1c910dc348,22.0.1+1ef34551f5,22.0.1+30170c3d08,22.0.1+39153823fd,22.0.1+611137eacc,22.0.1+771eb1e3e8,22.0.1+94e66cc9ed,22.0.1+9a075d06e2,22.0.1+a5ff6e246e,22.0.1+a7db719c1a,22.0.1+ba0d97e778,22.0.1+bfe1ee9056,22.0.1+c4e1e0358a,22.0.1+cc34b8281e,22.0.1+d640e2c0fa,22.0.1+d72a2e677a,22.0.1+d9a6b571bd,22.0.1+e485e9761b,22.0.1+ebe8d3385e
LSST Data Management Base Package
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.base.shims.ShimDataRef Class Reference

Public Member Functions

def __init__ (self, butlerSubset, dataId)
 
def get (self, datasetType=None, **rest)
 
def put (self, obj, datasetType=None, doBackup=False, **rest)
 
def datasetExists (self, datasetType=None, write=False, **rest)
 
def getButler (self)
 

Public Attributes

 butlerSubset
 
 dataId
 

Static Public Attributes

float GENERATION = 2.5
 

Detailed Description

A shim for a Gen2 `~lsst.daf.persistence.ButlerDataRef` with a Gen3
`~lsst.daf.butler.Butler` backend.

Parameters
----------
butlerSubset : `ShimButlerSubset`
    ButlerSubset shim instance.  Sets the butler and default dataset type
    used by the Dataref.
dataId : `dict` or `~lsst.daf.butler.DataId`
    Generation 3 data ID associated with this reference.

Definition at line 224 of file shims.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.base.shims.ShimDataRef.__init__ (   self,
  butlerSubset,
  dataId 
)

Definition at line 241 of file shims.py.

241  def __init__(self, butlerSubset, dataId):
242  self.butlerSubset = butlerSubset
243  self.dataId = dataId
244 

Member Function Documentation

◆ datasetExists()

def lsst.pipe.base.shims.ShimDataRef.datasetExists (   self,
  datasetType = None,
  write = False,
**  rest 
)
Check whether a datataset exists in the repository.

Parameters
----------
datasetType : `str`, optional
    Name of the dataset type.  Defaults to the dataset type used to
    construct the `ShimButlerSubset`.
write : `bool`
    This option is provided for compatibility with
    `lsst.daf.persistence.ButlerDataRef`, but must be `False`.
rest
    Additional arguments forwarded to `ShimButler.datasetExists`.

Returns
-------
exists : `bool`
    `True` if the dataset is present in the repository, `False`
    otherwise.

Definition at line 290 of file shims.py.

290  def datasetExists(self, datasetType=None, write=False, **rest):
291  """Check whether a datataset exists in the repository.
292 
293  Parameters
294  ----------
295  datasetType : `str`, optional
296  Name of the dataset type. Defaults to the dataset type used to
297  construct the `ShimButlerSubset`.
298  write : `bool`
299  This option is provided for compatibility with
300  `lsst.daf.persistence.ButlerDataRef`, but must be `False`.
301  rest
302  Additional arguments forwarded to `ShimButler.datasetExists`.
303 
304  Returns
305  -------
306  exists : `bool`
307  `True` if the dataset is present in the repository, `False`
308  otherwise.
309  """
310  if datasetType is None:
311  datasetType = self.butlerSubset.datasetType
312  return self.butlerSubset.butler.datasetExists(
313  datasetType, self.dataId, write=write, **rest)
314 

◆ get()

def lsst.pipe.base.shims.ShimDataRef.get (   self,
  datasetType = None,
**  rest 
)
Retrieve a dataset.

Parameters
----------
datasetType : `str`, optional.
    Name of the dataset type.  Defaults to the dataset type used to
    construct the `ShimButlerSubset`.
rest
    Additional arguments forwarded to `ShimButler.get`.

Returns
-------
dataset
    Retrieved object.

Raises
------
`~lsst.daf.persistence.NoResults`
    Raised if the dataset does not exist.

Definition at line 245 of file shims.py.

245  def get(self, datasetType=None, **rest):
246  """Retrieve a dataset.
247 
248  Parameters
249  ----------
250  datasetType : `str`, optional.
251  Name of the dataset type. Defaults to the dataset type used to
252  construct the `ShimButlerSubset`.
253  rest
254  Additional arguments forwarded to `ShimButler.get`.
255 
256  Returns
257  -------
258  dataset
259  Retrieved object.
260 
261  Raises
262  ------
263  `~lsst.daf.persistence.NoResults`
264  Raised if the dataset does not exist.
265  """
266  if datasetType is None:
267  datasetType = self.butlerSubset.datasetType
268  return self.butlerSubset.butler.get(datasetType, self.dataId, **rest)
269 

◆ getButler()

def lsst.pipe.base.shims.ShimDataRef.getButler (   self)
Return the (shim) Butler used by this DataRef.

Definition at line 315 of file shims.py.

315  def getButler(self):
316  """Return the (shim) Butler used by this DataRef.
317  """
318  return self.butlerSubset.butler

◆ put()

def lsst.pipe.base.shims.ShimDataRef.put (   self,
  obj,
  datasetType = None,
  doBackup = False,
**  rest 
)
Write a dataset.

Parameters
----------
obj
    Object to write.
datasetType : `str`, optional
    Name of the dataset type.  Defaults to the dataset type used to
    construct the `ShimButlerSubset`.
doBackup : `bool`
    This option is provided for compatibility with
    `lsst.daf.persistence.ButlerDataRef`, but must be `False`.
rest
    Additional arguments forwarded to `ShimButler.put`.

Definition at line 270 of file shims.py.

270  def put(self, obj, datasetType=None, doBackup=False, **rest):
271  """Write a dataset.
272 
273  Parameters
274  ----------
275  obj
276  Object to write.
277  datasetType : `str`, optional
278  Name of the dataset type. Defaults to the dataset type used to
279  construct the `ShimButlerSubset`.
280  doBackup : `bool`
281  This option is provided for compatibility with
282  `lsst.daf.persistence.ButlerDataRef`, but must be `False`.
283  rest
284  Additional arguments forwarded to `ShimButler.put`.
285  """
286  if datasetType is None:
287  datasetType = self.butlerSubset.datasetType
288  self.butlerSubset.butler.put(obj, datasetType, self.dataId, doBackup=doBackup, **rest)
289 

Member Data Documentation

◆ butlerSubset

lsst.pipe.base.shims.ShimDataRef.butlerSubset

Definition at line 242 of file shims.py.

◆ dataId

lsst.pipe.base.shims.ShimDataRef.dataId

Definition at line 243 of file shims.py.

◆ GENERATION

float lsst.pipe.base.shims.ShimDataRef.GENERATION = 2.5
static

Definition at line 237 of file shims.py.


The documentation for this class was generated from the following file: