-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfith.pro
52 lines (40 loc) · 1.35 KB
/
fith.pro
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
;+
;
; Name: fith
;
; Purpose: function to fit HI elongation tracks using Lugaz formula
;
; Parameters: X
;
; Keywords: -
;
;
; Called by fitall_sse.pro
;
;
; History: May 2010/ update Feb 2011/March 2012
;
; Author: Christian Moestl
; Space Research Institute, Austrian Academy of Sciences
; SSL UC Berkeley
;-
FUNCTION fith, X
common myfit2,xueber2,yueber2, dst2, scnameueber2
degtorad=!dpi/180;
phi=X[0]; % constant angle beta measured FROM OBSERVER, positive = solar west
v=X[1]; % constant speed
t=xueber2-X[2]; difference to launch time t0, which is the result to be written in X[2]
;because of the acos the angle phi has to be positive
if scnameueber2 eq 'A' then phi=-phi;
;Mšstl et al. 2011 ApJ, Equations A6 and A3
a=((2*dst2)/(v*t))-cos(phi)
b=sin(phi)
fit=-acos( (-b+a*sqrt(a^2+b^2-1))/(a^2+b^2) ) /degtorad
sizey=size(yueber2); how many data points are there?
residue=double(0); define the residue variable
for i=0,sizey(1)-1 do begin
if finite(fit(i)) eq 0 then fit(i)=0 ;if NaNs make the residue very high (do this by setting values to zero)
residue=residue+( abs(yueber2(i))-abs(fit(i)) )^2; squared difference between observation and fit for each datapoint
endfor
return, residue
END