Sims_maf spatial selection in Galactic coordinates

Hi @ljones and @yoachim - what is currently the best way to spatially select OpSim output by regions in Galactic coordinates within sims_maf? My use-case is that I would like to compute summary metrics for subsets of the OpSim output that are spatially selected as well as by e.g. filter.

Since the field centers (ra, dec) are included in OpSim output, I think the way to do this would involve reading in the field centers and using astropy.coords to transform to Galactics, form a Boolean for the rows that survive the selection by region, and pass those to the summary metric computation… but I’m not entirely clear at what stage the selection takes place when computing summary metrics (i.e. where the user gets to apply the boolean thus defined).

Any help would be much appreciated, I wrote a horrible fudge in a notebook a couple of years ago that basically generates a duplicate set of co-ordinates from the HEALPIX and then requires the row ordering be identical, which I’d really rather not have to use again!



Hi @willclarkson … This is something @yoachim has hacked around a bit to calculate summary metrics for the WFD (see … but that was just selecting the “best” 18,000 sq deg. So you could do something similar, assume that you can have your summary metric know something about what healpix values look like (and that you get the entire healpix array, which happens by setting that self.maskVal to be something other than None … which is not as clear as I’d hoped, but it works) - since you know about the healpix array you could invert that to galactic coordinates in the metric and generate and apply your mask there.

That would work for now, and I am thinking that it would be useful to be able to generate a healpix slicer that knows about a mask itself (i.e. healpixSlicerSubset or something). Then you would only have to generate that mask once and add it to the healpix slicer, and it would only calculate metric values on the non-masked subset. But it doesn’t exist today, so I’d say try the other method for now.