Skip to content

Commit 7986e61

Browse files
Louis ThibautLouis Thibaut
authored andcommitted
new option for reading SPT maps
1 parent 9ded78b commit 7986e61

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

pspy/so_map.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,17 @@ def read_map(file, coordinate=None, fields_healpix=None, car_box=None, geometry=
434434
header = hdulist[1].header
435435
new_map.pixel = "HEALPIX"
436436
if fields_healpix is None:
437-
new_map.ncomp = header["TFIELDS"]
437+
438+
# Handle "PARTIAL" HEALPix maps (common in surveys like SPT).
439+
# In this format, the first FITS column is the pixel index, not data.
440+
# We subtract 1 from TFIELDS to get the actual number of physical components.
441+
442+
object_type = header.get("OBJECT", "").upper()
443+
if object_type == "PARTIAL":
444+
new_map.ncomp = header["TFIELDS"] - 1
445+
else:
446+
new_map.ncomp = header["TFIELDS"]
447+
438448
new_map.data = hp.fitsfunc.read_map(file, field=np.arange(new_map.ncomp))
439449
else:
440450
try:

0 commit comments

Comments
 (0)