
REGISTER_IMFILE METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  FILE.LEVEL       	  STR  CONSTANT          -filelevel           # File level
  ENTRY  VAL  CLASS.ID         	  STR  CONSTANT          -class_id            # Real Class ID
  ENTRY  VAL  FPA.OBJECT       	  STR  CONSTANT          -object              # Object
  ENTRY  VAL  FPA.OBSTYPE      	  STR  CONSTANT          -exp_type            # Exposure type
  ENTRY  VAL  FPA.FILTER       	  STR  CONSTANT          -filter              # Filter used
  ENTRY  VAL  FPA.COMMENT      	  STR  CONSTANT          -comment             # Obs Comment
  ENTRY  VAL  FPA.OBS.MODE     	  STR  CONSTANT          -obs_mode            # Obs Mode (eg, survey ID)
  ENTRY  VAL  FPA.OBS.GROUP    	  STR  CONSTANT          -obs_group           # Obs Group (image sequence)
  ENTRY  VAL  FPA.AIRMASS      	  F32  CONSTANT          -airmass             # Airmass
  ENTRY  VAL  FPA.RA           	  F64  CONSTANT          -ra                  # Right ascension
  ENTRY  VAL  FPA.DEC          	  F64  CONSTANT          -decl                # Declination
  ENTRY  VAL  FPA.ALT          	  F64  CONSTANT          -alt                 # Altitude
  ENTRY  VAL  FPA.AZ           	  F64  CONSTANT          -az                  # Azimuth
  ENTRY  VAL  FPA.POSANGLE     	  F32  CONSTANT          -posang              # Position angle
  ENTRY  VAL  FPA.TIME         	  UTC   CONSTANT          -dateobs             # Date of observation (UTC)
  ENTRY  VAL  FPA.TELESCOPE    	  STR  CONSTANT          -telescope           # Telescope
  ENTRY  VAL  FPA.CAMERA       	  STR  CONSTANT          -inst                # Instrument
  ENTRY  VAL  FPA.LONGITUDE    	  F64  CONSTANT          -longitude           # Site longitude
  ENTRY  VAL  FPA.LATITUDE     	  F64  CONSTANT          -latitude            # Site latitude
  ENTRY  VAL  FPA.ELEVATION    	  F32  CONSTANT          -elevation           # Site elevation
  ENTRY  VAL  FPA.M1X          	  F32  CONSTANT          -m1_x                # M1X
  ENTRY  VAL  FPA.M1Y          	  F32  CONSTANT          -m1_y                # M1Y
  ENTRY  VAL  FPA.M1Z          	  F32  CONSTANT          -m1_z                # M1Z
  ENTRY  VAL  FPA.M1TIP        	  F32  CONSTANT          -m1_tip              # M1TIP
  ENTRY  VAL  FPA.M1TILT       	  F32  CONSTANT          -m1_tilt             # M1TILT
  ENTRY  VAL  FPA.M2X          	  F32  CONSTANT          -m2_x                # M2X
  ENTRY  VAL  FPA.M2Y          	  F32  CONSTANT          -m2_y                # M2Y
  ENTRY  VAL  FPA.M2Z          	  F32  CONSTANT          -m2_z                # M2Z
  ENTRY  VAL  FPA.M2TIP        	  F32  CONSTANT          -m2_tip              # M2TIP
  ENTRY  VAL  FPA.M2TILT       	  F32  CONSTANT          -m2_tilt             # M2TILT
  ENTRY  VAL  FPA.ENV.TEMP     	  F32  CONSTANT          -env_temperature     # external temp
  ENTRY  VAL  FPA.ENV.HUMID    	  F32  CONSTANT          -env_humidity        # external humidity
  ENTRY  VAL  FPA.ENV.WIND     	  F32  CONSTANT          -env_wind_speed      # external wind speed
  ENTRY  VAL  FPA.ENV.DIR      	  F32  CONSTANT          -env_wind_dir        # external wind direction
  ENTRY  VAL  FPA.TELTEMP.M1      F32  CONSTANT          -teltemp_m1          # Primary mirror temps (C)
  ENTRY  VAL  FPA.TELTEMP.M1CELL  F32  CONSTANT          -teltemp_m1cell      # Primary mirror support temps (C)
  ENTRY  VAL  FPA.TELTEMP.M2      F32  CONSTANT          -teltemp_m2          # Secondary mirror temps (C
  ENTRY  VAL  FPA.TELTEMP.SPIDER  F32  CONSTANT          -teltemp_spider      # Spider temperatures (C)
  ENTRY  VAL  FPA.TELTEMP.TRUSS   F32  CONSTANT          -teltemp_truss       # Mid truss temperatures (C
  ENTRY  VAL  FPA.TELTEMP.EXTRA   F32  CONSTANT          -teltemp_extra       # Miscellaneous temperatures (C)
  ENTRY  VAL  FPA.PON.TIME     	  F32  CONSTANT          -pon_time            # time since last power on
#  ENTRY  VAL  FPA.BURNTOOL.APPLIED S32 CONSTANT          -burntool_state      # 
  ENTRY  VAL  CHIP.TEMP        	  F32  SAMPLE_MEAN       -ccd_temp            # CCD temperature
  ENTRY  VAL  CELL.EXPOSURE    	  F32  SAMPLE_MEAN       -exp_time            # Exposure time
  ENTRY  VAL  SAT_PIXEL_FRAC   	  F32  SAMPLE_MEAN       -sat_pixel_frac      # fraction of saturated pixels
  ENTRY  VAL  ROBUST_MEDIAN    	  F32  ROBUST_MEDIAN     -bg                 
  ENTRY  VAL  ROBUST_MEDIAN    	  F32  ROBUST_STDEV      -bg_mean_stdev      
  ENTRY  VAL  ROBUST_STDEV     	  F32  RMS               -bg_stdev           
  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
END

REGISTER_EXP METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  exp_name            STR  CONSTANT          -exp_name            # 
  ENTRY  VAL  telescope           STR  CONSTANT          -telescope           # 
  ENTRY  VAL  camera              STR  CONSTANT          -inst                # 
  ENTRY  VAL  filelevel           STR  CONSTANT          -filelevel           # 
  ENTRY  VAL  object              STR  CONSTANT          -object             
  ENTRY  VAL  exp_type            STR  CONSTANT          -exp_type            # File level
  ENTRY  VAL  filter              STR  CONSTANT          -filter              # File level
  ENTRY  VAL  comment             STR  CONSTANT          -comment             # ObsComment
  ENTRY  VAL  obs_mode     	  STR  CONSTANT          -obs_mode            # Obs Mode (eg, survey ID)
  ENTRY  VAL  obs_group    	  STR  CONSTANT          -obs_group           # Obs Group (image sequence)
  ENTRY  VAL  dateobs             UTC  CONSTANT          -dateobs             # File level
  ENTRY  VAL  ccd_temp            F32  SAMPLE_MEAN       -ccd_temp            # CCD temperature
  ENTRY  VAL  exp_time            F32  SAMPLE_MEAN       -exp_time            # Exposure time
  ENTRY  VAL  sat_pixel_frac      F32  SAMPLE_MEAN       -sat_pixel_frac      # Fraction of saturated pixels
  ENTRY  VAL  airmass             F32  CONSTANT          -airmass             # Airmass
  ENTRY  VAL  ra                  F64  CONSTANT          -ra                  # Right ascension
  ENTRY  VAL  decl                F64  CONSTANT          -decl                # Declination
  ENTRY  VAL  posang              F64  CONSTANT          -posang              # Position angle
  ENTRY  VAL  alt                 F64  CONSTANT          -alt                 # Altitude
  ENTRY  VAL  az                  F64  CONSTANT          -az                  # Azimuth
  ENTRY  VAL  m1_x                F32  CONSTANT          -m1_x                # M1X
  ENTRY  VAL  m1_y                F32  CONSTANT          -m1_y                # M1Y
  ENTRY  VAL  m1_z                F32  CONSTANT          -m1_z                # M1Z
  ENTRY  VAL  m1_tip              F32  CONSTANT          -m1_tip              # M1TIP
  ENTRY  VAL  m1_tilt             F32  CONSTANT          -m1_tilt             # M1TILT
  ENTRY  VAL  m2_x                F32  CONSTANT          -m2_x                # M2X
  ENTRY  VAL  m2_y                F32  CONSTANT          -m2_y                # M2Y
  ENTRY  VAL  m2_z                F32  CONSTANT          -m2_z                # M2Z
  ENTRY  VAL  m2_tip              F32  CONSTANT          -m2_tip              # M2TIP
  ENTRY  VAL  m2_tilt             F32  CONSTANT          -m2_tilt             # M2TILT
  ENTRY  VAL  env_temperature     F32  CONSTANT          -env_temperature     # external temp
  ENTRY  VAL  env_humidity        F32  CONSTANT          -env_humidity        # external humidity
  ENTRY  VAL  env_wind_speed      F32  CONSTANT          -env_wind_speed      # external wind speed
  ENTRY  VAL  env_wind_dir        F32  CONSTANT          -env_wind_dir        # external wind direction
  ENTRY  VAL  teltemp_m1          F32  CONSTANT          -teltemp_m1          # Primary mirror temps (C)
  ENTRY  VAL  teltemp_m1cell      F32  CONSTANT          -teltemp_m1cell      # Primary mirror support temps (C)
  ENTRY  VAL  teltemp_m2          F32  CONSTANT          -teltemp_m2          # Secondary mirror temps (C
  ENTRY  VAL  teltemp_spider      F32  CONSTANT          -teltemp_spider      # Spider temperatures (C)
  ENTRY  VAL  teltemp_truss       F32  CONSTANT          -teltemp_truss       # Mid truss temperatures (C
  ENTRY  VAL  teltemp_extra       F32  CONSTANT          -teltemp_extra       # Miscellaneous temperatures (C)
  ENTRY  VAL  sun_angle           F32  CONSTANT          -sun_angle           # Angle to sun
  ENTRY  VAL  sun_alt             F32  CONSTANT          -sun_alt             # Altitude of sun
  ENTRY  VAL  moon_angle          F32  CONSTANT          -moon_angle          # Angle to moon
  ENTRY  VAL  moon_alt            F32  CONSTANT          -moon_alt            # Altitude of moon
  ENTRY  VAL  moon_phase          F32  CONSTANT          -moon_phase          # Phase of moon
  ENTRY  VAL  pon_time            F32  CONSTANT          -pon_time            # time since last power on
  ENTRY  VAL  bg                  F64  ROBUST_MEDIAN     -bg                  # background
  ENTRY  VAL  bg                  F64  ROBUST_STDEV      -bg_mean_stdev       # Azimuth
  ENTRY  VAL  bg_stdev            F64  RMS               -bg_stdev            # Azimuth
END

CHIP_IMFILE METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_MEDIAN    -bg               
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_STDEV     -bg_mean_stdev    
  ENTRY  VAL  ROBUST_STDEV        F32  RMS              -bg_stdev         
  ENTRY  VAL  OVER_VAL            F32  ROBUST_MEDIAN    -bias             
  ENTRY  VAL  OVER_VAL            F32  ROBUST_STDEV     -bias_stdev       
  ENTRY  VAL  FRINGE_0            F32  RMS              -fringe_0         
  ENTRY  VAL  FRINGE_RESID_0      F32  RMS              -fringe_1         
  ENTRY  VAL  FRINGE_ERR_0        F32  RMS              -fringe_2         
  ENTRY  VAL  APMIFIT             F32  SAMPLE_MEAN      -ap_resid         
  ENTRY  VAL  DAPMIFIT            F32  RMS              -ap_resid_stdev   

  # image quality stats from the psf model
  ENTRY  VAL  FWHM_MAJ            F32  SAMPLE_MEAN      -fwhm_major       
  ENTRY  VAL  FW_MJ_LQ            F32  SAMPLE_MEAN      -fwhm_major_lq       
  ENTRY  VAL  FW_MJ_UQ            F32  SAMPLE_MEAN      -fwhm_major_uq       
  ENTRY  VAL  FWHM_MIN            F32  SAMPLE_MEAN      -fwhm_minor       
  ENTRY  VAL  FW_MN_LQ            F32  SAMPLE_MEAN      -fwhm_minor_lq       
  ENTRY  VAL  FW_MN_UQ            F32  SAMPLE_MEAN      -fwhm_minor_uq       

  ENTRY  VAL  DT_DET              F32  SUM              -dtime_detrend    
  ENTRY  VAL  DT_PHOT             F32  SUM              -dtime_photom     
  ENTRY  VAL  DT_TOTAL            F32  SUM              -dtime_total

  ENTRY  VAL  NSTARS              S32  SUM              -n_stars          
  ENTRY  VAL  NPSFSTAR            S32  SUM              -n_psfstars          
  ENTRY  VAL  IQ_NSTAR            S32  SUM              -n_iqstars          
  ENTRY  VAL  NDET_EXT            S32  SUM              -n_extended       
  ENTRY  VAL  NDET_CR             S32  SUM              -n_cr             

  # the LQ and UQ values need to be defined for each camera
  ENTRY  VAL  IQ_FW1              F32  SAMPLE_MEAN      -iq_fwhm_major            
  ENTRY  VAL  IQ_FW1_E            F32  RMS              -iq_fwhm_major_err
  ENTRY  VAL  IQ_FW2              F32  SAMPLE_MEAN      -iq_fwhm_minor
  ENTRY  VAL  IQ_FW2_E            F32  RMS              -iq_fwhm_minor_err

  ENTRY  VAL  IQ_M2               F32  SAMPLE_MEAN      -iq_m2            
  ENTRY  VAL  IQ_M2_ER            F32  RMS              -iq_m2_err        
  ENTRY  VAL  IQ_M2_LQ            F32  SAMPLE_MEAN      -iq_m2_lq            
  ENTRY  VAL  IQ_M2_UQ            F32  SAMPLE_MEAN      -iq_m2_uq            
  
  ENTRY  VAL  IQ_M3               F32  SAMPLE_MEAN      -iq_m3            
  ENTRY  VAL  IQ_M3_ER            F32  RMS              -iq_m3_err        
  ENTRY  VAL  IQ_M3_LQ            F32  SAMPLE_MEAN      -iq_m3_lq            
  ENTRY  VAL  IQ_M3_UQ            F32  SAMPLE_MEAN      -iq_m3_uq            
  
  ENTRY  VAL  IQ_M4               F32  SAMPLE_MEAN      -iq_m4            
  ENTRY  VAL  IQ_M4_ER            F32  RMS              -iq_m4_err        
  ENTRY  VAL  IQ_M4_LQ            F32  SAMPLE_MEAN      -iq_m4_lq            
  ENTRY  VAL  IQ_M4_UQ            F32  SAMPLE_MEAN      -iq_m4_uq            
  
  ENTRY  VAL  IQ_M2C              F32  SAMPLE_MEAN      -iq_m2c            
  ENTRY  VAL  IQ_M2C_E            F32  RMS              -iq_m2c_err        
  ENTRY  VAL  IQ_M2C_L            F32  SAMPLE_MEAN      -iq_m2c_lq            
  ENTRY  VAL  IQ_M2C_U            F32  SAMPLE_MEAN      -iq_m2c_uq            
  
  ENTRY  VAL  IQ_M2S              F32  SAMPLE_MEAN      -iq_m2s            
  ENTRY  VAL  IQ_M2S_E            F32  RMS              -iq_m2s_err        
  ENTRY  VAL  IQ_M2S_L            F32  SAMPLE_MEAN      -iq_m2s_lq            
  ENTRY  VAL  IQ_M2S_U            F32  SAMPLE_MEAN      -iq_m2s_uq            
  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
END

CAMERA_EXP_IMFILE METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  bg                  F32  ROBUST_MEDIAN    -bg               
  ENTRY  VAL  bg                  F32  ROBUST_STDEV     -bg_mean_stdev    
  ENTRY  VAL  bg_stdev            F32  RMS              -bg_stdev         
  ENTRY  VAL  bias                F32  ROBUST_MEDIAN    -bias             
  ENTRY  VAL  bias_stdev          F32  RMS              -bias_stdev       
  ENTRY  VAL  fringe_0            F32  ROBUST_MEDIAN    -fringe_0         
  ENTRY  VAL  fringe_1            F32  RMS              -fringe_1         
  ENTRY  VAL  fringe_2            F32  ROBUST_STDEV     -fringe_2         
  ENTRY  VAL  ap_resid            F32  ROBUST_MEDIAN    -ap_resid         
  ENTRY  VAL  ap_resid_stdev      F32  RMS              -ap_resid_stdev   
  ENTRY  VAL  fwhm_major          F32  ROBUST_MEDIAN    -fwhm_major       
  ENTRY  VAL  fwhm_major          F32  UQ               -fwhm_major_uq       
  ENTRY  VAL  fwhm_major          F32  LQ               -fwhm_major_lq       
  ENTRY  VAL  fwhm_minor          F32  ROBUST_MEDIAN    -fwhm_minor       
  ENTRY  VAL  fwhm_minor          F32  UQ               -fwhm_minor_uq       
  ENTRY  VAL  fwhm_minor          F32  LQ               -fwhm_minor_lq       
  ENTRY  VAL  n_stars             S32  SUM              -n_stars          
  ENTRY  VAL  n_psfstars          S32  SUM              -n_psfstars          
  ENTRY  VAL  n_iqstars           S32  SUM              -n_iqstars          
  ENTRY  VAL  n_extended          S32  SUM              -n_extended       
  ENTRY  VAL  n_cr                S32  SUM              -n_cr             

  # the LQ and UQ values need to be defined for each camera
  ENTRY  VAL  iq_fwhm_major       F32  ROBUST_MEDIAN    -iq_fwhm_major
  ENTRY  VAL  iq_fwhm_major_err   F32  RMS              -iq_fwhm_major_err
  ENTRY  VAL  iq_fwhm_minor       F32  ROBUST_MEDIAN    -iq_fwhm_minor
  ENTRY  VAL  iq_fwhm_minor_err   F32  RMS              -iq_fwhm_minor_err
  	                
  ENTRY  VAL  iq_m2               F32  ROBUST_MEDIAN    -iq_m2            
  ENTRY  VAL  iq_m2_err           F32  RMS              -iq_m2_err        
  ENTRY  VAL  iq_m2               F32  UQ               -iq_m2_uq            
  ENTRY  VAL  iq_m2               F32  LQ               -iq_m2_lq            
  	                
  ENTRY  VAL  iq_m3               F32  ROBUST_MEDIAN    -iq_m3            
  ENTRY  VAL  iq_m3_err           F32  RMS              -iq_m3_err        
  ENTRY  VAL  iq_m3               F32  UQ               -iq_m3_uq            
  ENTRY  VAL  iq_m3               F32  LQ               -iq_m3_lq            
  	                
  ENTRY  VAL  iq_m4               F32  ROBUST_MEDIAN    -iq_m4            
  ENTRY  VAL  iq_m4_err           F32  RMS              -iq_m4_err        
  ENTRY  VAL  iq_m4               F32  UQ               -iq_m4_uq            
  ENTRY  VAL  iq_m4               F32  LQ               -iq_m4_lq            
  	                
  ENTRY  VAL  iq_m2c              F32  ROBUST_MEDIAN    -iq_m2c            
  ENTRY  VAL  iq_m2c_err          F32  RMS              -iq_m2c_err        
  ENTRY  VAL  iq_m2c              F32  UQ               -iq_m2c_uq            
  ENTRY  VAL  iq_m2c              F32  LQ               -iq_m2c_lq            
  	                
  ENTRY  VAL  iq_m2s              F32  ROBUST_MEDIAN    -iq_m2s            
  ENTRY  VAL  iq_m2s_err          F32  RMS              -iq_m2s_err        
  ENTRY  VAL  iq_m2s              F32  UQ               -iq_m2s_uq            
  ENTRY  VAL  iq_m2s              F32  LQ               -iq_m2s_lq            

  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
END

CAMERA_EXP_FPA METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  CERROR              F32  RMS              -sigma_ra          
  ENTRY  VAL  CERROR              F32  RMS              -sigma_dec         
  ENTRY  VAL  DT_ASTR             F32  SUM              -dtime_astrom      
  ENTRY  VAL  NASTRO              S32  SUM              -n_astrom          

  ENTRY  VAL  ZPT_OBS             F32  SAMPLE_MEAN      -zpt_obs
  ENTRY  VAL  ZPT_ERR             F32  RMS              -zpt_err
  ENTRY  VAL  ZPT_UQ              F32  UQ               -zpt_uq
  ENTRY  VAL  ZPT_LQ              F32  LQ               -zpt_lq
END

WARP_SKYCELL METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_MEDIAN     -bg            
  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bg_stdev      
  ENTRY  VAL  DT_WARP             F32  SUM               -dtime_warp    
  ENTRY  VAL  GOOD_PIXEL_FRAC     F32  SAMPLE_MEAN       -good_frac     
  ENTRY  VAL  RANGE.XMIN          S32  CONSTANT          -xmin          
  ENTRY  VAL  RANGE.XMAX          S32  CONSTANT          -xmax          
  ENTRY  VAL  RANGE.YMIN          S32  CONSTANT          -ymin          
  ENTRY  VAL  RANGE.YMAX          S32  CONSTANT          -ymax          
  ENTRY  VAL  ACCEPT              BOOL CONSTANT          -accept
  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
END

STACK_SKYCELL METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_MEDIAN     -bg                            
  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bg_stdev                      
  ENTRY  VAL  TIME_STACK          F32  SUM               -dtime_stack                   
  ENTRY  VAL  TIME_MATCH          F32  SAMPLE_MEAN       -dtime_match_mean              
  ENTRY  VAL  TIME_MATCH          F32  SAMPLE_STDEV      -dtime_match_stdev             
  ENTRY  VAL  TIME_INITIAL        F32  SUM               -dtime_initial                 
  ENTRY  VAL  TIME_REJECT         F32  SUM               -dtime_reject                  
  ENTRY  VAL  TIME_FINAL          F32  SUM               -dtime_final                   
  ENTRY  VAL  TIME_PHOT           F32  SUM               -dtime_phot                    
  ENTRY  VAL  STAMP.MEAN          F32  SAMPLE_MEAN       -match_mean                    
  ENTRY  VAL  STAMP.MEAN          F32  SAMPLE_STDEV      -match_stdev                   
  ENTRY  VAL  STAMP.RMS           F32  RMS               -match_rms                     
  ENTRY  VAL  STAMP.NUM           F32  SAMPLE_MEAN       -stamps_mean                   
  ENTRY  VAL  STAMP.NUM           F32  SAMPLE_STDEV      -stamps_stdev                  
  ENTRY  VAL  STAMP.NUM           S32  MIN               -stamps_min                    
  ENTRY  VAL  TIME_PHOT           F32  SUM               -dtime_phot                    
  ENTRY  VAL  REJECT_IMAGES       S32  SUM               -reject_images                 
  ENTRY  VAL  REJECT_PIXELS       F32  SAMPLE_MEAN       -reject_pix_mean               
  ENTRY  VAL  REJECT_PIXELS       F32  SAMPLE_STDEV      -reject_pix_stdev              
  ENTRY  VAL  NUM_SOURCES         S32  SUM               -sources                       
  ENTRY  VAL  GOOD_PIXEL_FRAC     F32  MEAN              -good_frac                     
  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
END

DIFF_SKYCELL METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD               TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_MEDIAN          F32  ROBUST_MEDIAN     -bg             
  ENTRY  VAL  ROBUST_STDEV           F32  RMS               -bg_stdev       
  ENTRY  VAL  TIME_SUB               F32  SUM               -dtime_diff     
  ENTRY  VAL  TIME_MATCH             F32  SUM               -dtime_match    
  ENTRY  VAL  TIME_PHOT              F32  SUM               -dtime_phot     
  ENTRY  VAL  SUBTRACTION.STAMPS     S32  SAMPLE_MEAN       -stamps_num     
  ENTRY  VAL  SUBTRACTION.DEV.MEAN   F32  SAMPLE_MEAN       -stamps_mean    
  ENTRY  VAL  SUBTRACTION.DEV.RMS    F32  SAMPLE_MEAN       -stamps_rms     
  ENTRY  VAL  SUBTRACTION.NORM       F32  SAMPLE_MEAN       -norm           
  ENTRY  VAL  SUBTRACTION.BGDIFF     F32  SAMPLE_MEAN       -bg_diff        
  ENTRY  VAL  SUBTRACTION.MX         F32  SAMPLE_MEAN       -kernel_x       
  ENTRY  VAL  SUBTRACTION.MY         F32  SAMPLE_MEAN       -kernel_y       
  ENTRY  VAL  SUBTRACTION.MXX        F32  SAMPLE_MEAN       -kernel_xx      
  ENTRY  VAL  SUBTRACTION.MXY        F32  SAMPLE_MEAN       -kernel_xy      
  ENTRY  VAL  SUBTRACTION.MYY        F32  SAMPLE_MEAN       -kernel_yy      
  ENTRY  VAL  SUBTRACTION.DECONV.MAX F32  SAMPLE_MEAN       -deconv_max
  ENTRY  VAL  NUM_SOURCES            S32  SUM               -sources        
  ENTRY  VAL  GOOD_PIXEL_FRAC        F32  MEAN              -good_frac      
  ENTRY  VAL  QUALITY                S32  CONSTANT          -quality             # Bad quality flag
END

# values to extract from output metadata and the stats to calculate
# XXX -bg_mean_stdev should take rms of bg_mean_stdev if bg_mean_stdev != 0 (A)
# XXX -bg_mean_stdev should take stdev of bg_mean if bg_mean_stdev == 0     (B)
# XXX  (A) if imfile.Ncomp > 1, (B) if imfile.Ncomp == 1

DETREND_PROCESS_IMFILE METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_MEDIAN     -bg
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_STDEV      -bg_mean_stdev
  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bg_stdev
END

DETREND_PROCESS_EXP METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  bg                  F64  ROBUST_MEDIAN     -bg
  ENTRY  VAL  bg                  F64  ROBUST_STDEV      -bg_mean_stdev
  ENTRY  VAL  bg_stdev            F64  RMS               -bg_stdev
END

DETREND_STACK METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_MEDIAN     -bg
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_STDEV      -bg_mean_stdev
  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bg_stdev
END

DETREND_NORM_EXP METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  bg                  F64  ROBUST_MEDIAN     -bg
  ENTRY  VAL  bg                  F64  ROBUST_STDEV      -bg_mean_stdev
  ENTRY  VAL  bg_stdev            F64  RMS               -bg_stdev
END

DETREND_NORM_APPLY METADATA
  ENTRY MULTI

  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_MEDIAN     -bg
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_STDEV      -bg_mean_stdev
  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bg_stdev
END

DETREND_RESID_IMFILE METADATA
  ENTRY MULTI
  
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_MEDIAN     -bg                
  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_STDEV      -bg_mean_stdev     
  ENTRY  VAL  SAMPLE_SKEWNESS     F32  ROBUST_MEDIAN     -bg_skewness       
  ENTRY  VAL  SAMPLE_KURTOSIS     F32  ROBUST_MEDIAN     -bg_kurtosis       
  ENTRY  VAL  FRINGE_0            F32  ROBUST_MEDIAN     -fringe_0          
  ENTRY  VAL  FRINGE_0            F32  ROBUST_STDEV      -fringe_2          
  ENTRY  VAL  FRINGE_RESID_0      F32  ROBUST_MEDIAN     -fringe_resid_0    
  ENTRY  VAL  FRINGE_RESID_0      F32  ROBUST_STDEV      -fringe_resid_2    
  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bg_stdev          
  ENTRY  VAL  FRINGE_RESID_ERR_0  F32  RMS               -fringe_resid_1    
  ENTRY  VAL  FRINGE_ERR_0        F32  RMS               -fringe_1          
END

DETREND_RESID_IMFILE_BINNED METADATA
  ENTRY MULTI
  
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bin_stdev          
END

DETREND_RESID_EXP METADATA
  ENTRY MULTI
  
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  bg                  F64  ROBUST_MEDIAN     -bg           
  ENTRY  VAL  bg                  F64  ROBUST_STDEV      -bg_mean_stdev
  ENTRY  VAL  bg_stdev            F64  RMS               -bg_stdev     
  ENTRY  VAL  bg_skewness         F64  ROBUST_MEDIAN     -bg_skewness  
  ENTRY  VAL  bg_kurtosis         F64  ROBUST_MEDIAN     -bg_kurtosis  
  ENTRY  VAL  bin_stdev           F64  RMS               -bin_stdev    
  ENTRY  VAL  fringe_0            F64  ROBUST_MEDIAN     -fringe_0     
  ENTRY  VAL  fringe_1            F64  RMS               -fringe_1     
  ENTRY  VAL  fringe_2            F64  ROBUST_STDEV      -fringe_2     
  ENTRY  VAL  user_1              F64  ROBUST_MEDIAN     -user_1       
  ENTRY  VAL  user_2              F64  RMS               -user_2       
  ENTRY  VAL  user_1              F64  ROBUST_STDEV      -user_3       
END

STREAKSREMOVE METADATA
  ENTRY MULTI
  TYPE   VAL  KEYWORD             TYPE STATISTIC         FLAG 
  ENTRY  VAL  STREAK_FRACTION     F32  CONSTANT          -streak_frac # fraction of pixels masked by streaks
  ENTRY  VAL  NONDIFFED_FRACTION  F32  CONSTANT          -nondiff_frac # fraction of pixels not included in input diffs
  ENTRY  VAL  TOTAL_TIME          F32  CONSTANT          -run_time    # total run time for streaksremove

  # The following timers are included in the stats not saved in the datbase
# ENTRY  VAL  GET_STREAK_PIXELS   F32  CONSTANT          -dtime_compute_masked  # time to compute list of streak pixels
# ENTRY  VAL  REMOVE_STREAKS      F32  CONSTANT          -dtime_remove # time to mask the pixels
# ENTRY  VAL  WRITE_IMAGES        F32  CONSTANT          -dtime_write  # time to write out the results
# ENTRY  VAL  REPLICATE_OUTPUTS   F32  CONSTANT          -dtime_replicate  # time to replicate the outputs
END
