z=np.arange(0.05,2.,0.1)
Omega_m = 0.3

shape_z_ana = np.asarray(z_ana.shape, dtype=np.int)
shape_z = np.asarray(z.shape, dtype=np.int)


mu_ana = np.zeros(shape_z_ana, dtype = np.float32, order = 'C')
mu = np.zeros(shape_z, dtype = np.float32, order = 'C')

#Genrating Gaussian random error with SD 0.1 magnitude and 0 mean
error = np.random.normal(0.,0.1,shape_z)

#Generating noisy data
for j in range (shape_z):
    mu[j] = cosmo.dist_modulus(z[j],Omega_m,(1.-Omega_m),h) + error[j]

#generating the fitting function
for j in range (shape_z_ana):
    mu_ana[j] = cosmo.dist_modulus(z_ana[j],Omega_m,(1.-Omega_m),h)
    
#---------------------
#Plotting the analytical models and the data
#-------------------
fig = pl.figure()

host = SubplotHost(fig, 1,1,1)

host.set_xlabel('$z$',fontsize=21)
host.set_ylabel('$\mu$',fontsize=21)
from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost
import const as const
import cosmo_func as cosmo

h=0.7
z=np.arange(0.001,2.,0.01)
Omega_m = np.array([0.2,0.3,0.4,0.5])

shape_Omega = np.asarray(Omega_m.shape, dtype=np.int)
shape_z = np.asarray(z.shape, dtype=np.int)

mu = np.zeros((shape_Omega, shape_z), dtype = np.float32, order = 'C')

for i in range (shape_Omega):
    for j in range (shape_z):
        mu[i,j] = cosmo.dist_modulus(z[j],Omega_m[i],(1.-Omega_m[i]),h)

# Open file
f = open('../problems/SN.txt', 'r')

# Read and ignore header lines
header = f.readline()
print header
# Loop over lines and count the number of useful lines
line_no = np.zeros(1,dtype=np.int)

#data = []
for line in f:
    #line = line.strip()
    #columns = line.split()
    #print columns