LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
◆ exposureFromImage()
def lsst.obs.base.cameraMapper.exposureFromImage |
( |
|
image, |
|
|
|
dataId = None , |
|
|
|
mapper = None , |
|
|
|
logger = None , |
|
|
|
setVisitInfo = True |
|
) |
| |
Generate an Exposure from an image-like object
If the image is a DecoratedImage then also set its WCS and metadata
(Image and MaskedImage are missing the necessary metadata
and Exposure already has those set)
Parameters
----------
image : Image-like object
Can be one of lsst.afw.image.DecoratedImage, Image, MaskedImage or
Exposure.
Returns
-------
`lsst.afw.image.Exposure`
Exposure containing input image.
Definition at line 1286 of file cameraMapper.py.
1286 def exposureFromImage(image, dataId=None, mapper=None, logger=None, setVisitInfo=True):
1287 """Generate an Exposure from an image-like object
1289 If the image is a DecoratedImage then also set its WCS and metadata
1290 (Image and MaskedImage are missing the necessary metadata
1291 and Exposure already has those set)
1295 image : Image-like object
1296 Can be one of lsst.afw.image.DecoratedImage, Image, MaskedImage or
1301 `lsst.afw.image.Exposure`
1302 Exposure containing input image.
1304 translatorClass =
None
1305 if mapper
is not None:
1306 translatorClass = mapper.translatorClass
1313 metadata = image.getMetadata()
1314 fix_header(metadata, translator_class=translatorClass)
1315 exposure.setMetadata(metadata)
1318 metadata = exposure.getMetadata()
1319 fix_header(metadata, translator_class=translatorClass)
1324 if setVisitInfo
and exposure.getInfo().getVisitInfo()
is None:
1325 if metadata
is not None:
1328 logger = lsstLog.Log.getLogger(
"CameraMapper")
1329 logger.warn(
"I can only set the VisitInfo if you provide a mapper")
1331 exposureId = mapper._computeCcdExposureId(dataId)
1332 visitInfo = mapper.makeRawVisitInfo(md=metadata, exposureId=exposureId)
1334 exposure.getInfo().setVisitInfo(visitInfo)
◆ validateRecipeFitsStorage()
def lsst.obs.base.cameraMapper.validateRecipeFitsStorage |
( |
|
recipes | ) |
|
Validate recipes for FitsStorage
The recipes are supplemented with default values where appropriate.
TODO: replace this custom validation code with Cerberus (DM-11846)
Parameters
----------
recipes : `lsst.daf.persistence.Policy`
FitsStorage recipes to validate.
Returns
-------
validated : `lsst.daf.base.PropertySet`
Validated FitsStorage recipe.
Raises
------
`RuntimeError`
If validation fails.
Definition at line 1339 of file cameraMapper.py.
1340 """Validate recipes for FitsStorage
1342 The recipes are supplemented with default values where appropriate.
1344 TODO: replace this custom validation code with Cerberus (DM-11846)
1348 recipes : `lsst.daf.persistence.Policy`
1349 FitsStorage recipes to validate.
1353 validated : `lsst.daf.base.PropertySet`
1354 Validated FitsStorage recipe.
1359 If validation fails.
1363 compressionSchema = {
1364 "algorithm":
"NONE",
1367 "quantizeLevel": 0.0,
1370 "algorithm":
"NONE",
1372 "maskPlanes": [
"NO_DATA"],
1374 "quantizeLevel": 4.0,
1381 def checkUnrecognized(entry, allowed, description):
1382 """Check to see if the entry contains unrecognised keywords"""
1383 unrecognized =
set(entry.keys()) -
set(allowed)
1386 "Unrecognized entries when parsing image compression recipe %s: %s" %
1387 (description, unrecognized))
1390 for name
in recipes.names(
True):
1391 checkUnrecognized(recipes[name], [
"image",
"mask",
"variance"], name)
1393 validated[name] = rr
1394 for plane
in (
"image",
"mask",
"variance"):
1395 checkUnrecognized(recipes[name][plane], [
"compression",
"scaling"],
1396 name +
"->" + plane)
1398 for settings, schema
in ((
"compression", compressionSchema),
1399 (
"scaling", scalingSchema)):
1400 prefix = plane +
"." + settings
1401 if settings
not in recipes[name][plane]:
1403 rr.set(prefix +
"." + key, schema[key])
1405 entry = recipes[name][plane][settings]
1406 checkUnrecognized(entry, schema.keys(), name +
"->" + plane +
"->" + settings)
1408 value =
type(schema[key])(entry[key])
if key
in entry
else schema[key]
1409 rr.set(prefix +
"." + key, value)
A container for an Image and its associated metadata.
A class to contain the data, WCS, and other information needed to describe an image of the sky.
std::shared_ptr< Exposure< ImagePixelT, MaskPixelT, VariancePixelT > > makeExposure(MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
A function to return an Exposure of the correct type (cf.
A class to manipulate images, masks, and variance as a single object.
def exposureFromImage(image, dataId=None, mapper=None, logger=None, setVisitInfo=True)
def validateRecipeFitsStorage(recipes)
Class for storing generic metadata.
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > * makeMaskedImage(typename std::shared_ptr< Image< ImagePixelT >> image, typename std::shared_ptr< Mask< MaskPixelT >> mask=Mask< MaskPixelT >(), typename std::shared_ptr< Image< VariancePixelT >> variance=Image< VariancePixelT >())
A function to return a MaskedImage of the correct type (cf.
daf::base::PropertySet * set