-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnz_wfirst.py
More file actions
34 lines (32 loc) · 1.8 KB
/
nz_wfirst.py
File metadata and controls
34 lines (32 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""implement NZMatcher by matching the number density
in the CANDELS GOODS-S catalogue with a preapplied cut"""
from __future__ import division,print_function,absolute_import
from builtins import range
import numpy as np
from nz_matcher import NZMatcher,get_gaussian_smoothed_dN_dz
class NZWFirst(NZMatcher):
"""Match n(z) using the CANDELS dataset with pre applied cut"""
def __init__(self,params):
"""get the CANDELS matcher
inputs:
params: a dict of params including:
smooth_sigma: a smoothing length scale
n_right_extend: number of smoothing scales beyond max z
z_resolution: resolution of z grid to use
mirror_boundary: True to use mirrored boundary conditions at z=0 for smoothing
area_sterad: area of survey in steradians
"""
self.params = params
#load data and select nz
self.data = np.loadtxt(self.params['data_source'])
#strip the redshifts which are exactly 0, as they are redshift failures
self.data = self.data[self.data[:,1]>self.params['z_cut'],:]
#use separate internal grid for calculations because smoothing means galaxies beyond max z_fine can create edge effects
z_grid = np.arange(0.,np.max(self.data[:,1])+self.params['smooth_sigma']*self.params['n_right_extend'],self.params['z_resolution'])
#self.chosen = (self.data[:,5]<self.params['i_cut'])
self.chosen = np.full(self.data[:,0].size,True,dtype=bool)
#cut off faint galaxies
self.zs_chosen = self.data[self.chosen,1]
print("nz_wfirst: "+str(self.zs_chosen.size)+" available galaxies")
dN_dz = get_gaussian_smoothed_dN_dz(z_grid,self.zs_chosen,params,normalize=True)
NZMatcher.__init__(self,z_grid,dN_dz)