示例#1
0
def predictDiskMass(modelfunc,params,sf,cdist,fehdist,fehmin,fehmax,feh,
                    data,grmin,grmax,agemin,agemax,normalize='Z',
                    imfmodel='lognormalChabrier2001',
                    justnumber=False):
    n= compareDataModel.comparernumberPlate(modelfunc,params,sf,
                                            cdist,fehdist,data,
                                            'all',
                                            fehmin=fehmin,
                                            fehmax=fehmax,
                                            feh=feh,
                                            noplot=True,
                                            nodata=True)
    if not normalize.lower() == 'z':
        #Normalization of model
        norm= integrate.dblquad(lambda r,f: r**2*numpy.sin(f)*modelfunc(r*numpy.sin(f),
                                                           r*numpy.cos(f),
                                                           params),
                                0.,numpy.pi,lambda x:0., lambda x: 200.)[0]\
                                *2.*numpy.pi
    else:
        norm= 1.
    pred= numpy.sum(n)*7.*(numpy.pi/180.)**2.*(20.2-14.5)/1000#\
#          *0.2*numpy.log(10.) #these are some factors left out of compareDataModel
    if justnumber:
        return len(data)*norm/pred
    #print pred, len(data), 1.-params[2]
    frac= fracMassGRRange(grmin,grmax,agemin,agemax,feh,imfmodel)
    avgmass= averageMassGRRange(grmin,grmax,agemin,agemax,feh)
    return len(data)*norm/pred/frac*avgmass
示例#2
0
def predictBellHalo():
    params= None
    data= read_gdwarfs(ebv=True,sn=True)
    plates= numpy.array(list(set(list(data.plate))),dtype='int') #Only load plates that we use
    sf= segueSelect(plates=plates,sample='G',type_bright='tanhrcut',
                    type_faint='tanhrcut',sn=True)
    cdist= _const_colordist
    fehdist= haloMDF
    n,d,x= compareDataModel.comparernumberPlate(bellfunc,params,sf,cdist,fehdist,data,'all',fehmin=-1.8,fehmax=-0.8,feh=-2.,noplot=True)
    #Normalization of bell
    bell= 10**8./(integrate.dblquad(lambda r,f: numpy.sin(f)*r**2*bellfunc(r*numpy.sin(f),r*numpy.cos(f),None),
                                    0.,numpy.pi,lambda x:1., lambda x: 40.)[0]*2.*numpy.pi)
    return numpy.sum(n)*7.*(numpy.pi/180.)**2.*(20.2-14.5)/1000*bell*0.2*numpy.log(10.) #these are some factors left out of compareDataModel