Skip to content

Commit

Permalink
Merge pull request #341 from LSSTDESC/fourier_configure
Browse files Browse the repository at this point in the history
More configurable TXTwoPointFourier
  • Loading branch information
tmcornish committed May 17, 2024
2 parents a849e2d + 437c6ea commit d4490e3
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 122 deletions.
4 changes: 4 additions & 0 deletions examples/metacal/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ TXTwoPointFourier:
ell_max: 150
bandwidth: 20
cache_dir: ./cache/workspaces
do_shear_shear: True
do_shear_pos: True
do_pos_pos: True
compute_theory: True

TXSimpleMask:
depth_cut : 23.5
Expand Down
4 changes: 4 additions & 0 deletions examples/metadetect/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ TXTwoPointFourier:
ell_max: 100
bandwidth: 20
cache_dir: ./cache/workspaces
do_shear_shear: True
do_shear_pos: True
do_pos_pos: True
compute_theory: True

TXSimpleMaskFrac:
supreme_map_file: data/example/inputs/supreme_dc2_dr6d_v2_g_nexp_sum_1deg2.hs
Expand Down
4 changes: 2 additions & 2 deletions txpipe/data_types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ def read_map(self, map_name):
raise ValueError(f"Unknown map pixelization type {pixelization}")
return m

def read_mask(self):
def read_mask(self, thresh=0):
mask = self.read_map("mask")
mask[mask < 0] = 0
mask[mask <= thresh] = 0
return mask

def write_map(self, map_name, pixel, value, metadata):
Expand Down
16 changes: 6 additions & 10 deletions txpipe/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,22 +425,18 @@ class TXDensityMaps(PipelineStage):
("density_maps", MapsFile),
]
config_options = {
'weight_thresh': 0.
"mask_threshold": 0.0
}

def run(self):
import healpy

# Read the mask
# Read the mask and set all pixels below the threshold to 0
with self.open_input("mask", wrapper=True) as f:
mask = f.read_map("mask")

# set unseen pixels to weight zero
mask[mask == healpy.UNSEEN] = 0
mask[np.isnan(mask)] = 0
mask = mask.flatten()
#identify pixels to keep (i.e. mask value above specified threshold)
pix_keep = mask > self.config['weight_thresh']
mask = f.read_mask(thresh=self.config["mask_threshold"])

#identify unmasked pixels
pix_keep = mask > 0.
pix = np.where(pix_keep)[0]

# Read the count maps
Expand Down
Loading

0 comments on commit d4490e3

Please sign in to comment.