LSST Applications  21.0.0+75b29a8a7f,21.0.0+e70536a077,21.0.0-1-ga51b5d4+62c747d40b,21.0.0-10-gbfb87ad6+3307648ee3,21.0.0-15-gedb9d5423+47cba9fc36,21.0.0-2-g103fe59+fdf0863a2a,21.0.0-2-g1367e85+d38a93257c,21.0.0-2-g45278ab+e70536a077,21.0.0-2-g5242d73+d38a93257c,21.0.0-2-g7f82c8f+e682ffb718,21.0.0-2-g8dde007+d179fbfa6a,21.0.0-2-g8f08a60+9402881886,21.0.0-2-ga326454+e682ffb718,21.0.0-2-ga63a54e+08647d4b1b,21.0.0-2-gde069b7+26c92b3210,21.0.0-2-gecfae73+0445ed2f95,21.0.0-2-gfc62afb+d38a93257c,21.0.0-27-gbbd0d29+ae871e0f33,21.0.0-28-g5fc5e037+feb0e9397b,21.0.0-3-g21c7a62+f4b9c0ff5c,21.0.0-3-g357aad2+57b0bddf0b,21.0.0-3-g4be5c26+d38a93257c,21.0.0-3-g65f322c+3f454acf5d,21.0.0-3-g7d9da8d+75b29a8a7f,21.0.0-3-gaa929c8+9e4ef6332c,21.0.0-3-ge02ed75+4b120a55c4,21.0.0-4-g3300ddd+e70536a077,21.0.0-4-g591bb35+4b120a55c4,21.0.0-4-gc004bbf+4911b9cd27,21.0.0-4-gccdca77+f94adcd104,21.0.0-4-ge8fba5a+2b3a696ff9,21.0.0-5-gb155db7+2c5429117a,21.0.0-5-gdf36809+637e4641ee,21.0.0-6-g00874e7+c9fd7f7160,21.0.0-6-g4e60332+4b120a55c4,21.0.0-7-gc8ca178+40eb9cf840,21.0.0-8-gfbe0b4b+9e4ef6332c,21.0.0-9-g2fd488a+d83b7cd606,w.2021.05
LSST Data Management Base Package
Public Member Functions | Public Attributes | List of all members
lsst.obs.base.gen2to3.repoConverter.ConversionSubset Class Reference

Public Member Functions

def __init__ (self, str instrument, Set[int] visits)
 
def addSkyMap (self, Registry registry, str name)
 
def addSkyPix (self, Registry registry, SkyPixDimension dimension)
 
bool isRelated (self, DataCoordinate dataId)
 

Public Attributes

 instrument
 
 visits
 
 regions
 
 tracts
 
 skypix
 

Detailed Description

A helper class for `ConvertRepoTask` and `RepoConverter` that maintains
lists of related data ID values that should be included in the conversion.

Parameters
----------
instrument : `str`
    Instrument name used in Gen3 data IDs.
visits : `set` of `int`
    Visit IDs that define the filter.

Definition at line 57 of file repoConverter.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.obs.base.gen2to3.repoConverter.ConversionSubset.__init__ (   self,
str  instrument,
Set[int]  visits 
)

Definition at line 69 of file repoConverter.py.

69  def __init__(self, instrument: str, visits: Set[int]):
70  self.instrument = instrument
71  self.visits = visits
72  self.regions = None
73  self.tracts = {}
74  self.skypix = {}
75 

Member Function Documentation

◆ addSkyMap()

def lsst.obs.base.gen2to3.repoConverter.ConversionSubset.addSkyMap (   self,
Registry  registry,
str  name 
)
Populate the included tract IDs for the given skymap from those that
overlap the visits the `ConversionSubset` was initialized with.

Parameters
----------
registry : `lsst.daf.butler.Registry`
    Registry that can be queried for visit/tract overlaps.
name : `str`
    SkyMap name used in Gen3 data IDs.

Definition at line 76 of file repoConverter.py.

76  def addSkyMap(self, registry: Registry, name: str):
77  """Populate the included tract IDs for the given skymap from those that
78  overlap the visits the `ConversionSubset` was initialized with.
79 
80  Parameters
81  ----------
82  registry : `lsst.daf.butler.Registry`
83  Registry that can be queried for visit/tract overlaps.
84  name : `str`
85  SkyMap name used in Gen3 data IDs.
86  """
87  tracts = set()
88  self.tracts[name] = tracts
89  for visit in self.visits:
90  for dataId in registry.queryDataIds(["tract"],
91  dataId={"skymap": name,
92  "instrument": self.instrument,
93  "visit": visit}):
94  tracts.add(dataId["tract"])
95 
daf::base::PropertySet * set
Definition: fits.cc:912

◆ addSkyPix()

def lsst.obs.base.gen2to3.repoConverter.ConversionSubset.addSkyPix (   self,
Registry  registry,
SkyPixDimension  dimension 
)
Populate the included skypix IDs for the given dimension from those
that overlap the visits the `ConversionSubset` was initialized with.

Parameters
----------
registry : `lsst.daf.butler.Registry`
    Registry that can be queried for visit regions.
name : `str`
    SkyMap name used in Gen3 data IDs.

Definition at line 96 of file repoConverter.py.

96  def addSkyPix(self, registry: Registry, dimension: SkyPixDimension):
97  """Populate the included skypix IDs for the given dimension from those
98  that overlap the visits the `ConversionSubset` was initialized with.
99 
100  Parameters
101  ----------
102  registry : `lsst.daf.butler.Registry`
103  Registry that can be queried for visit regions.
104  name : `str`
105  SkyMap name used in Gen3 data IDs.
106  """
107  if self.regions is None:
108  self.regions = []
109  for visit in self.visits:
110  dataId = registry.expandDataId(instrument=self.instrument, visit=visit)
111  self.regions.append(dataId.region)
112  ranges = RangeSet()
113  for region in self.regions:
114  ranges = ranges.union(dimension.pixelization.envelope(region))
115  self.skypix[dimension] = ranges
116 
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33

◆ isRelated()

bool lsst.obs.base.gen2to3.repoConverter.ConversionSubset.isRelated (   self,
DataCoordinate  dataId 
)
Test whether the given data ID is related to this subset and hence
should be included in a repository conversion.

Parameters
----------
dataId : `lsst.daf.butler.DataCoordinate`
    Data ID to test.

Returns
-------
related : `bool`
    `True` if this data ID should be included in a repository
    conversion.

Notes
-----
More formally, this tests that the given data ID is not unrelated;
if a data ID does not involve tracts, visits, or skypix dimensions,
we always include it.

Definition at line 117 of file repoConverter.py.

117  def isRelated(self, dataId: DataCoordinate) -> bool:
118  """Test whether the given data ID is related to this subset and hence
119  should be included in a repository conversion.
120 
121  Parameters
122  ----------
123  dataId : `lsst.daf.butler.DataCoordinate`
124  Data ID to test.
125 
126  Returns
127  -------
128  related : `bool`
129  `True` if this data ID should be included in a repository
130  conversion.
131 
132  Notes
133  -----
134  More formally, this tests that the given data ID is not unrelated;
135  if a data ID does not involve tracts, visits, or skypix dimensions,
136  we always include it.
137  """
138  if self.visits is None:
139  # We're not filtering at all.
140  return True
141  if "visit" in dataId.graph and dataId["visit"] not in self.visits:
142  return False
143  if "tract" in dataId.graph and dataId["tract"] not in self.tracts[dataId["skymap"]]:
144  return False
145  for dimension, ranges in self.skypix.items():
146  if dimension in dataId.graph and not ranges.intersects(dataId[dimension]):
147  return False
148  return True
149 
std::vector< SchemaItem< Flag > > * items

Member Data Documentation

◆ instrument

lsst.obs.base.gen2to3.repoConverter.ConversionSubset.instrument

Definition at line 70 of file repoConverter.py.

◆ regions

lsst.obs.base.gen2to3.repoConverter.ConversionSubset.regions

Definition at line 72 of file repoConverter.py.

◆ skypix

lsst.obs.base.gen2to3.repoConverter.ConversionSubset.skypix

Definition at line 74 of file repoConverter.py.

◆ tracts

lsst.obs.base.gen2to3.repoConverter.ConversionSubset.tracts

Definition at line 73 of file repoConverter.py.

◆ visits

lsst.obs.base.gen2to3.repoConverter.ConversionSubset.visits

Definition at line 71 of file repoConverter.py.


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