APSF //- An implementation of the model described by Tim Napier-Munn in JDSO V4 No.4 pg 156 //- for generating the probability of splitting a double star pair. //- //- The script generates the probability (as a percentage) and puts the result in //- one of the user-defined fields. //- //- Paul Rodman, October 2008 //- //- V1.0 3 Oct 2008 //- Initial release //===================================================================================== function Probability(m1 as double, m2 as double, sep as double, aperture as double, seeing as integer) as double dim x as double x = 1.6225 - 1.2026*abs(m2-m1)/sep - 0.5765*max(m1,m2)/sep + 1.9348*seeing*1E-5*aperture*aperture return exp(x)/(1.0+exp(x))*100.0 end function //===================================================================================== dim what,i,ufield,scope,seeing as integer dim ss(-1) as string, ok as boolean, aperture as double dim scopes(-1) as TelescopeResource // Retrieve saved parameters what=RestoreIntegerValue("what",0) ufield=RestoreIntegerValue("ufield",1) scope=RestoreIntegerValue("scope",0) seeing=RestoreIntegerValue("seeing",1) // Use dialog to select objects to consider, telescope and seeing if SelectedObject<1 then i=0 else i=1 SetChoiceParameter("Objects to consider",what,"All objects ("+str(nObjects)+")", _ "Highlighted objects only ("+str(nHighlighted)+")", "Selected object only ("+str(i)+")") for i=1 to 4 ss.Append "User Field "+str(i) next SetPopupParameter("Put result in",ufield-1,ss) scopes=Telescopes SetPopupParameter("Telescope",scope,scopes) redim ss(4) ss(0)="I - Very unstable" ss(1)="II - Unstable" ss(2)="III - Somewhat stable" ss(3)="IV - Mostly stable" ss(4)="V - Perfectly stable" SetPopupParameter("Seeing (Danjon)",seeing-1,ss) if not EditParameters("AAQ Probability") then return what=GetChoiceParameter("Objects to consider") ufield=GetPopupParameter("Put result in")+1 scope=GetPopupParameter("Telescope") seeing=GetPopupParameter("Seeing (Danjon)")+1 // Save parameters for next run SaveIntegerValue("what",what) SaveIntegerValue("ufield",ufield) SaveIntegerValue("scope",scope) SaveIntegerValue("seeing",seeing) aperture=scopes(scope).Aperture for i=1 to nObjects select case what case 0 ok=true case 1 ok=Obj(i).IsHighlighted case 2 ok=(i=SelectedObject) end select if Obj(i).Magnitude<30.0 and Obj(i).Magnitude2<30.0 and Obj(i).Separation>0.0 then Obj(i).User(ufield)=format(Probability(Obj(i).Magnitude,Obj(i).Magnitude2,Obj(i).Separation, _ aperture,seeing),"-0.0") else Obj(i).User(ufield)="" end if next UserHeading(ufield)="Probability"