• atCaliApply
  • atLCaliApply
  • atnLCaliInverst
  • atCaliInvert
  • atLCaliInverse
  • atLupApply
  • atLupInvert
  • atCali.c

    C bindings apply photometric calibrations.
    
    
    
    

    atCaliApply

    DESCRIPTION:
    
    Applies, for filter u and color filter g:
      u = u_inst - a'_u - b'_u [(u-g)_inst - (u-g)_inst,0]
     c'_u [(u-g)_inst - (u-g)_inst,0] [X - X_0] 
     k'_u X 
    
      where
    u'-g')_inst,0 is the crossing color
      X_0 is a zeropoint airmass 
    we generally take it to be the mean airmass of the SDSS imaging 
          survey, or X_0=1.3)
    
      and where, to second order,
      a'_u = a_u
      b'_u = b_u
      c'_u = c_u
      k'_u = k_u
    note: for earler forms of the photometric equations,
      a'_u=a_u and k'_u=k_u to only first order and additional
      terms were needed)
    
    
      If 3\sigma > Counts, use cosmic color and cosmic scatter
      where 
      Counts is the counts/sec through the color filter
    sigma is the error on Counts 
    
      This handles cases where there is no detection through the color filter,
      or the error on the detection is just too high.
      The idea behind using the mean cosmic color is that we are making a 
      correction, hopefully small, and using a reasonable guess is better
      than using a very noisy mesaurement.
     
    
      
    RETURN VALUES:
    
     	error codes:
     		0	calibration sucessful
     		1	counts <= 0
     	status codes:
     		0	calibrated using measured quatities
     		1	used cosmic colors for calibration
     
    
    SIGNATURE:
      int atCaliApply 
      (
       double counts,			/* IN: counts in the reference filter */
       double countsErr,		/* IN: error in counts */
       double cCounts,		/* IN: count in the adjacent filter */
       double cCountsErr,		/* IN: error in cCounts */
       double intTime,		/* IN: exposure time in the reference filter */
       double cIntTime,		/* IN: exposure time in the adjacent filter */
       double airmass,		/* IN: airmass  (sec(Z)) */
       double zeropt,			/* IN: zeropoint (a') */
       double extinct,		/* IN: extinction prime (k') */
       double colorTerm,		/* IN: color term (b') */
       double secColorTerm,		/* IN: second order color term (c') */
       int sign,			/* IN: usually +1 for u g r i; -1 for z */
       double cosmicColor,		/* IN: cosmic reference-adjacent color */
       double cosmicError,		/* IN: scatter in cosmicColor */
       double zpAirmass,	        /* IN: zeropoint airmass (for c term) */
       double zpColor,	        /* IN: zeropoint color (for c term) */
       double *calMag,		/* OUT: calibrated magnitude */
       double *calMagErr,		/* OUT: error in calMag */
       int *status			/* OUT: status */
       )
    

    atLCaliApply

    DESCRIPTION:
    
    Applies, for filter u and color filter g:
      u = u_inst - a'_u - b'_u (u-g)_inst - c'_u (u-g)_inst secZ - k'_u secZ 
      where:
      a'_u = a_u - b_u(a_u-a_g)  
      b'_u = b_u  
      c'_u = c_u  
      k'_u = k_u - b_u(k_u-k_g) - c_u(a_u-a_g)  
    
      If the color is blueward cast rather than redward,
    for the i filter, say, redward color cast is (i-z), blueward is (r-i) )
      then sign of every term including color in the above equations must
      change signs.
    
    
      If 3\sigma > Counts, use cosmic color and cosmic scatter
      where 
      Counts is the counts/sec through the color filter
    sigma is the error on Counts 
    
      This handles cases where there is no detection through the color filter,
      or the error on the detection is just too high.
      The idea behind using the mean cosmic color is that we are making a 
      correction, hopefully small, and using a reasonable guess is better
      than using a very noisy mesaurement.
     
    Luptitude calculation)
    
      
    RETURN VALUES:
    
     	error codes:
     		0	calibration sucessful
     		1	counts <= 0
     	status codes:
     		0	calibrated using measured quatities
     		1	used cosmic colors for calibration
     
    
    SIGNATURE:
      int atLCaliApply 
      (
       double counts,			/* IN: counts in the reference filter */
       double countsErr,		/* IN: error in counts */
       double cCounts,		/* IN: count in the adjacent filter */
       double cCountsErr,		/* IN: error in cCounts */
       double intTime,		/* IN: exposure time in the reference filter */
       double cIntTime,		/* IN: exposure time in the adjacent filter */
       double airmass,		/* IN: airmass  (sec(Z)) */
       double zeropt,			/* IN: zeropoint (a') */
       double extinct,		/* IN: extinction prime (k') */
       double colorTerm,		/* IN: color term (b') */
       double secColorTerm,		/* IN: second order color term (c') */
       int sign,			/* IN: usually +1 for u g r i; -1 for z */
       double cosmicColor,		/* IN: cosmic reference-adjacent color */
       double cosmicError,		/* IN: scatter in cosmicColor */
       double *calMag,		/* OUT: calibrated luptitude */
       double *calMagErr,		/* OUT: error in calMag */
       int *status			/* OUT: status */
       )
    

    atnLCaliInverst

    	DESCRIPTION: Given a calibrated luptitude get the maggies or approx flux in
    	Jy from the luptitude. Getting the DN back is more work, as you then
    	need all the a,b,c,k, airmass, exp time etc information.
    
    SIGNATURE:
      
      int atnLCaliInvert(
      		 double calMag,	/* calibrated luptitude in this band */
      		 double calMagErr, /* calibrated error */
      		 int filterIndex, /* u=0, g=1, r=2, i=3, z=4 */
      		 int maggies,  /* units of returned quantity 1=maggies (default), 2=flux (Jy)*/
      	         double faintbprime, /* if 0 use the filterIndex bprime, else use this one */
      	         double flux0, /*  flux zeropoint for this band */
      		 double *counts, double *countsErr)
    

    atCaliInvert

      DESCRIPTION: Given a calibrated magnitude and error with cali constants, return
      the number of counts and error in the counts.
    
    SIGNATURE:
      
      int atCaliInvert(
      		 double calMag,	/* calibrated magnitude in this band */
      		 double cCalMag, /* calibrated magnitude in adjacent band */
      		 double intTime, /* integration time in seconds */
      		 double airmass, /* airmass */
      		 double zeropt,	/* zeropoint */
      		 double extinct, /* extinction */
      		 double colorTerm, /* color term */
      		 double secColorTerm, /* secondary color term */
      		 int sign,	/* sign:  +1 for u g r i; -1 for z */
      		 double zpAirmass,  /* IN: zeropoint airmass (for c term) */
      		 double zpColor,    /* IN: zeropoint color (for c term) */
      		 double *counts)
    

    atLCaliInverse

    	DESCRIPTION: Given a calibrated luptitude and cali constants,
    	return the number of counts.
    
    SIGNATURE:
      
      int atLCaliInvert(
      		 double calMag,	/* calibrated luptitude in this band */
      		 double cCalMag, /* calibrated luptitude in adjacent band */
      		 double intTime, /* integration time in seconds */
      		 double airmass, /* airmass */
      		 double zeropt,	/* zeropoint */
      		 double extinct, /* extinction */
      		 double colorTerm, /* color term */
      		 double secColorTerm, /* secondary color term */
      		 int sign,	/* sign:  +1 for u g r i; -1 for z */
      		 double *counts)
    

    atLupApply

    	DESCRIPTION: Given counts and counts error, return luptitude and luptitude error.
    
    SIGNATURE:
      
      int atLupApply ( double counts,	/* luptitude */
      		 double countsErr,	/* luptitude error */
      		 double *lup, double *lupErr)
    

    atLupInvert

    	DESCRIPTION: Given a luptitude, return the number of counts.
    
    SIGNATURE:
      
      int atLupInvert( double lup,	/* luptitude */
      		 double luperr,	/* luptitude error */
      		 double *counts, double *countsErr)