Code: Select all

```
pars=camb.CAMBparams()
pars.set_cosmology(H0=67.5, ombh2=0.022, omch2=0.122, mnu=0.06, omk=0, tau=0.06)
pars.InitPower.set_params(As=2e-9, ns=0.965, r=0)
pars.set_for_lmax(700, lens_potential_accuracy=0)
pars.Want_CMB = False
pars.SourceTerms.counts_density = True
pars.SourceTerms.counts_redshift = True
pars.SourceTerms.counts_lensing = False
pars.SourceTerms.counts_velocity = False
pars.SourceTerms.counts_radial = False
pars.SourceTerms.counts_timedelay = False
pars.SourceTerms.counts_ISW = False
pars.SourceTerms.counts_potential = False
z1=redshifts[0]
z2=redshifts[1]
rs=np.arange(0, 3, 0.0001)
WW1=top_hat(rs, z1-sep,z1+sep)
WW2=top_hat(rs, z2-sep,z2+sep)
pars.SourceWindows = [SplinedSourceWindow(bias=1.5, z=rs, W=WW1),
SplinedSourceWindow(bias=1.5, z=rs, W=WW2)]
results=camb.get_results(pars)
```

The tophat function:

Code: Select all

```
def top_hat(x, a, b):
"""
Top-hat function that is 1 between a and b (inclusive) and 0 elsewhere.
Parameters:
- x: Input array or scalar value.
- a: Start of the interval where the function is 1.
- b: End of the interval where the function is 1.
Returns:
- Array or scalar value with 1 inside the interval [a, b] and 0 outside.
"""
return np.where((x >= a) & (x <= b), 1, 0)
```