return result def sersic_half_scale_ratio(n): #half light radius is radius that contains 0.5 of the total light #scale radius is the radias when the profile intensity drops by 1/e. In this function, r_scale =1.0 r = np.linspace(0, 10, 1000) tot_light = sersic_inter(r, n) r_half = r[np.searchsorted(tot_light, 0.5)] return r_half # = r_half/r_scale = r_half/1.0 redshift = np.linspace(0, 2, 1000) #mpc_arcsec = interp1d(redshift,cosmo.kpc_proper_per_arcmin(redshift)/1000.0/60) arcsec_per_mpc = interp1d(redshift, cosmo.arcsec_per_kpc_proper(redshift).value * 1000.0) sersic_half_scale_ratio_10 = sersic_half_scale_ratio(1.0) sersic_half_scale_ratio_15 = sersic_half_scale_ratio(1.5) sersic_half_scale_ratio_35 = sersic_half_scale_ratio(3.5) hernquist_half_scale_ratio = 1.8153 size = hfile['redshift'].size # slct_blue = hfile['magnitude:SDSS_u:observed'].values-hfile['magnitude:SDSS_g:observed'].values<1.36 # slct_red = slct_blue==0 # size = slct_blue.size # data = np.ndarray(slct_blue.size,dtype=float) # data[slct_blue]=hfile['spheriodRadius'].values*sersic_half_scale_ratio_15 # data[slct_red] =hfile['spheriodRadius'].values*sersic_half_scale_ratio_35
result = cumtrapz(sersic_r(r,n),x=r,initial=0.0) result = result/result[-1] return result def sersic_half_scale_ratio(n): #half light radius is radius that contains 0.5 of the total light #scale radius is the radias when the profile intensity drops by 1/e. In this function, r_scale =1.0 r = np.linspace(0,10,1000) tot_light = sersic_inter(r,n) r_half = r[np.searchsorted(tot_light,0.5)] return r_half # = r_half/r_scale = r_half/1.0 redshift=np.linspace(0,2,1000) #mpc_arcsec = interp1d(redshift,cosmo.kpc_proper_per_arcmin(redshift)/1000.0/60) arcsec_per_mpc = interp1d(redshift,cosmo.arcsec_per_kpc_proper(redshift).value*1000.0) sersic_half_scale_ratio_10 = sersic_half_scale_ratio(1.0) sersic_half_scale_ratio_15 = sersic_half_scale_ratio(1.5) sersic_half_scale_ratio_35 = sersic_half_scale_ratio(3.5) hernquist_half_scale_ratio = 1.8153 size = hfile['blackHoleMass'].size # slct_blue = hfile['magnitude:SDSS_u:observed'].values-hfile['magnitude:SDSS_g:observed'].values<1.36 # slct_red = slct_blue==0 # size = slct_blue.size # data = np.ndarray(slct_blue.size,dtype=float) # data[slct_blue]=hfile['spheriodRadius'].values*sersic_half_scale_ratio_15 # data[slct_red] =hfile['spheriodRadius'].values*sersic_half_scale_ratio_35