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