Not sure if I am doing something wrong, but when I try to get the sky position of a pixel in my deep_coadd patches they are all the same within the same tract. I made a minimal code to show here…
target_ra = 53.2
target_dec = -28.1
radius = 0.52
region = sphgeom.Region.from_ivoa_pos(f"CIRCLE {target_ra} {target_dec} {radius}")
coadd_datasetrefs_i = butler.query_datasets("deep_coadd",
where="patch.region OVERLAPS region AND band='i'",
bind={"region": region},
with_dimension_records=True,
order_by=["patch"])
num = len(coadd_datasetrefs_i)
for inum in range(num):
coadd = butler.get(coadd_datasetrefs_i[inum])
patch = coadd.getMetadata()['LSST BUTLER DATAID PATCH']
tract = coadd.getMetadata()['LSST BUTLER DATAID TRACT']
wcs = coadd.getWcs()
p1 = wcs.pixelToSky(0.0,0.0)
print(patch, tract, p1)
Hi @csabiu , thanks for your question. The origin of a deep_coadd is not (1,1); it depends on the patch. When you provide pixel (0,0), it will return the bottom left of the tract. Yes, your follow up test works.
For the record you can do this loop much simpler with:
for ref in coadd_datasetrefs_i:
wcs = butler.get(ref.makeComponentRef("wcs"))
bbox = butler.get(ref.makeComponentRef("bbox"))
patch = ref.dataId["patch"]
tract = ref.dataId["tract"]
...
it’s also faster because it doesn’t have to read in all the coadds. The code you have takes 2.5 minutes because it has to download the files and read them all in but the component gets go straight to the server. My version takes 55s.