<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Fix Amplitude of Angular CF
There was a bug reported that AngularCF is returning really large values for the tracer correlation function, specifically for v1.6.0 of halomod. This notebook tries to find out why, and fix it.
Step1:  The problem illustrated
We will try to roughly reproduce the results of Blake+2008
Step2:  Note that this is pretty much 1000x times what Blake+ got, but does have a similar shape.
Let's go a bit deeper and look at the exact parameters used in Blake+
Step3:  OK, this is awful. Let's try specify the HOD more accurately
Step4:  This is much closer. Now let's try the ACF
Step5:  It's even worse than before!
Let's plot the standard correlation function
Step6:  This is of a similar magnitude to that found in Blake. 
Try using low-level angular_corr_gal
<ASSISTANT_TASK:>
Python Code:
from halomod import AngularCF
import halomod
halomod.__version__
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
Explanation: Fix Amplitude of Angular CF
There was a bug reported that AngularCF is returning really large values for the tracer correlation function, specifically for v1.6.0 of halomod. This notebook tries to find out why, and fix it.
End of explanation
acf = AngularCF(z=0.475, zmin=0.45, zmax=0.5)
plt.plot(acf.theta * 180/np.pi, acf.angular_corr_gal)
plt.xscale('log')
plt.yscale('log')
plt.xlabel(r"$\theta$ / deg")
plt.ylabel('Angular CF')
Explanation: The problem illustrated
We will try to roughly reproduce the results of Blake+2008:
<img src="blake-angular-cf.png">
End of explanation
acf.mean_tracer_den * 1e4
Explanation: Note that this is pretty much 1000x times what Blake+ got, but does have a similar shape.
Let's go a bit deeper and look at the exact parameters used in Blake+:
<img src="blake-parameters.png">
End of explanation
acf.hod_model = 'Zheng05'
acf.hod_params = {'M_min': 12.98, 'M_0':-10, 'M_1':14.09, 'sig_logm':0.21, 'alpha':1.57}
acf.mean_tracer_den * 1e4, acf.bias_effective_tracer, acf.mass_effective
Explanation: OK, this is awful. Let's try specify the HOD more accurately:
End of explanation
plt.plot(acf.theta * 180/np.pi, acf.angular_corr_gal)
plt.xscale('log')
plt.yscale('log')
plt.xlabel(r"$\theta$ / deg")
plt.ylabel('Angular CF')
Explanation: This is much closer. Now let's try the ACF:
End of explanation
r = np.logspace(-3, 2.1, 500)
plt.plot(r, acf.corr_auto_tracer_fnc(r))
plt.xscale('log')
plt.yscale('log')
Explanation: It's even worse than before!
Let's plot the standard correlation function:
End of explanation
from halomod.integrate_corr import angular_corr_gal
angular_corr_gal(
    theta=np.array([1e-3]), 
    xi = acf.corr_auto_tracer_fnc, 
    p1=lambda x : 0.7*np.ones_like(x)/(Planck15.comoving_distance(0.5).value - Planck15.comoving_distance(0.45).value),
    p_of_z=False,
    zmin=0.45, 
    zmax=0.5, 
    logu_min=-6, 
    logu_max=2.1,
    unum=1000,
    znum=500
)
from astropy.cosmology import Planck15
Planck15.comoving_distance(0.45)
Planck15.comoving_distance(0.5)
np.linspace(0,1,2)
Explanation: This is of a similar magnitude to that found in Blake. 
Try using low-level angular_corr_gal
End of explanation
<END_TASK>