-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstarprobabilityZ.f
72 lines (49 loc) · 1.81 KB
/
starprobabilityZ.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
subroutine starprobabilityz(LK)
implicit none
include 'parmsZ.inc'
integer i,j, nzero
real*8 chiU,chiBV,chiVV,chiVI,chiVR,sigma,chi,prod
real*8 DM,LK,EBV,EVI,EVR,PL,P(nobs)
c *** local values of DM and E(B-V)
DM = parms(3)
EBV = parms(4)
c *** initialise probability
PL = 0.d0
nzero = 0
prod = 1.d0
EVI = 1.30d0*EBV !Reddening in V-I
EVR = 0.60d0*EBV !Reddening in V-R
! open(14,file='../output/starprob.check')
do i=1, nobs
chiVV = (ObsVV(i) - (TheoVV(1) +DM) )
chiBV = (ObsBV(i) - (TheoBB(1)-TheoVV(1)+EBV) )
chiVI = (ObsVI(i) - (TheoVV(1)-TheoII(1)+EVI) )
chiVR = (ObsVR(i) - (TheoVV(1)-TheoRR(1)+EVR) )
sigma = errVV(i)**2 + errBV(i)**2 !+ errVI(i)**2 + errVR(i)**2
chi = dsqrt( chiVV**2 + chiBV**2 )/dsqrt(sigma)
do j=2, 398
chiVV = (ObsVV(i) - (TheoVV(j) +DM) )
chiBV = (ObsBV(i) - (TheoBB(j)-TheoVV(j)+EBV) )
chiVI = (ObsVI(i) - (TheoVV(j)-TheoII(j)+EVI) )
chiVR = (ObsVR(i) - (TheoVV(1)-TheoRR(1)+EVR) )
sigma = errVV(i)**2 + errBV(i)**2 !+ errVI(i)**2 + errVR(i)**2
chi = min(chi,dsqrt( chiVV**2 + chiBV**2 )/dsqrt(sigma))
! prod = prod * derf(chi)
! write(14,*) chiVV, chiBV, chiVI, chi
enddo
c *** probability of star i
P(i) = 1.d0 - derf(chi)
if(derf(chi) .lt. 1.d0) then
PL = PL + dlog(P(i))
else
nzero = nzero + 1
endif
enddo
c probability (including tempering factor beta)
LK = dexp(beta * PL)
c write(*,*) LK
if(nzero .gt. 0) write(*,*) nzero,'stelle non contate'
! close(14)
c stop
return
end