Skip to content

Commit

Permalink
Merge pull request #853 from lsst/tickets/DM-41303
Browse files Browse the repository at this point in the history
DM-41303: Ensure that we skip empty maps that should not be appended.
  • Loading branch information
erykoff authored Oct 24, 2023
2 parents e525375 + 53c70d7 commit dacf46b
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions python/lsst/pipe/tasks/healSparseMapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,29 @@ def run(self, sky_map, tract, band, coadd_dict, input_map_dict, visit_summary_di
patch_info = tract_info[patch]

input_map = input_map_dict[patch].get()

# Initialize the tract maps as soon as we have the first input
# map for getting nside information.
if not tract_maps_initialized:
# We use the first input map nside information to initialize
# the tract maps
nside_coverage = self._compute_nside_coverage_tract(tract_info)
nside = input_map.nside_sparse

do_compute_approx_psf = False
# Initialize the tract maps
for property_map in self.property_maps:
property_map.initialize_tract_maps(nside_coverage, nside)
if property_map.requires_psf:
do_compute_approx_psf = True

tract_maps_initialized = True

if input_map.valid_pixels.size == 0:
self.log.warning("No valid pixels for band %s, tract %d, patch %d; skipping.",
band, tract, patch)
continue

coadd_photo_calib = coadd_dict[patch].get(component="photoCalib")
coadd_inputs = coadd_dict[patch].get(component="coaddInputs")

Expand All @@ -568,21 +588,6 @@ def run(self, sky_map, tract, band, coadd_dict, input_map_dict, visit_summary_di
patch_poly_map = patch_poly.get_map_like(input_map)
input_map = hsp.and_intersection([input_map, patch_poly_map])

if not tract_maps_initialized:
# We use the first input map nside information to initialize
# the tract maps
nside_coverage = self._compute_nside_coverage_tract(tract_info)
nside = input_map.nside_sparse

do_compute_approx_psf = False
# Initialize the tract maps
for property_map in self.property_maps:
property_map.initialize_tract_maps(nside_coverage, nside)
if property_map.requires_psf:
do_compute_approx_psf = True

tract_maps_initialized = True

valid_pixels, vpix_ra, vpix_dec = input_map.valid_pixels_pos(return_pixels=True)

# Check if there are no valid pixels for the inner (unique) patch region
Expand Down

0 comments on commit dacf46b

Please sign in to comment.