import pandas as pd
import numpy as np

#fit given by Andres    
#CENTRALS
def f_cen(logmhalo,logmmin,siglogm,fmaxcen,fmincen,k,logmdrop):
    ncen  = 0.5*( 1. + ss.erf((logmhalo[0,:] - logmmin)/siglogm) )
    ncen  = fmaxcen * ncen
    ncen  = ncen * (1.0 - (1.0-fmincen/fmaxcen)/(1.0 + 10**((2.0/k)*(logmhalo[0,:]-logmdrop)))) 
    return log10(ncen)
#SATELLITES
def f_sat(logmhalo,logmmin,siglogm,logm1,alpha): 
    nsat  = 0.5*( 1. + ss.erf((logmhalo[0,:] - logmmin)/siglogm) )
    #nsat  = 0.5*( 1. + ss.erf((logmhalo[0,:] - param_cen[0])/param_cen[1]) )
    nsat  = param_cen[2] * nsat  
    nsat  = nsat * (10**logmhalo[0,:]/10**logm1)**alpha
    return log10(nsat)

"""
Explanation: Temporary notebook to get the parameters for the MICE sims for the data ismael sent me.
End of explanation
"""


mean_gal_per_bin = pd.read_csv('hod_redmagicMICE.csv', sep=' ')

mean_gal_per_bin

"""
Explanation: mean number of central/satellites per bin. read with pd.read_csv(‘hod_redmagicMICE.csv’, sep=' ’). First columm is the bins in Mhalo, and then columm are n_cen/n_sat + redshift bin + catalog. Where catalog are hd=high density , hl=high luminosity, rl=higher luminosity.
End of explanation
"""


hod_fit = pd.read_csv('hod_redmagicMICE_fit.csv', sep=' ')

hod_fit

"""
Explanation: parameters for function i sent before. read with pd.read_csv(‘hod_redmagicMICE_fit.csv’, sep=' ’).
End of explanation
"""


