|
Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://xmm.vilspa.esa.es/sas/6.5.0/doc/eident/node8.html
Дата изменения: Tue Aug 16 03:26:38 2005 Дата индексирования: Sat Dec 22 07:59:12 2007 Кодировка: Поисковые слова: http astrokuban.info astrokuban |
subroutine eident
call parameter and i/o routines
if( findoffsets == .TRUE. ) then
call find_offset( pn_list ,.., mos1_list, ..)
call find_offset( pn_list ,.., mos2_list, ..)
end if
call compare_src( pn_list ,.., mos1_list, .., nm1)
call compare_src( pn_list ,.., mos2_list, .., nm2)
call compare_src( mos1_list ,..,mos2_list, ..,nm3)
! the following lines select only those mos1/mos2 pair sources
! that are not found in the pn list (unlikely but nevertheless!)
nm3b = 0
do i=1,nmos1
j = mos1_list(i)%cross_ref(2)
if( j /= 0 ) then
if( mos1_list(i)%cross_ref(1) == 0) then
nm3b = nm3b + 1
else
mos1_list(i)%cross_ref(2) = 0 ! only except a mos1 mos2 link
mos2_list(j)%cross_ref(2) = 0 ! when they are not linked to pn
end if
end if
end do
! determine the true number of sources:
! number of total sources - number of (unique) pairs
nsrcs = npn + nmos1 + nmos2 - nm1 - nm2 - nm3b
call write_set( pn_list, mos1_list, mos2_list)
end subroutine eident
subroutine find_offset( list1,.., list2,.., xoffset, yoffset )
LOOP over xoffsets
LOOP over yoffsets
does this xoffset, yoffset maximize the statistic (likelihood)?
END LOOP
END LOOP
determine center of mass xoffset, yoffset around the
previously found best fitting xoffset / yoffset
end subroutine find_offset
subroutine likelihood(list1,.., list2,..)
likelihood = 0
LOOP over list2 srcs
correct here for offset
LOOP over list1 srcs
dr2 = distance( list1 src, list1 src
likelihood = likelihood + exp( -0.5 * dr2)
END LOOP
END LOOP
end subroutine likelihood
subroutine compare_srcs( list1, n1, list2, n2, xoffset, yoffset, rotangle,
nmatches)
LOOP over elements list1
list1(i)%dist(ref1)= 2.0* maxerror ! initialize
LOOP over elements list2
newx = offset corrected x of list2
newy = offset corrected y of list2
xerr= sqrt( list1(i)%x_err**2 + list2(j)%x_err**2)
yerr= sqrt( list1(i)%y_err**2 + list2(j)%y_err**2)
if ( xerr /= 0.0 .AND. yerr /= 0.0) then
dx = (list1(i)%x - newx )/xerr
dy = (list1(i)%y - newy )/yerr
dist1 = sqrt(dx*dx + dy*dy )
if( dist1 < maxerror .AND. list1(i)%dist(ref1) > dist1 ) then
! check if another src was already associated with source "j"
k = list2(j)%cross_ref(ref2)
if( k /= 0 ) then
! check if this source is closer than source "j"
dist2 = list2(j)%dist(ref2)
if( dist1 < dist2 ) then ! new pair is better
l = list1(i)%cross_ref(ref1)
if( l /= 0 ) then
list2(l)%cross_ref(ref2) = 0
end if
list1(i)%cross_ref(ref1) = j
list2(j)%cross_ref(ref2) = i
list1(i)%dist(ref1) = dist1
list2(j)%dist(ref2) = dist1
list1(k)%cross_ref(ref1) = 0
end if
else
l = list1(i)%cross_ref(ref1)
if( l /= 0 ) then
list2(l)%cross_ref(ref2) = 0
end if
list1(i)%cross_ref(ref1) = j
list2(j)%cross_ref(ref2) = i
list1(i)%dist(ref1) = dist1
list2(j)%dist(ref2) = dist1
end if
end if
end if
end do
end do
nmatches = 0
do i=1,n1
if( list1(i)%cross_ref(ref1) /= 0 ) nmatches = nmatches + 1
end do
end subroutine compare_srcs
! to be found in eident_io.f90 :
subroutine write_set(filename,list1, n1, list2, n2, list3, n3)
Loop over list1 elements
copy record to output arrays
if( ref1 = list1(element)%cross_ref(1) /= 0 ) then
copy list2(ref1) record to output array
if( ref2 = list1(element)cross_ref(2) /= 0 ) then
copy list3(ref1) record to output array
End Loop
Loop over list2 elements
if( list2(element)%cross_ref(1) == 0 ) then ! not already copied
copy record to output arrays
if( ref2 = list1(element)cross_ref(2) /= 0 ) then
copy list3(ref1) record to output array
End Loop
Loop over list3 elements
if( list3(element)%cross_ref(1) == 0 AND
list3(element)%cross_ref(2) == 0 ) then ! not already copied
copy record to output arrays
end if
End Loop
end subroutine write_set