-
Notifications
You must be signed in to change notification settings - Fork 9
DM-49302: Make GetTemplateTask more memory efficient #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7c978ba
af79f7e
ed4de0b
9498418
858b34f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| import lsst.afw.image as afwImage | ||
| import lsst.afw.math as afwMath | ||
| import lsst.afw.table as afwTable | ||
| from lsst.daf.butler import DataCoordinate, DimensionUniverse | ||
| import lsst.meas.algorithms as measAlg | ||
| import lsst.meas.base as measBase | ||
| from lsst.meas.algorithms.testUtils import plantSources | ||
|
|
@@ -1147,3 +1148,76 @@ class CustomCoaddPsf(measAlg.CoaddPsf): | |
| """ | ||
| def getAveragePosition(self): | ||
| return geom.Point2D(-10000, -10000) | ||
|
|
||
|
|
||
| def generate_data_id(*, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooof, is this really necessary? That's unfortunate. I'd have thought there was an easier way to do this in the middleware, but maybe not if we don't have a real butler? If you lifted this from elsewhere, is there a place we could put it that both could use instead of having it be copied?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original that I based this on is in |
||
| tract: int = 9813, | ||
| patch: int = 42, | ||
| cell_x: int = 4, | ||
| cell_y: int = 2, | ||
| band: str = "notR", | ||
| ) -> DataCoordinate: | ||
| """Generate a DataCoordinate instance to use as data_id. | ||
|
|
||
| Modified from ``generate_data_id`` in ``lsst.cell_coadds.test_utils`` | ||
|
|
||
| Parameters | ||
| ---------- | ||
| tract : `int`, optional | ||
| Tract ID for the data_id | ||
| patch : `int`, optional | ||
| Patch ID for the data_id | ||
| cell_x : `int`, optional | ||
| X index of the cell this patch corresponds to | ||
| cell_y : `int`, optional | ||
| Y index of the cell this patch corresponds to | ||
| band : `str`, optional | ||
| Band for the data_id | ||
|
|
||
| Returns | ||
| ------- | ||
| data_id : `lsst.daf.butler.DataCoordinate` | ||
| An expanded data_id instance. | ||
| """ | ||
| universe = DimensionUniverse() | ||
|
|
||
| instrument = universe["instrument"] | ||
| instrument_record = instrument.RecordClass( | ||
| name="DummyCam", | ||
| class_name="lsst.obs.base.instrument_tests.DummyCam", | ||
| ) | ||
|
|
||
| skymap = universe["skymap"] | ||
| skymap_record = skymap.RecordClass(name="test_skymap") | ||
|
|
||
| band_element = universe["band"] | ||
| band_record = band_element.RecordClass(name=band) | ||
|
|
||
| physical_filter = universe["physical_filter"] | ||
| physical_filter_record = physical_filter.RecordClass(name=band, instrument="test", band=band) | ||
|
|
||
| patch_element = universe["patch"] | ||
| patch_record = patch_element.RecordClass( | ||
| skymap="test_skymap", tract=tract, patch=patch, cell_x=cell_x, cell_y=cell_y | ||
| ) | ||
|
|
||
| # A dictionary with all the relevant records. | ||
| record = { | ||
| "instrument": instrument_record, | ||
| "patch": patch_record, | ||
| "tract": 9813, | ||
| "band": band_record.name, | ||
| "skymap": skymap_record.name, | ||
| "physical_filter": physical_filter_record, | ||
| } | ||
|
|
||
| # A dictionary with all the relevant recordIds. | ||
| record_id = record.copy() | ||
| for key in ( | ||
| "instrument", | ||
| "physical_filter", | ||
| ): | ||
| record_id[key] = record_id[key].name | ||
|
|
||
| data_id = DataCoordinate.standardize(record_id, universe=universe) | ||
| return data_id.expanded(record) | ||
Uh oh!
There was an error while loading. Please reload this page.