| 1 | 
greg | 
1.1 | 
{ SCCSid "$SunId$ LBL" } | 
| 2 | 
  | 
  | 
 | 
| 3 | 
  | 
  | 
{ | 
| 4 | 
  | 
  | 
        Source distribution coordinates (degrees). | 
| 5 | 
  | 
  | 
 | 
| 6 | 
  | 
  | 
        Theta is measured from the negative z-axis, | 
| 7 | 
  | 
  | 
        phi is measured from the positive x-axis | 
| 8 | 
  | 
  | 
        according to the right-hand rule. | 
| 9 | 
  | 
  | 
 | 
| 10 | 
  | 
  | 
        srcB_vert and srcB_horiz are angles | 
| 11 | 
  | 
  | 
        used in type B photometry. | 
| 12 | 
  | 
  | 
 | 
| 13 | 
greg | 
2.2 | 
        boxcorr function corrects for distribution modeled | 
| 14 | 
  | 
  | 
        with a rectangular box.  lboxcorr provides a more | 
| 15 | 
  | 
  | 
        accurate calculation for nearby surfaces, but requires | 
| 16 | 
  | 
  | 
        that the source box be centered at the origin. | 
| 17 | 
  | 
  | 
 | 
| 18 | 
greg | 
1.2 | 
        A1              - optional multipier | 
| 19 | 
  | 
  | 
        A2,A3,A4        - X,Y,Z dimensions of axis-aligned box | 
| 20 | 
greg | 
1.1 | 
} | 
| 21 | 
greg | 
1.2 | 
                                        { local definitions } | 
| 22 | 
  | 
  | 
norm_deg(d) : if( d, d, d+360 ); | 
| 23 | 
  | 
  | 
boxprojection = abs(Dx)*A3*A4 + abs(Dy)*A2*A4 + abs(Dz)*A2*A3; | 
| 24 | 
greg | 
2.2 | 
lboxprojection = (      noneg(abs(Px-Dx*Ts)-A2/2)*A3*A4 + | 
| 25 | 
  | 
  | 
                        noneg(abs(Py-Dy*Ts)-A3/2)*A2*A4 + | 
| 26 | 
  | 
  | 
                        noneg(abs(Pz-Dz*Ts)-A4/2)*A2*A3 ) / Ts; | 
| 27 | 
greg | 
1.1 | 
 | 
| 28 | 
  | 
  | 
flatcorr(v) = corr(v) / Rdot;           { correction for flat sources } | 
| 29 | 
  | 
  | 
corr(v) = if(AC-.5, A1*v, v);           { multiplier correction } | 
| 30 | 
greg | 
1.2 | 
boxcorr(v) = A1 * v / boxprojection;    { correction for emitting box } | 
| 31 | 
greg | 
2.2 | 
lboxcorr(v) = A1 * v / lboxprojection;  { local box correction } | 
| 32 | 
greg | 
1.1 | 
 | 
| 33 | 
  | 
  | 
src_theta = Acos(Dz) / DEGREE;                  { 0-180 } | 
| 34 | 
  | 
  | 
src_phi = norm_deg( atan2(Dy, Dx) / DEGREE );   { 0-360 } | 
| 35 | 
  | 
  | 
                                { bilateral symmetry } | 
| 36 | 
  | 
  | 
src_phi2 = tri( src_phi, 180 );         { 0-180 } | 
| 37 | 
  | 
  | 
                                { quadrilateral symmetry } | 
| 38 | 
  | 
  | 
src_phi4 = tri( src_phi, 90 );          { 0-90 } | 
| 39 | 
  | 
  | 
 | 
| 40 | 
  | 
  | 
                                { Type B photometry coordinates } | 
| 41 | 
  | 
  | 
srcB_vert = atan( -Dx/Dz ) / DEGREE; | 
| 42 | 
  | 
  | 
srcB_horiz = Asin(Dy) / DEGREE; | 
| 43 | 
  | 
  | 
                                { w/ bilateral symmetry } | 
| 44 | 
  | 
  | 
srcB_horiz2 = abs( srcB_horiz ); |