marshallEngine.feeders.images module

cache the panstarrs image stamps

Author

David Young

class images[source]

Bases: object

The base class for the feeder image cachers

Usage

To create a new survey image cacher create a new class using this class as the baseclass:

from ..images import images as baseimages
class images(baseimages):
    ....
cache(limit=1000)[source]

cache the image for the requested survey

Key Arguments

  • limit – limit the number of transients in the list so not to piss-off survey owners by downloading everything in one go.

Usage

from marshallEngine.feeders.panstarrs import images
cacher = images(
    log=log,
    settings=settings,
    dbConn=dbConn
).cache(limit=1000)
_list_images_needing_cached(failedImage=False)[source]

get lists of the transientBucketIds and images needing cached for those transients

Key Arguments

  • failedImage – second pass attempt to download alternative image for transients

Return

  • transientBucketIds, subtractedUrls, targetUrls, referenceUrls, tripletUrls – synced lists of transientBucketIds, subtracted-, target-, reference- and triplet-image urls. All lists are the same size.

_download(transientBucketIds, subtractedUrls, targetUrls, referenceUrls, tripletUrls)[source]

cache the images for the survey under their transientBucketId folders in the web-server cache

Key Arguments

  • transientBucketIds – the list of transientBucketId for the transients needing images downloaded.

  • subtractedUrls – the list of subtracted image urls (same length as transientBucketIds list).

  • targetUrls – the list of target image urls (same length as transientBucketIds list).

  • referenceUrls – the list of reference image urls (same length as transientBucketIds list).

  • tripletUrls – the list of triplet image urls (same length as transientBucketIds list).

Return

  • subtractedStatus – status of the subtracted image download (0 = fail, 1 = success, 2 = does not exist)

  • targetStatus – status of the target image download (0 = fail, 1 = success, 2 = does not exist)

  • referenceStatus – status of the reference image download (0 = fail, 1 = success, 2 = does not exist)

  • tripletStatus – status of the triplet image download (0 = fail, 1 = success, 2 = does not exist)

_update_database()[source]

update the database to show which images have been cached on the server

download_image_array(imageArray, log, survey, downloadPath)[source]

download an array of transient image stamps

Key Arguments

  • log – logger

  • imageArray – [transientBucketId, subtractedUrl, targetUrl, referenceUrl, tripletUrl]

  • survey – name of the survey to name stamps with

  • downloadPath – directory to download the images into

Return

  • statusArray – [subtractedStatus, targetStatus, referenceStatus, tripletStatus]