Skip to content
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

Pass the location information to the WorkUnit #738

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/kbmod/image_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,10 +885,18 @@ def toWorkUnit(self, search_config=None, **kwargs):

logger.info("Building WorkUnit from ImageCollection")
layeredImages = []
locations = []
for std in self.get_standardizers(**kwargs):
location = std["std"].location
for img in std["std"].toLayeredImage():
layeredImages.append(img)
locations.append(location)
imgstack = ImageStack(layeredImages)
if None not in self.wcs:
return WorkUnit(imgstack, search_config, per_image_wcs=list(self.wcs))
return WorkUnit(imgstack, search_config)
per_img_wcs = list(self.wcs) if None not in self.wcs else None

return WorkUnit(
imgstack,
search_config,
per_image_wcs=per_img_wcs,
constituent_images=locations,
)
5 changes: 5 additions & 0 deletions tests/test_imagecollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ def test_workunit(self):
data = self.fitsFactory.get_n(3, spoof_data=True)
ic = ImageCollection.fromTargets(data)
wu = ic.toWorkUnit(search_config=SearchConfiguration())
self.assertEqual(len(wu), 3)
for loc in wu.constituent_images:
self.assertEqual(loc, ":memory:")

# Write out the WorkUnit.
with tempfile.TemporaryDirectory() as dir_name:
wu.to_fits(f"{dir_name}/test.fits")

Expand Down
Loading