Skip to content

Commit 04a3e2c

Browse files
committed
Add documentation on new mask types, and fix executables.
1 parent 0e1960f commit 04a3e2c

4 files changed

+36
-36
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The following modules are required:
4444
* healpy
4545
* scipy
4646
* future
47+
* [healsparse](https://github.com/lsstdesc/healsparse)
4748

4849
How-To
4950
------

bin/redmapper_convert_depthfile_to_healsparse.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
parser.add_argument('-m', '--depthfile', action='store', type=str, required=True,
1515
help='Input depth file (old format)')
16-
parser.add_argument('-h', '--healsparsefile', action='store', type=str, required=True,
16+
parser.add_argument('-f', '--healsparsefile', action='store', type=str, required=True,
1717
help='Output mask healsparse file (new format)')
1818
parser.add_argument('-n', '--nsideCoverage', action='store', type=int, default=32,
1919
help='Coverage nside for healsparse file')

bin/redmapper_convert_mask_to_healsparse.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
parser.add_argument('-m', '--maskfile', action='store', type=str, required=True,
1515
help='Input mask file (old format)')
16-
parser.add_argument('-h', '--healsparsefile', action='store', type=str, required=True,
16+
parser.add_argument('-f', '--healsparsefile', action='store', type=str, required=True,
1717
help='Output mask healsparse file (new format)')
1818
parser.add_argument('-n', '--nsideCoverage', action='store', type=int, default=32,
1919
help='Coverage nside for healsparse file')

how-to/README.md

+33-34
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ maker = redmapper.GalaxyCatalogMaker(filename_base, info_dict)
8080

8181
for input_file in input_files:
8282
# insert code to translate to file format
83+
8384
maker.append_galaxies(galaxies)
8485

8586
maker.finalize_catalog()
@@ -118,36 +119,28 @@ spec_dtype = [('ra', 'f8'), # right ascension (degrees)
118119
### Survey Geometry Mask (Strongly Recommended)
119120

120121
Although redMaPPer does not require a survey geometry mask in order to run, it
121-
is strongly recommended when running on real data. For certain types of sim
122+
is strongly recommended when running on real data. For certain types of simulated
122123
data that cover a large contiguous area with limited boundaries and no
123124
star-holes or bad fields, you can definitely get away without a survey geometry
124125
mask!
125126

126127
The only type of mask currently supported in the `redmapper` package is a
127-
healpix geometry mask, although if a different type of mask has reasonably
128-
efficient ways of doing a position lookup, then this can be easily added to the
129-
code.
130-
131-
The `redmapper` survey mask is not described as a standard `healpy` healpix
132-
file because it has a couple of other advantages for memory efficiency. You
133-
also have the ability to specify `FRACGOOD`, the fractional good coverage of
134-
each pixel, if this is known, to approximate a higher resolution mask. If it
135-
is not known, simply set this to 1.0 for each pixel.
136-
137-
The header of the file and the datatype should be:
138-
139-
```python
140-
141-
import fitsio
142-
143-
hdr = fitsio.FITSHDR()
144-
hdr['NSIDE'] = healpix_nside
145-
hdr['NEST'] = 0 # 0 for RING, or 1 for NEST
146-
hdr['AREA'] = total_coverage_area
147-
148-
mask_dtype = [('HPIX', 'i8'), # healpix number (nest or ring as in header)
149-
('FRACGOOD', 'f4')] # fraction of pixel with good coverage
150-
```
128+
healpix geometry mask as described by the
129+
[`healsparse`](https://github.com/lsstdesc/healsparse) format. Other types of
130+
mask could have supported added provided they have reasonably efficient ways of doing a
131+
position lookup.
132+
133+
The `healsparse` format is much more memory efficient and faster to read than a
134+
standard `healpy` healpix file or the older `redmapper` format. The format of
135+
the mask is a standard `healsparse` map with a float value for `fracgood` (the
136+
fractional "good" coverage) in each pixel. Using `fracgood` allows you to
137+
approximate a higher resolution mask via sub-sampling. If you do not have
138+
`fracgood`, then you should set each pixel that is in the mask to 1.0, and each
139+
pixel that is outside the mask to `healpy.UNSEEN` (the default value).
140+
141+
If you have an old-style `redmapper` mask, this can be converted to the
142+
`healsparse` format with the executable
143+
`redmapper_convert_mask_to_healsparse.py`.
151144

152145
### Survey Depth Maps (Recommended)
153146

@@ -160,29 +153,35 @@ depth map is not specified, the code will do its best to approximate it with a
160153
fit to the galaxies (see Appendix B of [Rozo et
161154
al. (2015)](http://adsabs.harvard.edu/abs/2015MNRAS.453...38R)).
162155

163-
The depth map has the format described below, with values consistent with the
164-
model in Section 3 of [Rykoff et
156+
The depth map should be in
157+
[`healsparse`](https://github.com/lsstdesc/healsparse) format. Other types of
158+
mask could have supported added provided they have reasonably efficient ways of doing a
159+
position lookup (as with the survey geometry masks).
160+
161+
The depth map `healsparse` file has the format described below, with values
162+
consistent with the model in Section 3 of [Rykoff et
165163
al. (2015)](http://adsabs.harvard.edu/abs/2015arXiv150900870R).
166164

167165
```python
168166
import fitsio
169167

170168
hdr = fitsio.FITSHDR()
171-
hdr['NSIDE'] = healpix_nside
172-
hdr['NEST'] = 0 # 0 for RING, or 1 for NEST
173169
hdr['ZP'] = reference_zeropoint
174170
hdr['NSIG'] = signal_to_noise_at_limmag
175171
hdr['NBAND'] = 1 # not used
176172
hdr['W'] = 0.0 # not used
177173
hdr['EFF'] = 1.0 # not used
178174

179-
depth_dtype = [('HPIX', 'i8'), # healpix number (nest or ring as in header)
180-
('EXPTIME', 'f4'), # effective exposure time
181-
('LIMMAG', 'f4'), # limited magnitude at nsig (in header)
182-
('M50', 'f4'), # Should be same as LIMMAG (for now)
183-
('FRACGOOD', 'f4')] # fraction of good coverage (see mask above)
175+
depth_dtype = [('exptime', 'f4'), # effective exposure time
176+
('limmag', 'f4'), # limited magnitude at nsig (in header)
177+
('m50', 'f4'), # Should be same as LIMMAG (for now)
178+
('fracgood', 'f4')] # fraction of good coverage (see mask above)
184179
```
185180

181+
If you have an old-style `redmapper` depth file, this can be converted to the
182+
`healsparse` format with the executable
183+
`redmapper_convert_depthfile_to_healsparse.py`.
184+
186185
### m\* as a Function of Redshift
187186

188187
As described in Section 3.2 of [Rykoff et

0 commit comments

Comments
 (0)