
2013.04.27

 need to move the conversion between mags and flux into dvopsps.

 * detection table
   * psfFlux : uses PSF_INST_MAG instead of PSF_INST_FLUX
   * psfFluxErr : uses PSF_INST_MAG_SIG and PSF_INST_MAG instead of PSF_INST_FLUX_SIG
   * apFlux : uses AP_MAG instead of AP_FLUX
   * kronFlux : correctly uses KRON_FLUX
   * kronFluxErr : correctly uses KRON_FLUX_ERR
   
   ** psfFlux is forced to 0.0000001 instead of 0.0 -- why?
   
 * stack detection table (same issues as detection table)
   * psfFlux : uses PSF_INST_MAG instead of PSF_INST_FLUX
   * psfFluxErr : uses PSF_INST_MAG_SIG and PSF_INST_MAG instead of PSF_INST_FLUX_SIG
   * apFlux : uses AP_MAG instead of AP_FLUX
   * kronFlux : correctly uses KRON_FLUX
   * kronFluxErr : correctly uses KRON_FLUX_ERR
   
   * psfFlux is set to 2 sigma if psfFlux is NULL

 * object 
   * Mean PSF Mag : direct from DVO MAG
   * Mean PSF Mag Err : direct from DVO MAG_ERR
   * Mean Kron Mag : direct from DVO KRON MAG
   * Mean Kron Mag Err : direct from DVO KRON MAG_ERR
   
   * Stack PSF Mag : from DVO stack psf flux
   * Stack PSF Mag Err : from DVO stack psf flux err
   * Stack Kron Mag : from DVO stack kron flux
   * Stack Kron Mag Err : from DVO stack kron flux err
      
 

   

old notes:

example of joining ipptopsps and gpc1 tables:

mysql -h ipp006 -u dvo -p ipptopsps -e "select batch_id, stage_id from batch where batch_type = 'P2'" > P2.batches.dat

on ippdb05: cp P2.batches.dat /tmp/datadump/

mysql -h ippdb05 -u dvo -p gpc1
mysql> create temporary table eam_p2_batches (batch_id int, cam_id int);
mysql> create temporary table eam_st_batches (batch_id int, stack_id int);
mysql> load data infile '/tmp/datadump/P2.batches.dat' into table eam_p2_batches ignore 1 lines (batch_id, cam_id);
mysql> select degrees(ra) as ra_deg, degrees(decl) as dec_deg, camRun.cam_id, batch_id, chip_id, exp_id, exp_name from camRun join chipRun using (chip_id) join rawExp using (exp_id) join eam_p2_batches on (eam_p2_batches.cam_id = camRun.cam_id) where batch_id is not null and degrees(ra) > 298.0 limit 100;
