MDICAL(1)



NAME

     mdical - level 1 calibration of MDI data


SYNOPSIS

     mdical  [-bfhnrv]
          in= {datacollection}
          out= {datacollection}
          [cal= {directory} (NOT SPECIFIED for default)]
          [tvartbl= {filename} (NOT SPECIFIED for default)]
          [minord= {0 -- 5} (0 by default)]
          [maxord= {-1 -- 5} (1 by default)]
          [bias= (0.0 by default)]
          [gain= (1.0 by default)]
          [xc= (-32768.0 for default)]
          [yc= (-32768.0 for default)]
          [protocol= (RDB.FITS by default)]


DESCRIPTION

     MDI Level 1  calibrations  are  performed  by  the  general-
     purpose  mdical  module.   This  program is designed to deal
     with all MDI Level 0 science data products.   mdical  writes
     SOI conforming datasets of either TS_EQ or TS_BLOCKED types,
     matching the input data sets in organization  and  structure
     unless  otherwise requested (the -r flag will force the out-
     put data files to be  reconstructed  to  their  original  2-
     dimensional  image  format).   In most cases, the calibrated
     data will be written as scaled shorts by default; exceptions
     are   the  Structure  Program  LOI-binned  data,  for  which
     retained precision requires the use of floats.  The -f  flag
     will  force  the  output  data files to be written as floats
     rather than scaled shorts in all cases.

     The calibration consists of  a  correction  to  the  initial
     calibration  done on MDI prior to telemetry.  The correction
     is computed by first offsetting and scaling the raw data  by
     a  constant bias and gain, then applying a polynomial expan-
     sion in the scaled raw data  values,  with  unique  sets  of
     expansion  coefficients  appropriate to each location in the
     image.  These expansion coefficients are  tabulated  in  the
     specified  calibration dataset(s).  Any missing coefficients
     up to the requested maximum order for the expansion  default
     to  0, except for the first-order coefficients which default
     to 1.  At each pixel,

         Calibrated_value = c0 + c1*V + c2*V^2 + c3*V^3 + ...

     where V is the prescaled input value (V =  bias  +  gain  *V
     _in).   Only  terms from minord through maxord in the expan-
     sion are used.  If maxord < minord, the raw data are  simply
     uniformly  scaled  by  the  constant bias and gain using the
     FITS header parameters.

     The calibration tables to  use  are  specified  by  the  cal
     directory   name.   The  directory  is  assumed  to  contain
     1024*1024 (full-image) FITS files tabulating the calibration
     coefficients  of  order  i as functions of plate location in
     files named i.fits.   If  the  calibration  tables  are  not
     specified,  then  default tables and also default values for
     the minimum and maximum polynomial order and the appropriate
     constants  for  prescaling  of  the  raw  data  are inferred
     according to the Data Product Code (DPC) of the raw data.

     The order 0 and order 1 calibration coefficients only may be
     adjusted  by  linear  functions  of  time  specified  in the
     optional table given by the tvartbl argument.  The format of
     this table is expected to be a set of lines of the form

     Start_Time Stop_Time Base_Time f_0_0 f_0_1 f_1_0 f_1_1

     where the values in the calibration table of order i are  to
     be multiplied by the value

          f_i_0 / (1.0 + f_i_1 * (t - Base_Time))

     during the  interval  Start_Time  <  t  <  Base_Time  (t  in
     seconds)  Default  values  of  f_i_0 = 1, f_i_1 = 0 imply no
     adjustment to the order-i able.

     mdical  supplies  a  nominal  observation  time   from   the
     telemetry  reference  time, based on assumptions appropriate
     to the DPC, and numerous values for the  optical  configura-
     tion of the image.  Based on the observation time and avail-
     able information from other sources, the module attempts  to
     provide  pointing,  image  scale, and ephemeris information.
     If the -b flag is set mdical will use a tabular fit for  the
     image scale; otherwise a fixed value is supplied.  Per-image
     data statistics are normally determined,  but  this  may  be
     suppressed with the -h flag.

     With the -n flag  set,  the  tabular  per-pixel  calibration
     described above is suppressed.  Only a linear scaling of the
     raw data by the gain and bias parameters  is  performed  (on
     FITS  output),  and the ancillary data are provided.  The xc
     and yc arguments can be used to manually  set  the  pointing
     information  in  the calibrated data, overriding the results
     returned by calls  to  mdi_pointing()  for  the  observation
     times.


FILES

     /home/soi/CM/tables/calib/dop/{fd,hr}/
     /home/soi/CM/tables/calib/flat/{fd,hr}/
     /home/soi/CM/tables/calib/obflat/
     (/home/soi/CM/tables/calib/mag/)


SEE ALSO

     MDI_DPC_decode(3),                 MDI_image_reconstruct(3),
     mdi_pointing(3),  sds_extract_subset(3),  soho_ephemeris(3),
     standard_keywords(3)



DIAGNOSTICS

     In the DSDS/PE environment failure on any dataset will cause
     an  error  exit  status.   Missing input datasets produce no
     output and do not count as failures.



BUGS

     There are no calibration  tables  for  magnetic  data.   The
     default  calibrations consist of constant multipliers of the
     raw data.  There is not a separate  set  of  high-resolution
     Doppler  calibration  coefficients, and use of the full-disc
     set is undoubtedly erroneous.  The intensity data are simply
     flat-fielded  to arbitrary units, not calibrated to physical
     units nor corrected for distance, foreshortening, and  irra-
     diance.   Magnetic  field strengths are also uncorrected for
     viewing angle.

     No  bad  pixel  map  is  implemented.   If  necessary,   bad
     (uncalibrable)  pixels  can  be  established  by setting the
     appropriate coefficients in the calibration tables.

     The program does not function correctly if the  -r  flag  is
     specified  for  the Structure Program Medium-l data, the 2*2
     Binned Cropped data, or the Binned LOI Continuum data.   Use
     of  the  -r flag with the Binned LOI Doppler data results in
     the calibrated values varying  slightly  over  each  of  the
     reconstructed  sampling  areas,  because  spatially  varying
     calibration parameters are being  applied  to  constant  raw
     data  values  over  each  pixel in the sampling area, rather
     than being averaged.  In general, the -r flag should be used
     with extreme caution.

     The data medians in the headers are estimates only  and  are
     not  quite  correct.  The pointing and ephemeris information
     are not guaranteed to  be  definitive;  best  estimates  are
     used.   If  the  relevant  tables do not cover the observing
     time, the pointing is assumed to  be  nominal  (Sun  exactly
     centered  on  the  CCD)  and a calculated Earth ephemeris is
     used rather than the SOHO ephemeris.  Appropriate data qual-
     ity keys are set to flag these cases.

     There are too many special cases, separate logic paths,  and
     constants in the program.




AUTHOR

     Rick Bogart



HISTORY

     1998-03-30     SOI Version 3.0