00001 /* 00002 * Local function for correction of MDI image distortion; these are copied 00003 * directly from the function in ~CM/src/libMDI.d/mdi_corrections.c 00004 * Only the names of the functions and defineds have been changed to 00005 * avoid possible conflicts. 00006 * 00007 */ 00008 /* 00009 * Assumed error in SOHO position angle w.r.t solar north (deg.) 00010 */ 00011 #include "math.h" 00012 00013 #define MDI_IMG_SOHO_PA (-0.2) 00014 00015 void mtrack_MDI_correct_pa (double *pa) { 00016 *pa += MDI_IMG_SOHO_PA * M_PI / 180.0; 00017 } 00018 00019 /* 00020 * Correct for error in measured center coordinates due to plate tipping; 00021 * the constants are as defined above 00022 */ 00023 00024 #define MDI_IMG_ACPA (1.01e-3) 00025 #define MDI_IMG_ASPA (-1.49e-3) 00026 00027 void mtrack_MDI_correct_imgctr (double *xc, double *yc, double rsun) { 00028 double rs2; 00029 00030 rs2 = rsun * rsun / 512.0; 00031 *xc -= MDI_IMG_ASPA * rs2; 00032 *yc -= MDI_IMG_ACPA * rs2; 00033 } 00034 00035 /* 00036 * mtrack_MDI_image_stretch 00037 * 00038 * Modify "plate" coordinates to account for known optical distortions 00039 * in the MDI instrument 00040 * It is assumed that the coordinates *x and *y are in terms of half the 00041 * full plate width, i.e. that they are in the range [-1.0, 1.0] and 00042 * relative to its center; this of course requires an external correction 00043 * to be applied in the cases of extracted rasters and binned data. 00044 * For MDI the half-plate-width is 512 * 21 um. The 2nd-order radial 00045 * correction constant is given in Kuhn et al. (Ap.J. 613, 1241; 2004) 00046 * as 1.58e-3 where the radial unit is in cm. The constant used here is thus 00047 * 1.58e-3 * (.0021 * 512)^2 00048 * 00049 * By ignoring the 4th-order term the function can be used for inverse 00050 * as well as direct stretching. 00051 * 00052 * The value of the integer direct specifies the direction of the 00053 * transformation: +1 for a correction from "perfect" to plate coordinates, 00054 * -1 for transformation from plate to perfect 00055 * 00056 * Bugs: 00057 * There is no check that |direct| = 1; it can actually be changed as a 00058 * scale factor (useful for testing) 00059 * 00060 */ 00061 00062 #define MDI_IMG_STRETCH (1.83e-3) 00063 00064 void mtrack_MDI_image_stretch (double *x, double *y, int n, int direct) { 00065 double f, r2, s; 00066 00067 s = direct * MDI_IMG_STRETCH; 00068 while (n--) { 00069 r2 = *x * *x + *y * *y; 00070 f = 1.0 + s * r2; 00071 *x++ *= f; 00072 *y++ *= f; 00073 } 00074 } 00075 00076 /* 00077 * mtrack_MDI_image_tip 00078 * 00079 * Correct for ellipticity of image due to plate tipping 00080 * The constants are: 00081 * TIP = 2.61 deg = 0.04555 00082 * EFL = 25.3 (effective focal length in units of plate half-width) 00083 * PA = -56 deg 00084 * SPA = sin (PA), CPA = cos (PA) 00085 * AEP = TIP / EFL 00086 * BEP = TIP^2 / 4 = 5.187e-4 00087 * BCPA = BEP * CPA, BSPA = BEP * SPA 00088 * 00089 * Bugs: 00090 * There is no check that |direct| = 1; it can actually be changed as a 00091 * scale factor (useful for testing) 00092 * 00093 */ 00094 00095 #define MDI_IMG_SPA (-0.8290) 00096 #define MDI_IMG_CPA (0.5592) 00097 #define MDI_IMG_AEP (1.80e-3) 00098 #define MDI_IMG_BCPA (2.90e-4) 00099 #define MDI_IMG_BSPA (-4.30e-4) 00100 00101 void mtrack_MDI_image_tip (double *x, double *y, int n, int direct) { 00102 double x0, y0, s, t; 00103 00104 while (n--) { 00105 x0 = *x; 00106 y0 = *y; 00107 t = direct * (MDI_IMG_SPA * x0 + MDI_IMG_CPA * y0); 00108 s = direct * (MDI_IMG_CPA * x0 - MDI_IMG_SPA * y0); 00109 *x += MDI_IMG_BSPA * t; 00110 *y += MDI_IMG_BCPA * t; 00111 *x -= MDI_IMG_BCPA * s; 00112 *y += MDI_IMG_BSPA * s; 00113 t *= MDI_IMG_AEP; 00114 *x++ += t * x0; 00115 *y++ += t * y0; 00116 } 00117 } 00118