Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion py/qsotools/mocklib.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ class DLASampler():
settled on resampling the input Gaussian field, which reduced the excess
clustering of DLAs.

This can be further tuned with ``sigma_kms`` option, which adds random
velocity separation to DLA redshift obtained from abundance matching. It
adds random ``dz = (1 + z_dla) * Normal(0, sigma_kms) / c`` to DLA redshift

Other methods tested:
- Optical depth mapping on the resampled (0.2 A) skewers. The PDF turns
out non-trivial when smoothed; and you can't control excess clustering.
Expand All @@ -245,13 +249,14 @@ def fn_z_evo(z, zpivot=2.4, gamma_l=1.5):
return ((1 + z) / (1 + zpivot))**gamma_l

def __init__(
self, wide_pix=2**10., nmin=19., nmax=23.,
self, wide_pix=2**10., sigma_kms=0, nmin=19., nmax=23.,
zmin=0, zmax=20., nzbins=5000
):
self.nmin = nmin
self.nmax = nmax

self.wide_pix = None
self.sigma_kms = sigma_kms
self.sigma_scale = None
self.set_var_gauss(wide_pix)

Expand Down Expand Up @@ -406,6 +411,13 @@ def _downsample(x):
num_dlas = w.sum()

z_dlas = refac_z[w]
if self.sigma_kms > 0:
# Store and restore random state for backwards reproducibility
state = RNST.bit_generator.state
z_dlas += (1 + z_dlas) * RNST.normal(
0, self.sigma_kms, size=z_dlas.size) / LIGHT_SPEED
RNST.bit_generator.state = state

Nhi_dlas = self.get_random_NHi(num_dlas, RNST)
id_dlas = np.array([
hash(f"{mockids[jj]:020d}{x:02d}") for x in np.arange(num_dlas)
Expand Down
5 changes: 4 additions & 1 deletion py/qsotools/scripts/generate_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def get_parser():
parser.add_argument(
"--invcdf-nz", default=PKG_ICDF_Z_TABLE,
help="Table for inverse cdf of n(z).")
parser.add_argument(
"--dla-sigma-kms", default=0, type=float,
help="Random shift central DLA redshift.")

parser.add_argument(
"--chunk-dyn", action="store_true",
Expand Down Expand Up @@ -590,7 +593,7 @@ def main():
args.z_forest_min = 0
args.keep_nolya_pixels = True
args.save_full_flux = True
dla_sampler = lm.DLASampler()
dla_sampler = lm.DLASampler(sigma_kms=args.dla_sigma_kms)
else:
dla_sampler = None

Expand Down