IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 27, 2018, 3:31:55 PM (8 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/czw_branch/20170908
Files:
26 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20170908

  • branches/czw_branch/20170908/ippToPsps/config/tables.DO.vot

    r39255 r40483  
    77      <PARAM arraysize="1" datatype="char" ucd="meta.bib.author" name="Author" value="PSPS"></PARAM>
    88      <FIELD name="diffObjName" arraysize="32" datatype="char" unit="dimensionless" default="NA">
    9         <DESCRIPTION>IAU name for this object.</DESCRIPTION>
     9        <DESCRIPTION>IAU-approved name for this object.</DESCRIPTION>
    1010      </FIELD>
    11       <FIELD name="diffObjPSOName" arraysize="32" datatype="char" unit="dimensionless" default="NA">
    12         <DESCRIPTION>Alternate Pan-STARRS name for this object.</DESCRIPTION>
     11      <FIELD name="diffObjNameHMS" arraysize="32" datatype="char" unit="dimensionless" default="NA">
     12        <DESCRIPTION>Alternate Sexigesimal name for this object.</DESCRIPTION>
    1313      </FIELD>
    1414      <FIELD name="diffObjAltName1" arraysize="32" datatype="char" unit="dimensionless" default="">
  • branches/czw_branch/20170908/ippToPsps/config/tables.IN.vot

    r40101 r40483  
    576576        <TABLEDATA>
    577577          <TR><TD>NEW</TD>           <TD>0x00000000</TD><TD>0</TD><TD>No relphot / relastro attempted.</TD></TR>
    578           <TR><TD>PHOTOM_NOCAL</TD>  <TD>0x00000001</TD><TD>1</TD><TD>Used within relphot to mean 'don't apply fit'. | user-set value used withing relphot: ignore (EAM!)</TD></TR>
    579           <TR><TD>PHOTOM_POOR</TD>   <TD>0x00000002</TD><TD>2</TD><TD>Relphot says image is bad (dMcal > limit). (EAM!)</TD></TR>
    580           <TR><TD>PHOTOM_SKIP</TD>   <TD>0x00000004</TD><TD>4</TD><TD>External information image has bad photometry (EAM).</TD></TR>
     578          <TR><TD>PHOTOM_NOCAL</TD>  <TD>0x00000001</TD><TD>1</TD><TD>Used within relphot to mean 'don't apply fit'.</TD></TR>
     579          <TR><TD>PHOTOM_POOR</TD>   <TD>0x00000002</TD><TD>2</TD><TD>Relphot says image is bad (dMcal > limit).</TD></TR>
     580          <TR><TD>PHOTOM_SKIP</TD>   <TD>0x00000004</TD><TD>4</TD><TD>External information image has bad photometry.</TD></TR>
    581581          <TR><TD>PHOTOM_FEW</TD>    <TD>0x00000008</TD><TD>8</TD><TD>Currently too few measurements for good value for photometry.</TD></TR>
    582           <TR><TD>ASTROM_NOCAL</TD>  <TD>0x00000010</TD><TD>16</TD><TD>User-set value used within relastro: ignore (EAM!).</TD></TR>
     582          <TR><TD>ASTROM_NOCAL</TD>  <TD>0x00000010</TD><TD>16</TD><TD>User-set value used within relastro: ignore.</TD></TR>
    583583          <TR><TD>ASTROM_POOR</TD>   <TD>0x00000020</TD><TD>32</TD><TD>Relastro says image is bad (dR,dD > limit).</TD></TR>
    584584          <TR><TD>ASTROM_FAIL</TD>   <TD>0x00000040</TD><TD>64</TD><TD>Relastro fit diverged, fit not applied.</TD></TR>
    585           <TR><TD>ASTROM_SKIP</TD>   <TD>0x00000080</TD><TD>128</TD><TD>External information image has bad astrometry. (EAM)</TD></TR>
     585          <TR><TD>ASTROM_SKIP</TD>   <TD>0x00000080</TD><TD>128</TD><TD>External information image has bad astrometry.</TD></TR>
    586586          <TR><TD>ASTROM_FEW</TD>    <TD>0x00000100</TD><TD>256</TD><TD>Currently too few measurements for good value for astrometry.</TD></TR>
    587587          <TR><TD>PHOTOM_UBERCAL</TD><TD>0x00000200</TD><TD>512</TD><TD>Externally-supplied photometry zero point from ubercal analysis.</TD></TR>
     
    614614          <TR><TD>EXTMODEL</TD>        <TD>0x00000002</TD><TD>2         </TD><TD>Source fitted with an extended-source model.</TD></TR>
    615615          <TR><TD>FITTED</TD>          <TD>0x00000004</TD><TD>4         </TD><TD>Source fitted with non-linear model (PSF or EXT; good or bad).</TD></TR>
    616           <TR><TD>FAIL</TD>            <TD>0x00000008</TD><TD>8         </TD><TD>Fit (non-linear) failed (non-converge, off-edge, run to zero).</TD></TR>
     616          <TR><TD>FAIL</TD>            <TD>0x00000008</TD><TD>8         </TD><TD>Fit (non-linear) failed (non-converge; off-edge; run to zero).</TD></TR>
    617617          <TR><TD>POOR</TD>            <TD>0x00000010</TD><TD>16        </TD><TD>Fit succeeds, but low-S/N, high-Chisq, or large (for PSF -- drop?).</TD></TR>
    618618          <TR><TD>PAIR</TD>            <TD>0x00000020</TD><TD>32        </TD><TD>Source fitted with a double PSF.</TD></TR>
     
    669669          <TR><TD>DIFF_WITH_SINGLE</TD>     <TD>0x00000001</TD><TD>1         </TD><TD>Difference source matched to a single positive detection.</TD></TR>
    670670          <TR><TD>DIFF_WITH_DOUBLE</TD>     <TD>0x00000002</TD><TD>2         </TD><TD>Difference source matched to positive detections in both images.</TD></TR>
    671           <TR><TD>MATCHED</TD>              <TD>0x00000004</TD><TD>4         </TD><TD>source generated based on another image (forced photometry at source location).</TD></TR>
     671          <TR><TD>MATCHED</TD>              <TD>0x00000004</TD><TD>4         </TD><TD>Source generated based on another image (forced photometry at source location).</TD></TR>
    672672          <TR><TD>ON_SPIKE</TD>             <TD>0x00000008</TD><TD>8         </TD><TD>More than 25% of (PSF-weighted) pixels land on diffraction spike.</TD></TR>
    673673          <TR><TD>ON_STARCORE</TD>          <TD>0x00000010</TD><TD>16        </TD><TD>More than 25% of (PSF-weighted) pixels land on starcore.</TD></TR>
     
    715715        <TABLEDATA>
    716716          <TR><TD>DEFAULT</TD>               <TD>0x00000000</TD><TD>0          </TD><TD>Initial value; resets all bits.</TD></TR>
    717           <TR><TD>NOCAL</TD>                 <TD>0x00000001</TD><TD>1          </TD><TD>Detection ignored for this analysis (photcode, time range) -- internal only.</TD></TR>
     717          <TR><TD>NOCAL</TD>                 <TD>0x00000001</TD><TD>1          </TD><TD>Detection ignored for this analysis (photcode; time range) -- internal only.</TD></TR>
    718718          <TR><TD>POOR_PHOTOM</TD>           <TD>0x00000002</TD><TD>2          </TD><TD>Detection is photometry outlier.</TD></TR>                             
    719719          <TR><TD>SKIP_PHOTOM</TD>           <TD>0x00000004</TD><TD>4          </TD><TD>Detection was ignored for photometry measurement.</TD></TR>                     
     
    770770          <TR><TD>FEW</TD>              <TD>0x00000001</TD><TD>1              </TD><TD>Used within relphot; skip star.</TD></TR>
    771771          <TR><TD>POOR</TD>             <TD>0x00000002</TD><TD>2              </TD><TD>Used within relphot; skip star.</TD></TR>
    772           <TR><TD>ICRF_QSO</TD>         <TD>0x00000004</TD><TD>4              </TD><TD>object IDed with known ICRF quasar (may have ICRF position measurement)</TD></TR>
    773           <TR><TD>HERN_QSO_P60</TD>     <TD>0x00000008</TD><TD>8              </TD><TD>identified as likely QSO (Hernitschek et al 2015), P_QSO >= 0.60</TD></TR>
    774           <TR><TD>HERN_QSO_P05</TD>     <TD>0x00000010</TD><TD>16             </TD><TD>identified as possible QSO (Hernitschek et al 2015), P_QSO >= 0.05</TD></TR>
    775           <TR><TD>HERN_RRL_P60</TD>     <TD>0x00000020</TD><TD>32             </TD><TD>identified as likely RR Lyra (Hernitschek et al 2015), P_RRLyra >= 0.60</TD></TR>
    776           <TR><TD>HERN_RRL_P05</TD>     <TD>0x00000040</TD><TD>64             </TD><TD>identified as possible RR Lyra (Hernitschek et al 2015), P_RRLyra >= 0.05</TD></TR>
    777           <TR><TD>HERN_VARIABLE</TD>    <TD>0x00000080</TD><TD>128            </TD><TD>identified as a variable based on ChiSq (Hernitschek et al 2015)</TD></TR>
    778           <TR><TD>TRANSIENT</TD>        <TD>0x00000100</TD><TD>256            </TD><TD>identified as a non-periodic (stationary) transient</TD></TR>
    779           <TR><TD>HAS_SOLSYS_DET</TD>   <TD>0x00000200</TD><TD>512            </TD><TD>at least one detection identified with a known solar-system object (asteroid or other).</TD></TR>
    780           <TR><TD>MOST_SOLSYS_DET</TD>  <TD>0x00000400</TD><TD>1024           </TD><TD>most detections identified with a known solar-system object (asteroid or other).</TD></TR>
    781           <TR><TD>LARGE_PM</TD>         <TD>0x00000800</TD><TD>2048           </TD><TD>star with large proper motion</TD></TR>
    782           <TR><TD>RAW_AVE</TD>          <TD>0x00001000</TD><TD>4096           </TD><TD>simple weighted average position was used (no IRLS fitting)</TD></TR>
    783           <TR><TD>FIT_AVE</TD>          <TD>0x00002000</TD><TD>8192           </TD><TD>average position was fitted</TD></TR>
    784           <TR><TD>FIT_PM</TD>           <TD>0x00004000</TD><TD>16384          </TD><TD>proper motion model was fitted</TD></TR>
    785           <TR><TD>FIT_PAR</TD>          <TD>0x00008000</TD><TD>32768          </TD><TD>parallax model was fitted</TD></TR>
    786           <TR><TD>USE_AVE</TD>          <TD>0x00010000</TD><TD>65536          </TD><TD>average position used (not PM or PAR)</TD></TR>
    787           <TR><TD>USE_PM</TD>           <TD>0x00020000</TD><TD>131072         </TD><TD>proper motion used (not AVE or PAR)</TD></TR>
    788           <TR><TD>USE_PAR</TD>          <TD>0x00040000</TD><TD>262144         </TD><TD>parallax used (not AVE or PM)</TD></TR>
    789           <TR><TD>NO_MEAN_ASTROM</TD>   <TD>0x00080000</TD><TD>524288         </TD><TD>mean astrometry could not be measured</TD></TR>
    790           <TR><TD>STACK_FOR_MEAN</TD>   <TD>0x00100000</TD><TD>1048576        </TD><TD>stack position used for mean astrometry</TD></TR>
    791           <TR><TD>MEAN_FOR_STACK</TD>   <TD>0x00200000</TD><TD>2097152        </TD><TD>mean astrometry used for stack position</TD></TR>
    792           <TR><TD>BAD_PM</TD>           <TD>0x00400000</TD><TD>4194304        </TD><TD>failure to measure proper-motion model</TD></TR>
    793           <TR><TD>EXT</TD>              <TD>0x00800000</TD><TD>8388608        </TD><TD>extended in our data (eg, PS)</TD></TR>
    794           <TR><TD>EXT_ALT</TD>          <TD>0x01000000</TD><TD>16777216       </TD><TD>extended in external data (eg, 2MASS)</TD></TR>
    795           <TR><TD>GOOD</TD>             <TD>0x02000000</TD><TD>33554432       </TD><TD>good-quality measurement in our data (eg,PS)</TD></TR>
    796           <TR><TD>GOOD_ALT</TD>         <TD>0x04000000</TD><TD>67108864       </TD><TD>good-quality measurement in  external data (eg, 2MASS)</TD></TR>
    797           <TR><TD>GOOD_STACK</TD>       <TD>0x08000000</TD><TD>134217728      </TD><TD>good-quality object in the stack (> 1 good stack measurement)</TD></TR>
    798           <TR><TD>BEST_STACK</TD>       <TD>0x10000000</TD><TD>268435456      </TD><TD>the primary stack measurements are the best measurements</TD></TR>
    799           <TR><TD>SUSPECT_STACK</TD>    <TD>0x20000000</TD><TD>536870912      </TD><TD>suspect object in the stack (no more than 1 good measurement, 2 or more suspect or good stack measurement)</TD></TR>
    800           <TR><TD>BAD_STACK</TD>        <TD>0x40000000</TD><TD>1073741824     </TD><TD>poor-quality stack object (no more than 1 good or suspect measurement)</TD></TR>
     772          <TR><TD>ICRF_QSO</TD>         <TD>0x00000004</TD><TD>4              </TD><TD>Object IDed with known ICRF quasar (may have ICRF position measurement)</TD></TR>
     773          <TR><TD>HERN_QSO_P60</TD>     <TD>0x00000008</TD><TD>8              </TD><TD>Identified as likely QSO (Hernitschek et al 2015), P_QSO >= 0.60</TD></TR>
     774          <TR><TD>HERN_QSO_P05</TD>     <TD>0x00000010</TD><TD>16             </TD><TD>Identified as possible QSO (Hernitschek et al 2015), P_QSO >= 0.05</TD></TR>
     775          <TR><TD>HERN_RRL_P60</TD>     <TD>0x00000020</TD><TD>32             </TD><TD>Identified as likely RR Lyra (Hernitschek et al 2015), P_RRLyra >= 0.60</TD></TR>
     776          <TR><TD>HERN_RRL_P05</TD>     <TD>0x00000040</TD><TD>64             </TD><TD>Identified as possible RR Lyra (Hernitschek et al 2015), P_RRLyra >= 0.05</TD></TR>
     777          <TR><TD>HERN_VARIABLE</TD>    <TD>0x00000080</TD><TD>128            </TD><TD>Identified as a variable based on ChiSq? (Hernitschek et al 2015)</TD></TR>
     778          <TR><TD>TRANSIENT</TD>        <TD>0x00000100</TD><TD>256            </TD><TD>Identified as a non-periodic (stationary) transient</TD></TR>
     779          <TR><TD>HAS_SOLSYS_DET</TD>   <TD>0x00000200</TD><TD>512            </TD><TD>At least one detection identified with a known solar-system object (asteroid or other).</TD></TR>
     780          <TR><TD>MOST_SOLSYS_DET</TD>  <TD>0x00000400</TD><TD>1024           </TD><TD>Most detections identified with a known solar-system object (asteroid or other).</TD></TR>
     781          <TR><TD>LARGE_PM</TD>         <TD>0x00000800</TD><TD>2048           </TD><TD>Star with large proper motion</TD></TR>
     782          <TR><TD>RAW_AVE</TD>          <TD>0x00001000</TD><TD>4096           </TD><TD>Simple weighted average position was used (no IRLS fitting)</TD></TR>
     783          <TR><TD>FIT_AVE</TD>          <TD>0x00002000</TD><TD>8192           </TD><TD>Average position was fitted</TD></TR>
     784          <TR><TD>FIT_PM</TD>           <TD>0x00004000</TD><TD>16384          </TD><TD>Proper motion model was fitted</TD></TR>
     785          <TR><TD>FIT_PAR</TD>          <TD>0x00008000</TD><TD>32768          </TD><TD>Parallax model was fitted</TD></TR>
     786          <TR><TD>USE_AVE</TD>          <TD>0x00010000</TD><TD>65536          </TD><TD>Average position used (not PM or PAR)</TD></TR>
     787          <TR><TD>USE_PM</TD>           <TD>0x00020000</TD><TD>131072         </TD><TD>Proper motion used (not AVE or PAR)</TD></TR>
     788          <TR><TD>USE_PAR</TD>          <TD>0x00040000</TD><TD>262144         </TD><TD>Parallax used (not AVE or PM)</TD></TR>
     789          <TR><TD>NO_MEAN_ASTROM</TD>   <TD>0x00080000</TD><TD>524288         </TD><TD>Mean astrometry could not be measured</TD></TR>
     790          <TR><TD>STACK_FOR_MEAN</TD>   <TD>0x00100000</TD><TD>1048576        </TD><TD>Stack position used for mean astrometry</TD></TR>
     791          <TR><TD>MEAN_FOR_STACK</TD>   <TD>0x00200000</TD><TD>2097152        </TD><TD>Mean astrometry used for stack position</TD></TR>
     792          <TR><TD>BAD_PM</TD>           <TD>0x00400000</TD><TD>4194304        </TD><TD>Failure to measure proper-motion model</TD></TR>
     793          <TR><TD>EXT</TD>              <TD>0x00800000</TD><TD>8388608        </TD><TD>Extended in our data (eg; PS)</TD></TR>
     794          <TR><TD>EXT_ALT</TD>          <TD>0x01000000</TD><TD>16777216       </TD><TD>Extended in external data (eg; 2MASS)</TD></TR>
     795          <TR><TD>GOOD</TD>             <TD>0x02000000</TD><TD>33554432       </TD><TD>Good-quality measurement in our data (eg; PS)</TD></TR>
     796          <TR><TD>GOOD_ALT</TD>         <TD>0x04000000</TD><TD>67108864       </TD><TD>Good-quality measurement in  external data (eg; 2MASS)</TD></TR>
     797          <TR><TD>GOOD_STACK</TD>       <TD>0x08000000</TD><TD>134217728      </TD><TD>Good-quality object in the stack (> 1 good stack measurement)</TD></TR>
     798          <TR><TD>BEST_STACK</TD>       <TD>0x10000000</TD><TD>268435456      </TD><TD>The primary stack measurements are the best measurements</TD></TR>
     799          <TR><TD>SUSPECT_STACK</TD>    <TD>0x20000000</TD><TD>536870912      </TD><TD>Suspect object in the stack (no more than 1 good measurement, 2 or more suspect or good stack measurement)</TD></TR>
     800          <TR><TD>BAD_STACK</TD>        <TD>0x40000000</TD><TD>1073741824     </TD><TD>Poor-quality stack object (no more than 1 good or suspect measurement).</TD></TR>
    801801        </TABLEDATA>
    802802      </DATA>
     
    822822        <DATA>
    823823        <TABLEDATA>
    824           <TR><TD>DEFAULT</TD>           <TD>0x00000000</TD><TD>0              </TD><TD>Initial value; resets all bits.</TD></TR>
    825           <TR><TD>SECF_STAR_FEW</TD>     <TD>0x00000001</TD><TD>1              </TD><TD>Used within relphot: skip star.</TD></TR>
    826           <TR><TD>SECF_STAR_POOR</TD>    <TD>0x00000002</TD><TD>2              </TD><TD>Used within relphot: skip star.</TD></TR>
    827           <TR><TD>SECF_USE_SYNTH</TD>    <TD>0x00000004</TD><TD>4              </TD><TD>Synthetic photometry used in average measurement.</TD></TR>
    828           <TR><TD>SECF_USE_UBERCAL</TD>  <TD>0x00000008</TD><TD>8              </TD><TD>Ubercal photometry used in average measurement.</TD></TR>
    829           <TR><TD>SECF_HAS_PS1</TD>      <TD>0x00000010</TD><TD>16             </TD><TD>PS1 photometry used in average measurement.</TD></TR>
    830           <TR><TD>SECF_HAS_PS1_STACK</TD><TD>0x00000020</TD><TD>32             </TD><TD>PS1 stack photometry exists.</TD></TR>
    831 
    832           <TR><TD>SECF_HAS_TYCHO</TD>    <TD>0x00000040</TD><TD>64             </TD><TD>Tycho photometry used for synthetic magnitudes.</TD></TR>
    833           <TR><TD>SECF_FIX_SYNTH</TD>    <TD>0x00000080</TD><TD>128            </TD><TD>Synthetic magnitudes repaired with zeropoint map.</TD></TR>
    834 
    835           <TR><TD>SECF_RANK_0</TD>       <TD>0x00000100</TD><TD>256            </TD><TD>Average magnitude uses only rank 0 detections.</TD></TR>
    836           <TR><TD>SECF_RANK_1</TD>       <TD>0x00000200</TD><TD>512            </TD><TD>Average magnitude uses only rank 1 detections.</TD></TR>
    837           <TR><TD>SECF_RANK_2</TD>       <TD>0x00000400</TD><TD>1024           </TD><TD>Average magnitude uses only rank 2 detections.</TD></TR>
    838           <TR><TD>SECF_RANK_3</TD>       <TD>0x00000800</TD><TD>2048           </TD><TD>Average magnitude uses only rank 3 detections.</TD></TR>
    839           <TR><TD>SECF_RANK_4</TD>       <TD>0x00001000</TD><TD>4096           </TD><TD>Average magnitude uses only rank 4 detections.</TD></TR>
    840           <TR><TD>SECF_STACK_PRIMARY</TD><TD>0x00004000</TD><TD>16384          </TD><TD>PS1 stack photometry comes from primary skycell.</TD></TR>
    841           <TR><TD>SECF_STACK_BESTDET</TD><TD>0x00008000</TD><TD>32768          </TD><TD>PS1 stack best measurement is a detection (not forced).</TD></TR>
    842           <TR><TD>SECF_STACK_PRIMDET</TD><TD>0x00010000</TD><TD>65536          </TD><TD>PS1 stack primary measurement is a detection (not forced).</TD></TR>
    843           <TR><TD>SECF_HAS_SDSS</TD>     <TD>0x00100000</TD><TD>1048576        </TD><TD>This photcode has SDSS photometry (EAM??).</TD></TR>
    844           <TR><TD>SECF_HAS_HSC</TD>      <TD>0x00200000</TD><TD>2097152        </TD><TD>This photcode has HSC  photometry (EAM??).</TD></TR>
    845           <TR><TD>SECF_HAS_CFH</TD>      <TD>0x00400000</TD><TD>4194304        </TD><TD>This photcode has CFH  photometry (mostly Megacam) (EAM??).</TD></TR>
    846           <TR><TD>SECF_HAS_DES</TD>      <TD>0x00800000</TD><TD>8388608        </TD><TD>This photcode has DES  photometry (EAM??).</TD></TR>
    847           <TR><TD>SECF_OBJ_EXT</TD>      <TD>0x01000000</TD><TD>16777216       </TD><TD>Extended in this band.</TD></TR>
     824          <TR><TD>DEFAULT</TD>                    <TD>0x00000000</TD><TD>0              </TD><TD>Initial value; resets all bits.</TD></TR>
     825          <TR><TD>SECF_STAR_FEW</TD>              <TD>0x00000001</TD><TD>1              </TD><TD>Used within relphot: skip star.</TD></TR>
     826          <TR><TD>SECF_STAR_POOR</TD>             <TD>0x00000002</TD><TD>2              </TD><TD>Used within relphot: skip star.</TD></TR>
     827          <TR><TD>SECF_USE_SYNTH</TD>             <TD>0x00000004</TD><TD>4              </TD><TD>Synthetic photometry used in average measurement.</TD></TR>
     828          <TR><TD>SECF_USE_UBERCAL</TD>           <TD>0x00000008</TD><TD>8              </TD><TD>Ubercal photometry used in average measurement.</TD></TR>
     829          <TR><TD>SECF_HAS_PS1</TD>               <TD>0x00000010</TD><TD>16             </TD><TD>PS1 photometry used in average measurement.</TD></TR>
     830          <TR><TD>SECF_HAS_PS1_STACK</TD>         <TD>0x00000020</TD><TD>32             </TD><TD>PS1 stack photometry exists.</TD></TR>
     831
     832          <TR><TD>SECF_HAS_TYCHO</TD>             <TD>0x00000040</TD><TD>64             </TD><TD>Tycho photometry used for synthetic magnitudes.</TD></TR>
     833          <TR><TD>SECF_FIX_SYNTH</TD>             <TD>0x00000080</TD><TD>128            </TD><TD>Synthetic magnitudes repaired with zeropoint map.</TD></TR>
     834
     835          <TR><TD>SECF_RANK_0</TD>                <TD>0x00000100</TD><TD>256            </TD><TD>Average magnitude calculated in 0th pass.</TD></TR>
     836          <TR><TD>SECF_RANK_1</TD>                <TD>0x00000200</TD><TD>512            </TD><TD>Average magnitude calculated in 1st pass.</TD></TR>
     837          <TR><TD>SECF_RANK_2</TD>                <TD>0x00000400</TD><TD>1024           </TD><TD>Average magnitude calculated in 2nd pass.</TD></TR>
     838          <TR><TD>SECF_RANK_3</TD>                <TD>0x00000800</TD><TD>2048           </TD><TD>Average magnitude calculated in 3rd pass.</TD></TR>
     839          <TR><TD>SECF_RANK_4</TD>                <TD>0x00001000</TD><TD>4096           </TD><TD>Average magnitude calculated in 4th pass.</TD></TR>
     840          <TR><TD>SECF_STACK_PRIMARY</TD>         <TD>0x00004000</TD><TD>16384          </TD><TD>PS1 stack photometry includes a primary skycell.</TD></TR>
     841          <TR><TD>SECF_STACK_BESTDET</TD>         <TD>0x00008000</TD><TD>32768          </TD><TD>PS1 stack best measurement is a detection (not forced).</TD></TR>
     842          <TR><TD>SECF_STACK_PRIMDET</TD>         <TD>0x00010000</TD><TD>65536          </TD><TD>PS1 stack primary measurement is a detection (not forced).</TD></TR>
     843          <TR><TD>SECF_STACK_PRIMARY_MULTIPLE</TD><TD>0x00010000</TD><TD>65536          </TD><TD>PS1 stack object has multiple primary measurements.</TD></TR>
     844          <TR><TD>SECF_HAS_SDSS</TD>              <TD>0x00100000</TD><TD>1048576        </TD><TD>This photcode has SDSS photometry.</TD></TR>
     845          <TR><TD>SECF_HAS_HSC</TD>               <TD>0x00200000</TD><TD>2097152        </TD><TD>This photcode has HSC photometry.</TD></TR>
     846          <TR><TD>SECF_HAS_CFH</TD>               <TD>0x00400000</TD><TD>4194304        </TD><TD>This photcode has CFH photometry (mostly Megacam).</TD></TR>
     847          <TR><TD>SECF_HAS_DES</TD>               <TD>0x00800000</TD><TD>8388608        </TD><TD>This photcode has DES photometry.</TD></TR>
     848          <TR><TD>SECF_OBJ_EXT</TD>               <TD>0x01000000</TD><TD>16777216       </TD><TD>Extended in this band.</TD></TR>
    848849        </TABLEDATA>
    849850      </DATA>
     
    869870        <TABLEDATA>
    870871          <TR><TD>DEFAULT</TD>             <TD>0x00000000</TD><TD>0       </TD><TD>Initial value; resets all bits.</TD></TR>
    871           <TR><TD>QF_OBJ_EXT</TD>          <TD>0x00000001</TD><TD>1       </TD><TD>Extended in our data (eg, PS).</TD></TR>
    872           <TR><TD>QF_OBJ_EXT_ALT</TD>      <TD>0x00000002</TD><TD>2       </TD><TD>Extended in external data (eg, 2MASS).</TD></TR>
    873           <TR><TD>QF_OBJ_GOOD</TD>         <TD>0x00000004</TD><TD>4       </TD><TD>Good-quality measurement in our data (eg,PS).</TD></TR>
    874           <TR><TD>QF_OBJ_GOOD_ALT</TD>     <TD>0x00000008</TD><TD>8       </TD><TD>Good-quality measurement in  external data (eg, 2MASS).</TD></TR>
    875           <TR><TD>QF_OBJ_GOOD_STACK</TD>   <TD>0x00000010</TD><TD>16      </TD><TD>good-quality object in the stack (> 1 good stack measurement)</TD></TR>
    876           <TR><TD>QF_OBJ_BEST_STACK</TD>   <TD>0x00000020</TD><TD>32      </TD><TD>the primary stack measurements are the best measurements.</TD></TR>
    877           <TR><TD>QF_OBJ_SUSPECT_STACK</TD><TD>0x00000040</TD><TD>64      </TD><TD>suspect object in the stack (no more than 1 good measurement, 2 or more suspect or good stack measurement).</TD></TR>
    878           <TR><TD>QF_OBJ_BAD_STACK</TD>    <TD>0x00000080</TD><TD>128      </TD><TD>poor-quality stack object (no more than 1 good or suspect measurement).</TD></TR>
     872          <TR><TD>QF_OBJ_EXT</TD>          <TD>0x00000001</TD><TD>1       </TD><TD>Extended in our data (eg; PS).</TD></TR>
     873          <TR><TD>QF_OBJ_EXT_ALT</TD>      <TD>0x00000002</TD><TD>2       </TD><TD>Extended in external data (eg; 2MASS).</TD></TR>
     874          <TR><TD>QF_OBJ_GOOD</TD>         <TD>0x00000004</TD><TD>4       </TD><TD>Good-quality measurement in our data (eg; PS).</TD></TR>
     875          <TR><TD>QF_OBJ_GOOD_ALT</TD>     <TD>0x00000008</TD><TD>8       </TD><TD>Good-quality measurement in  external data (eg; 2MASS).</TD></TR>
     876          <TR><TD>QF_OBJ_GOOD_STACK</TD>   <TD>0x00000010</TD><TD>16      </TD><TD>Good-quality object in the stack (> 1 good stack measurement).</TD></TR>
     877          <TR><TD>QF_OBJ_BEST_STACK</TD>   <TD>0x00000020</TD><TD>32      </TD><TD>The primary stack measurements are the best measurements.</TD></TR>
     878          <TR><TD>QF_OBJ_SUSPECT_STACK</TD><TD>0x00000040</TD><TD>64      </TD><TD>Suspect object in the stack (no more than 1 good measurement, 2 or more suspect or good stack measurement).</TD></TR>
     879          <TR><TD>QF_OBJ_BAD_STACK</TD>    <TD>0x00000080</TD><TD>128      </TD><TD>Poor-quality stack object (no more than 1 good or suspect measurement).</TD></TR>
    879880        </TABLEDATA>
    880881      </DATA>
     
    900901        <TABLEDATA>
    901902          <TR><TD>NO_ERROR</TD>     <TD>0x00000000</TD><TD>0 </TD><TD>No error condition raised.</TD></TR>
    902           <TR><TD>FAIL_FIT</TD>     <TD>0x00000001</TD><TD>1 </TD><TD>fit failed to converge or was degenerate</TD></TR>
    903           <TR><TD>TOO_FEW</TD>      <TD>0x00000002</TD><TD>2 </TD><TD>not enough points to fit the model</TD></TR>
    904           <TR><TD>OUT_OF_RANGE</TD> <TD>0x00000004</TD><TD>4 </TD><TD>fit minimum too far outside data range</TD></TR>
    905           <TR><TD>BAD_ERROR</TD>    <TD>0x00000008</TD><TD>8 </TD><TD>invalid size error (nan or inf)</TD></TR>
     903          <TR><TD>FAIL_FIT</TD>     <TD>0x00000001</TD><TD>1 </TD><TD>Fit failed to converge or was degenerate</TD></TR>
     904          <TR><TD>TOO_FEW</TD>      <TD>0x00000002</TD><TD>2 </TD><TD>Not enough points to fit the model</TD></TR>
     905          <TR><TD>OUT_OF_RANGE</TD> <TD>0x00000004</TD><TD>4 </TD><TD>Fit minimum too far outside data range</TD></TR>
     906          <TR><TD>BAD_ERROR</TD>    <TD>0x00000008</TD><TD>8 </TD><TD>Invalid size error (nan or inf)</TD></TR>
    906907        </TABLEDATA>
    907908      </DATA>
  • branches/czw_branch/20170908/ippToPsps/config/tables.OB.vot

    r39255 r40483  
    99      <PARAM arraysize="1" datatype="char" ucd="meta.bib.author" name="Author" value="PSPS"></PARAM>
    1010      <FIELD name="objName" arraysize="32" datatype="char" unit="dimensionless"  default="NA">
    11         <DESCRIPTION>IAU name for this object.</DESCRIPTION>
    12       </FIELD>
    13       <FIELD name="objPSOName" arraysize="32" datatype="char" unit="dimensionless" default="NA">
    14         <DESCRIPTION>Alternate Pan-STARRS name for this object.</DESCRIPTION>
     11        <DESCRIPTION>IAU-approved name for this object.</DESCRIPTION>
     12      </FIELD>
     13      <FIELD name="objNameHMS" arraysize="32" datatype="char" unit="dimensionless" default="NA">
     14        <DESCRIPTION>Alternate Sexigesimal name for this object.</DESCRIPTION>
    1515      </FIELD>
    1616      <FIELD name="objAltName1" arraysize="32" datatype="char" unit="dimensionless" default="NA">
  • branches/czw_branch/20170908/ippToPsps/config/tables.ST.vot

    r39268 r40483  
    9393      </FIELD>
    9494      <FIELD name="photoZero" arraysize="1" datatype="float" unit="magnitudes" default="-999">
    95         <DESCRIPTION>Locally derived photometric zero point for this stack.</DESCRIPTION>
     95        <DESCRIPTION>Locally derived photometric zero point for this stack (PSF-like measurements only).</DESCRIPTION>
     96      </FIELD>
     97      <FIELD name="photoZeroAperture" arraysize="1" datatype="float" unit="magnitudes" default="-999">
     98        <DESCRIPTION>Locally derived photometric zero point for this stack (Aperture-like measurements only).</DESCRIPTION>
    9699      </FIELD>
    97100      <FIELD name="ctype1" arraysize="100" datatype="char" unit="dimensionless" default="">
     
    231234        <DESCRIPTION>Information flag bitmask indicating details of the g filter stack photometry.  Values listed in DetectionFlags3.</DESCRIPTION>
    232235      </FIELD>
     236      <FIELD name="ginfoFlag4" arraysize="1" datatype="int" unit="dimensionless" default="0">
     237        <DESCRIPTION>Information flag bitmask indicating details of the g filter stack photometry.  Values listed in ObjectFilterFlags.</DESCRIPTION>
     238      </FIELD>
    233239      <FIELD name="gnFrames" arraysize="1" datatype="int" unit="dimensionless" default="-999">
    234240        <DESCRIPTION>Number of input frames/exposures contributing to the g filter stack detection.</DESCRIPTION>
     
    287293        <DESCRIPTION>Information flag bitmask indicating details of the r filter stack photometry.  Values listed in DetectionFlags3.</DESCRIPTION>
    288294      </FIELD>
     295      <FIELD name="rinfoFlag4" arraysize="1" datatype="int" unit="dimensionless" default="0">
     296        <DESCRIPTION>Information flag bitmask indicating details of the r filter stack photometry.  Values listed in ObjectFilterFlags.</DESCRIPTION>
     297      </FIELD>
    289298      <FIELD name="rnFrames" arraysize="1" datatype="int" unit="dimensionless" default="-999">
    290299        <DESCRIPTION>Number of input frames/exposures contributing to the r filter stack detection.</DESCRIPTION>
     
    343352        <DESCRIPTION>Information flag bitmask indicating details of the i filter stack photometry.  Values listed in DetectionFlags3.</DESCRIPTION>
    344353      </FIELD>
     354      <FIELD name="iinfoFlag4" arraysize="1" datatype="int" unit="dimensionless" default="0">
     355        <DESCRIPTION>Information flag bitmask indicating details of the i filter stack photometry.  Values listed in ObjectFilterFlags.</DESCRIPTION>
     356      </FIELD>
    345357      <FIELD name="inFrames" arraysize="1" datatype="int" unit="dimensionless" default="-999">
    346358        <DESCRIPTION>Number of input frames/exposures contributing to the i filter stack detection.</DESCRIPTION>
     
    399411        <DESCRIPTION>Information flag bitmask indicating details of the z filter stack photometry.  Values listed in DetectionFlags3.</DESCRIPTION>
    400412      </FIELD>
     413      <FIELD name="zinfoFlag4" arraysize="1" datatype="int" unit="dimensionless" default="0">
     414        <DESCRIPTION>Information flag bitmask indicating details of the z filter stack photometry.  Values listed in ObjectFilterFlags.</DESCRIPTION>
     415      </FIELD>
    401416      <FIELD name="znFrames" arraysize="1" datatype="int" unit="dimensionless" default="-999">
    402417        <DESCRIPTION>Number of input frames/exposures contributing to the z filter stack detection.</DESCRIPTION>
     
    454469      <FIELD name="yinfoFlag3" arraysize="1" datatype="int" unit="dimensionless" default="0">
    455470        <DESCRIPTION>Information flag bitmask indicating details of the y filter stack photometry.  Values listed in DetectionFlags3.</DESCRIPTION>
     471      </FIELD>
     472      <FIELD name="yinfoFlag4" arraysize="1" datatype="int" unit="dimensionless" default="0">
     473        <DESCRIPTION>Information flag bitmask indicating details of the y filter stack photometry.  Values listed in ObjectFilterFlags.</DESCRIPTION>
    456474      </FIELD>
    457475      <FIELD name="ynFrames" arraysize="1" datatype="int" unit="dimensionless" default="-999">
     
    463481    </TABLE>
    464482
    465     <!-- StackObjectAttributese Table ************************************************** -->
     483    <!-- StackObjectAttributes Table ************************************************** -->
    466484    <TABLE name="StackObjectAttributes">
    467485      <DESCRIPTION>Contains the PSF, Kron (1980), and aperture fluxes for all filters in a single row, along with point-source object shape parameters.  See StackObjectThin table for discussion of primary, secondary, and best detections.  References: Kron, R. G. 1980, ApJS, 43, 305.</DESCRIPTION>
     
    587605      </FIELD>
    588606      <FIELD name="gzp" arraysize="1" datatype="float" unit="magnitudes" default="0">
    589         <DESCRIPTION>Photometric zeropoint for the g filter stack.  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     607        <DESCRIPTION>Photometric zeropoint for the g filter stack (PSF-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     608      </FIELD>
     609      <FIELD name="gzpAPER" arraysize="1" datatype="float" unit="magnitudes" default="0">
     610        <DESCRIPTION>Photometric zeropoint for the g filter stack (APERTURE-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
    590611      </FIELD>
    591612      <FIELD name="gPlateScale" arraysize="1" datatype="float" unit="arcsec/pixel" default="0">
     
    694715      </FIELD>
    695716      <FIELD name="rzp" arraysize="1" datatype="float" unit="magnitudes" default="0">
    696         <DESCRIPTION>Photometric zeropoint for the r filter stack.  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     717        <DESCRIPTION>Photometric zeropoint for the r filter stack (PSF-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     718      </FIELD>
     719      <FIELD name="rzpAPER" arraysize="1" datatype="float" unit="magnitudes" default="0">
     720        <DESCRIPTION>Photometric zeropoint for the r filter stack (APERTURE-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
    697721      </FIELD>
    698722      <FIELD name="rPlateScale" arraysize="1" datatype="float" unit="arcsec/pixel" default="0">
     
    801825      </FIELD>
    802826      <FIELD name="izp" arraysize="1" datatype="float" unit="magnitudes" default="0">
    803         <DESCRIPTION>Photometric zeropoint for the i filter stack.  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     827        <DESCRIPTION>Photometric zeropoint for the i filter stack (PSF-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     828      </FIELD>
     829      <FIELD name="izpAPER" arraysize="1" datatype="float" unit="magnitudes" default="0">
     830        <DESCRIPTION>Photometric zeropoint for the i filter stack (APERTURE-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
    804831      </FIELD>
    805832      <FIELD name="iPlateScale" arraysize="1" datatype="float" unit="arcsec/pixel" default="0">
     
    908935      </FIELD>
    909936      <FIELD name="zzp" arraysize="1" datatype="float" unit="magnitudes" default="0">
    910         <DESCRIPTION>Photometric zeropoint for the z filter stack.  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     937        <DESCRIPTION>Photometric zeropoint for the z filter stack (PSF-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     938      </FIELD>
     939      <FIELD name="zzpAPER" arraysize="1" datatype="float" unit="magnitudes" default="0">
     940        <DESCRIPTION>Photometric zeropoint for the z filter stack (APERTURE-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
    911941      </FIELD>
    912942      <FIELD name="zPlateScale" arraysize="1" datatype="float" unit="arcsec/pixel" default="0">
     
    10151045      </FIELD>
    10161046      <FIELD name="yzp" arraysize="1" datatype="float" unit="magnitudes" default="0">
    1017         <DESCRIPTION>Photometric zeropoint for the y filter stack.  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     1047        <DESCRIPTION>Photometric zeropoint for the y filter stack (PSF-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     1048      </FIELD>
     1049      <FIELD name="yzpAPER" arraysize="1" datatype="float" unit="magnitudes" default="0">
     1050        <DESCRIPTION>Photometric zeropoint for the y filter stack (APERTURE-like magnitudes only).  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
    10181051      </FIELD>
    10191052      <FIELD name="yPlateScale" arraysize="1" datatype="float" unit="arcsec/pixel" default="0">
     
    47904823      </FIELD>
    47914824      <FIELD name="zp" arraysize="1" datatype="float" unit="magnitudes" default="0">
    4792         <DESCRIPTION>Photometric zeropoint.  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
     4825        <DESCRIPTION>Photometric zeropoint of frame/exposure.  Necessary for converting listed fluxes and magnitudes back to measured ADU counts.</DESCRIPTION>
    47934826      </FIELD>
    47944827      <FIELD name="expTime" arraysize="1" datatype="float" unit="seconds" default="-999">
  • branches/czw_branch/20170908/ippToPsps/jython/batch.py

    r39785 r40483  
    6868                raise
    6969        else:
    70             logger.errorPair("missing fits item?", str(id))
     70            logger.errorPair("missing fits item for batch ID" + str(id), "continue")
    7171
    7272        # define the dvo table names
  • branches/czw_branch/20170908/ippToPsps/jython/detectionbatch.py

    r39544 r40483  
    6060       meta = self.gpc1Db.getCameraStageMeta(self.id)
    6161       if not meta:
    62            self.logger.errorPair("Could not get", "camera metadata")
    63            raise
     62           self.logger.infoPair("Could not get camera metadata", "trying with no warp id")
     63           meta = self.gpc1Db.getCameraStageMetaNoWarpID(self.id)
     64           if not meta:
     65               self.logger.errorPair("Could not get camera metadata", "now what?")
     66               raise
     67       
    6468
    6569       # set a flag indicating that we have the new columns added in version 5 of the
     
    8084       self.chipID = meta[6];
    8185       self.warpID = meta[7];
    82 
     86       
     87       
    8388       if not self.analysisVer: self.analysisVer = -999
    8489
     
    815820        sqlLine.group("a.ra",           "b.ra")
    816821        sqlLine.group("a.dec",          "b.dec_")
    817         sqlLine.group("a.zp",           "b.zp")
     822        sqlLine.group("a.zp",           "b.zpPSF")
    818823        sqlLine.group("a.telluricExt",  "b.telluricExt")
    819824        sqlLine.group("a.airmass",      "b.airmass")
    820825        sqlLine.group("a.infoFlag3",    "b.flags")
    821826        sqlLine.group("a.expTime",      "b.expTime")
    822         sqlLine.group("a.psfFlux",      "a.psfFlux     * b.zpFactor")
    823         sqlLine.group("a.psfFluxErr",   "a.psfFluxErr  * b.zpFactor")
    824         sqlLine.group("a.apFlux",       "a.apFlux      * b.zpFactor")
    825         sqlLine.group("a.apFluxErr",    "a.apFluxErr   * b.zpFactor")
    826         sqlLine.group("a.kronFlux",     "a.kronFlux    * b.zpFactor")
    827         sqlLine.group("a.kronFluxErr",  "a.kronFluxErr * b.zpFactor")
    828         sqlLine.group("a.sky",          "a.sky         * b.zpFactor")
    829         sqlLine.group("a.skyErr",       "a.skyErr      * b.zpFactor")
     827        sqlLine.group("a.psfFlux",      "a.psfFlux     * b.zpFactorPSF")
     828        sqlLine.group("a.psfFluxErr",   "a.psfFluxErr  * b.zpFactorPSF")
     829        sqlLine.group("a.apFlux",       "a.apFlux      * b.zpFactorAPER")
     830        sqlLine.group("a.apFluxErr",    "a.apFluxErr   * b.zpFactorAPER")
     831        sqlLine.group("a.kronFlux",     "a.kronFlux    * b.zpFactorAPER")
     832        sqlLine.group("a.kronFluxErr",  "a.kronFluxErr * b.zpFactorAPER")
     833        sqlLine.group("a.sky",          "a.sky         * b.zpFactorAPER")
     834        sqlLine.group("a.skyErr",       "a.skyErr      * b.zpFactorAPER")
    830835
    831836        sql = sqlLine.makeEquals("WHERE a.ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID))
    832837
    833         ## a.psfFlux      = a.psfFlux * 3630.78 * POW(10.0, -0.4*b.zp), \
     838        ## a.psfFlux      = a.psfFlux * 3630.78 * POW(10.0, -0.4*b.zpPSF), \
    834839
    835840        # instrumental flux vs Janskies:
    836         # b.ZP is defined to include the airmass term and zero point offset from relative calibration or ubercal
     841        # b.zpPSF is defined to include the airmass term and zero point offset from relative calibration or ubercal
    837842        # (see dvopsps/src/insert_detections_dvopsps_catalog.c:311
    838843        # mag_AB = -2.5*log(flux_DN/sec) + ZP
  • branches/czw_branch/20170908/ippToPsps/jython/diffbatch.py

    r39322 r40483  
    457457        sqlLine.group("a.raErr",       "b.raErr")   # NOTE: This is supplied above as well, is this needed??
    458458        sqlLine.group("a.decErr",      "b.decErr") # NOTE: This is supplied above as well, is this needed??
    459         sqlLine.group("a.zp",          "b.zp")
     459        sqlLine.group("a.zp",          "b.zpPSF")
    460460        sqlLine.group("a.telluricExt", "b.telluricExt")
    461461        sqlLine.group("a.airmass",     "b.airmass")
     
    633633               a.ra           = b.ra, \
    634634               a.dec          = b.dec_, \
    635                a.zp           = b.zp, \
     635               a.zp           = b.zpPSF, \
    636636               a.telluricExt  = b.telluricExt, \
    637637               a.airmass      = b.airmass, \
    638638               a.expTime      = b.expTime, \
    639639               a.DinfoFlag3   = b.flags  \
    640                a.DpsfFlux     = a.DpsfFlux    * b.zpFactor, \
    641                a.DpsfFluxErr  = a.DpsfFluxErr * b.zpFactor, \
    642                a.apFlux       = a.apFlux      * b.zpFactor, \
    643                a.apFluxErr    = a.apFluxErr   * b.zpFactor, \
    644                a.kronFlux     = a.kronFlux    * b.zpFactor, \
    645                a.kronFluxErr  = a.kronFluxErr * b.zpFactor  \
    646                a.sky          = a.sky         * b.zpFactor, \
    647                a.skyErr       = a.skyErr      * b.zpFactor  \
     640               a.DpsfFlux     = a.DpsfFlux    * b.zpFactorPSF, \
     641               a.DpsfFluxErr  = a.DpsfFluxErr * b.zpFactorPSF, \
     642               a.apFlux       = a.apFlux      * b.zpFactorAPER, \
     643               a.apFluxErr    = a.apFluxErr   * b.zpFactorAPER, \
     644               a.kronFlux     = a.kronFlux    * b.zpFactorAPER, \
     645               a.kronFluxErr  = a.kronFluxErr * b.zpFactorAPER  \
     646               a.sky          = a.sky         * b.zpFactorAPER, \
     647               a.skyErr       = a.skyErr      * b.zpFactorAPER  \
    648648               WHERE a.ippDetectID = b.ippDetectID \
    649649               AND b.imageID = " + str(imageID)
  • branches/czw_branch/20170908/ippToPsps/jython/diffobjectbatch.py

    r39255 r40483  
    265265        sqlLine.group("ra",                "RA_MEAN")
    266266        sqlLine.group("dec_",              "DEC_MEAN")
    267         sqlLine.group("diffObjName",       "IAU_NAME")
    268         sqlLine.group("diffObjPSOName",    "PSO_NAME")
     267        sqlLine.group("diffObjName",       "PSO_NAME")
     268        sqlLine.group("diffObjNameHMS",    "PSX_NAME")
    269269        sqlLine.group("nDetections",       "'0'")
    270270        sql = sqlLine.makeRaw(") SELECT ", " FROM " + cptTableName)
  • branches/czw_branch/20170908/ippToPsps/jython/dvo.py

    r40011 r40483  
    101101
    102102        if not self.loadImages():
     103            self.logger.debugPair("FAILED to load images", "exiting")
    103104            os._exit(1)
    104105
     106        print "DONE load images (resetAllTables)"
    105107
    106108    '''
     
    145147        self.logger.infoPair("DVO Images.dat file", "NOT up-to-date")
    146148
     149        # check on the format:
     150        try:
     151            imagesHeaderPHU = self.readFitsHeader("PHU", path)
     152        except Exception,e:
     153            # print the error, wait a few secs then try again
     154            print str(e)
     155            self.logger.infoPair("Failed to find PHU for Images.dat", path)
     156            raise
     157
     158        if "FORMAT" in imagesHeaderPHU:
     159            fileFormat = imagesHeaderPHU["FORMAT"]
     160        else:
     161            self.logger.infoPair("Missing FORMAT for Images.dat", path)
     162            raise
     163
     164        self.logger.infoPair("got FORMAT for Images.dat", fileFormat)
     165
     166        if not (fileFormat == "PS1_V6"):
     167            self.logger.infoPair("Invalid FORMAT for Images.dat (PS1_V6)", fileFormat)
     168            return False
     169
    147170        self.importFits(
    148171                path,
    149                 "SOURCE_ID IMAGE_ID EXTERN_ID FLAGS MCAL SECZ PHOTCODE XPIX_SYS_ERR YPIX_SYS_ERR N_FIT_ASTROM MAG_SYS_ERR N_FIT_PHOTOM",
     172                "SOURCE_ID IMAGE_ID EXTERN_ID FLAGS MCAL_PSF MCAL_APER SECZ PHOTCODE XPIX_SYS_ERR YPIX_SYS_ERR N_FIT_ASTROM MAG_SYS_ERR N_FIT_PHOTOM",
    150173                self.scratchDb.dvoImagesTable)
    151174        self.logger.infoPair("Adding primary key to", self.scratchDb.dvoImagesTable)
     
    559582          self.logger.debugPair("Reading IPP table", table.name)
    560583          table = stilts.tpipe(table, cmd='explodeall')
    561           #adds an index to all the tables
    562        #   table = stilts.tpipe(table, cmd='addcol table_index $0')
     584
     585          # adds an index to all the tables
     586          # table = stilts.tpipe(table, cmd='addcol table_index $0')
    563587
    564588          # IPP FITS files are littered with infinity values. Remove them
     
    566590          table = stilts.tpipe(table, cmd='replaceval -Infinity null *')
    567591          table = stilts.tpipe(table, cmd='replaceval Infinity null *')
     592
     593          # verify that all columns in 'columns' exist in the tabl
     594          ## myColumns = table.columns()
     595          ## for wcol in columns:
     596          ##     foundCol = False
     597          ##     for tcol in myColumns:
     598          ##         if (wcol == tcol.name):
     599          ##             print "found wcol " + wcol
     600          ##             foundCol = True;
     601          ##             break
     602          ##     if not foundCol:
    568603
    569604          attempts = 0
     
    575610                  table.cmd_keepcols(columns).write(self.scratchDb.url + '#' + tableName)
    576611                  break
    577               except:
    578                   # wait a few secs then try again
     612              except Exception,e:
     613                  # print the error, wait a few secs then try again
     614                  print str(e)
    579615                  time.sleep(2)
    580616                  attempts = attempts + 1
     
    663699
    664700    '''
     701    Find and read a header extension.
     702    '''
     703    def readFitsHeader(self, extname, filename):
     704
     705        cmd = "fhead -n %s %s" % (extname, filename)
     706        p = Popen(cmd, shell=True, stdout=PIPE)
     707        output = p.communicate()[0]       
     708
     709        header = {}
     710
     711        # split the output header bytes into key/value pairs for each 80-byte line
     712        for i in range(0, len(output), 80):
     713            # print "line %d : %s" % (i, output[i:i+80])
     714            record = output[i:i+80]
     715
     716            match = re.match('^(HIERARCH )*([a-zA-Z0-9-_\.]+)\s*=\s+\'*([a-zA-Z0-9-+_\.:\s@#\(\)\,]+)\'*\\/*', record)
     717
     718            if match:
     719                param = match.group(2)
     720                value = match.group(3).strip()
     721                if value == "NaN": value = "NULL"
     722                header[param] = value
     723
     724        return header
     725
     726    '''
    665727    ingest skyregion into MySQL database using the native DVO program dvopsps
    666728    Populates dvoDetections and dvoDone with FITS tables from DVO for the defined sky area, this
     
    688750
    689751        # make sure we have an up-to-date Images table
    690         self.loadImages() # this is in nativeIngestDetections (remove?)
     752        if not self.loadImages(): # this is in nativeIngestDetections (remove?)
     753            self.logger.debugPair("FAILED to load images", "exiting")
     754            os._exit(1)
     755
     756        print "DONE load images (nativeIngestDetections)"
    691757
    692758        # the box dimensions are the area used to select the items of
  • branches/czw_branch/20170908/ippToPsps/jython/dvodetections.py

    r39007 r40483  
    2424       
    2525        super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db)
     26
    2627        print "----- DvoDetections is not used, is it?? -----"
    2728        os._exit(1)
  • branches/czw_branch/20170908/ippToPsps/jython/dvodiffdetections.py

    r38883 r40483  
    1414'''
    1515A class for ingesting DVO detections into MySQL
     16XXX EAM 20151029 : I do not believe this class is used at all.  I am poisoning it with an exit
    1617'''
    1718class DvoDetections(Dvo):
     
    2526        super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db)
    2627#       super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb)
     28
     29        print "----- DvoDetections is not used, is it?? -----"
     30        os._exit(1)
    2731
    2832        # declare DVO file types of interest
  • branches/czw_branch/20170908/ippToPsps/jython/dvoforcedobjects.py

    r39008 r40483  
    4848        cmd += " -cpt " + region
    4949
     50        if self.config.test:
     51            cmd += " -test-mode"
     52
    5053        if self.skychunk.parallel:
    5154            if self.scratchDb.dbHost == "localhost":
  • branches/czw_branch/20170908/ippToPsps/jython/forcedwarpbatch.py

    r40011 r40483  
    424424        # self.selectDvoObjIDs()
    425425        self.logger.infoPair("inserting dvo info: find imageID", "from externID")
    426         imageID = self.scratchDb.getImageIDFromExternIDandPhotcodeRange(self.warpSkyFileID[num],12000,12500)
    427         self.logger.infoPair("I don't like this", "it is hardwired to gpc1")
     426
     427        # get the imageID: this code has cases for simtest vs gpc1 cameras
     428        # if self.config.test:
     429        self.logger.infoPair("current camera is", self.config.camera)
     430        if self.config.camera == "gpc1":
     431            self.logger.infoPair("I don't like this", "it is hardwired to gpc1")
     432            imageID = self.scratchDb.getImageIDFromExternIDandPhotcodeRange(self.warpSkyFileID[num],12000,12500)
     433        if self.config.camera == "simtest":
     434            imageID = self.scratchDb.getImageIDFromExternIDandPhotcodeRange(self.warpSkyFileID[num],15100,15500)
     435        if imageID == 0:
     436            self.logger.infoPair ("failed to get imageID for", str(num))
     437            raise
     438
    428439        self.logger.infoPair("updating", pspsTableName)
    429440
     
    433444        sqlLine.group("a.ippObjID",   "b.ippObjID")
    434445        sqlLine.group("a.dvoRegionID","b.catID")
    435         sqlLine.group("a.zp",         "b.zp")
     446        sqlLine.group("a.zp",         "b.zpPSF")
    436447        sqlLine.group("a.telluricExt","b.telluricExt")
    437448        sqlLine.group("a.airmass",    "b.airmass")
    438449        sqlLine.group("a.FinfoFlag3", "b.flags")
    439450
    440         sqlLine.group("a.FpsfFlux",     "a.FpsfFlux     * b.zpFactor")
    441         sqlLine.group("a.FpsfFluxErr",  "a.FpsfFluxErr  * b.zpFactor")
    442         sqlLine.group("a.FapFlux",      "a.FapFlux      * b.zpFactor")
    443         sqlLine.group("a.FapFluxErr",   "a.FapFluxErr   * b.zpFactor")
    444         sqlLine.group("a.FkronFlux",    "a.FkronFlux    * b.zpFactor")
    445         sqlLine.group("a.FkronFluxErr", "a.FkronFluxErr * b.zpFactor")
    446         sqlLine.group("a.Fsky",         "a.Fsky         * b.zpFactor")
    447         sqlLine.group("a.FskyErr",      "a.FskyErr      * b.zpFactor")
     451        sqlLine.group("a.FpsfFlux",     "a.FpsfFlux     * b.zpFactorPSF")
     452        sqlLine.group("a.FpsfFluxErr",  "a.FpsfFluxErr  * b.zpFactorPSF")
     453        sqlLine.group("a.FapFlux",      "a.FapFlux      * b.zpFactorAPER")
     454        sqlLine.group("a.FapFluxErr",   "a.FapFluxErr   * b.zpFactorAPER")
     455        sqlLine.group("a.FkronFlux",    "a.FkronFlux    * b.zpFactorAPER")
     456        sqlLine.group("a.FkronFluxErr", "a.FkronFluxErr * b.zpFactorAPER")
     457        sqlLine.group("a.Fsky",         "a.Fsky         * b.zpFactorAPER")
     458        sqlLine.group("a.FskyErr",      "a.FskyErr      * b.zpFactorAPER")
    448459
    449460        sql = sqlLine.makeEquals("WHERE a.ippDetectID = b.ippDetectID AND b.imageID = " +str( imageID))
     
    457468        self.logger.infoPair("row count of ForcedWarpMeasurement after cull of null objID ", rowCountAfter)
    458469        if rowCountAfter == 0:
    459             self.skipBatch = True
    460             self.logger.infoPair ("skip this batch", "it is bad")
    461             return False
     470            if self.haveLensPSF[num] ==0:
     471                self.logger.infoPair("skipping this table", "no lenspsf and no dvo, run this:")
     472                self.logger.infoPair("update addRun join addProcessedExp using (add_id) set fault = 43 where add_id = ",str(self.number[num]))
     473                self.skipBatch = True
     474                return False
     475            else:   
     476                self.skipBatch = True
     477                self.logger.infoPair ("skip this batch", "it is bad")
     478                return False
     479
     480
    462481
    463482        self.logger.infoPair("Adding 'row' columns to", pspsTableName)
     
    557576
    558577        sqlLine = sqlUtility("UPDATE " + pspsTableName + " as a, " + self.scratchDb.dvoDetectionTable + " as b SET ")
    559         sqlLine.group("a.flxR5",     "a.flxR5     * b.zpFactor")
    560         sqlLine.group("a.flxR5Err",  "a.flxR5Err  * b.zpFactor")
    561         sqlLine.group("a.flxR5Std",  "a.flxR5Std  * b.zpFactor")
    562 
    563         sqlLine.group("a.flxR6",     "a.flxR6     * b.zpFactor")
    564         sqlLine.group("a.flxR6Err",  "a.flxR6Err  * b.zpFactor")
    565         sqlLine.group("a.flxR6Std",  "a.flxR6Std  * b.zpFactor")
    566 
    567         sqlLine.group("a.flxR7",     "a.flxR7     * b.zpFactor")
    568         sqlLine.group("a.flxR7Err",  "a.flxR7Err  * b.zpFactor")
    569         sqlLine.group("a.flxR7Std",  "a.flxR7Std  * b.zpFactor")
     578        sqlLine.group("a.flxR5",     "a.flxR5     * b.zpFactorAPER")
     579        sqlLine.group("a.flxR5Err",  "a.flxR5Err  * b.zpFactorAPER")
     580        sqlLine.group("a.flxR5Std",  "a.flxR5Std  * b.zpFactorAPER")
     581
     582        sqlLine.group("a.flxR6",     "a.flxR6     * b.zpFactorAPER")
     583        sqlLine.group("a.flxR6Err",  "a.flxR6Err  * b.zpFactorAPER")
     584        sqlLine.group("a.flxR6Std",  "a.flxR6Std  * b.zpFactorAPER")
     585
     586        sqlLine.group("a.flxR7",     "a.flxR7     * b.zpFactorAPER")
     587        sqlLine.group("a.flxR7Err",  "a.flxR7Err  * b.zpFactorAPER")
     588        sqlLine.group("a.flxR7Std",  "a.flxR7Std  * b.zpFactorAPER")
    570589
    571590        sql = sqlLine.makeEquals("WHERE a.ippDetectID = b.ippDetectID AND b.imageID = " +str( imageID))
     
    657676        # each of the "populate*" methods below add their tables to the list:
    658677        self.tablesToExport=[]
     678        tables = [] # list of tables to calculate min/max objid on...
    659679   
    660680        for num in self.number:   
     
    671691            self.logger.infoPair("Populating", myTable)
    672692            if not self.populateForcedWarpMeasurement(num):
    673                 self.logger.infoPair ("skippping ForcedWarpMeasurement", str(num))
     693                self.logger.infoPair ("failed on ForcedWarpMeasurement", str(num))
    674694                #continue
    675695                raise
    676696            self.tablesToExport.append(myTable)
    677 
    678             self.logger.infoPair("setting min/max objid from", myTable)
    679             self.setMinMaxObjID([myTable])
     697            tables.append(myTable)
     698            #self.logger.infoPair("setting min/max objid from", myTable)
     699 
     700            #self.setMinMaxObjID([myTable])
    680701
    681702            # populateForcedWarpMeasurement also populates ForcedWarpMasked (from ForcedWarpMeasurement)
     
    697718            self.populateForcedWarpToImage(num)
    698719            self.tablesToExport.append(myTable)
     720        self.logger.infoPair("setting min/max objid from", "all the fw tables")
     721        self.setMinMaxObjID(tables)
     722        self.logger.infoPair("finishing","populatePspsTables")
     723
    699724           
    700             self.logger.infoPair("finishing","populatePspsTables")
    701 
    702725
    703726        return True
     
    762785            self.haveLensPSF[num] = 0
    763786            self.haveLensing[num] = 0
     787
    764788            for table in tables:
    765789                # check for AP_NPIX columns: missing for SAS39
  • branches/czw_branch/20170908/ippToPsps/jython/gpc1db.py

    r40011 r40483  
    511511            files = glob.glob(pathBase + ".cmf")
    512512
     513        if len(files) < 1:
     514            self.logger.errorPair("No files found for forced warp path", pathBase)
     515            return None
    513516       
    514         if len(files) < 1: return None
    515517        fits = Fits(self.logger, self.config, files[0])
    516518        self.logger.infoPair("cmf file",files[0])
     
    760762
    761763        meta = []
     764       
     765
    762766        sql = "SELECT exp_id, exp_name, camRun.dist_group, camRun.software_ver, rawExp.bg, rawExp.bg_stdev, chip_id, warp_id \
    763767               FROM camRun \
     
    773777            rs.first()
    774778        except:
    775             self.logger.errorPair("Can't query for", "camera meta data")
    776 
     779                self.logger.errorPair("Can't query for", "camera meta data")
    777780        try:
    778781            meta.append(rs.getInt(1))
     
    786789        except:
    787790            self.logger.errorPair("getCameraStageMeta()", "empty meta data")
    788 
    789791        return meta
     792
     793    def getCameraStageMetaNoWarpID(self, camID):
     794
     795        self.logger.debug("Querying GPC1 for camera meta data")
     796
     797        meta = []
     798       
     799
     800        sql = "SELECT exp_id, exp_name, camRun.dist_group, camRun.software_ver, rawExp.bg, rawExp.bg_stdev, chip_id, -999 \
     801               FROM camRun \
     802               JOIN chipRun USING(chip_id) \
     803               JOIN rawExp USING(exp_id) \
     804               LEFT JOIN fakeRun USING(cam_id) \
     805               LEFT JOIN warpRun USING(fake_id) \
     806               WHERE camRun.cam_id = %d" % camID
     807
     808        try:
     809            rs = self.executeQuery(sql)
     810            rs.first()
     811        except:
     812                self.logger.errorPair("Can't query for", "camera meta data")
     813        try:
     814            meta.append(rs.getInt(1))
     815            meta.append(rs.getString(2))
     816            meta.append(rs.getString(3))
     817            meta.append(rs.getString(4))
     818            meta.append(rs.getString(5))
     819            meta.append(rs.getString(6))
     820            meta.append(rs.getInt(7))
     821            meta.append(rs.getInt(8))
     822        except:
     823            self.logger.errorPair("getCameraStageMeta()", "empty meta data")
     824
     825        return meta
     826
     827
     828
    790829
    791830    '''
     
    818857        files = []
    819858
    820 
    821859        #there are a couple of states for smfversion
    822860
     
    829867        #    use (file).smf if camRun.state = 'full' and if there is only a .smf
    830868        #    fault out if camRun.state != 'full' -- that is a race condition we don't want.
    831        
    832869       
    833870        if (smfversion == "not_reproc") or (smfversion == "use_new"):
     
    904941
    905942        self.logger.infoPair("smf files:", files)
    906         if len(files) < 1: return None
     943        if len(files) < 1:
     944            self.logger.errorPair("No files found for cam path", path)
     945            return None
    907946
    908947        return Fits(self.logger, self.config, files[0]) # TODO just returning first file - check
     
    9741013
    9751014        # print "stack cmf files:", files
    976         if len(files) < 1: return None
     1015        if len(files) < 1:
     1016            self.logger.errorPair("No files found for stack path", pathBase)
     1017            return None
    9771018
    9781019        # if we get here, then the cmf is readable, now check the stack_id
  • branches/czw_branch/20170908/ippToPsps/jython/ippjytest

    r39304 r40483  
    1414set JARDIR = $datadir/jar
    1515set JYDIR = $datadir/jython
    16 # set JYDIR = .
     16set JYDIR = .
    1717
    1818setenv IPPTOPSPS_DATA $datadir/ipptopsps
  • branches/czw_branch/20170908/ippToPsps/jython/ipptopspsdb.py

    r39786 r40483  
    2727        self.skychunk = skychunk
    2828
    29         self.MAX_FAILS = 5
     29        self.MAX_FAILS = 15
    3030
    3131    '''
  • branches/czw_branch/20170908/ippToPsps/jython/objectbatch.py

    r39661 r40483  
    312312        sqlLine.group("raMean",          "RA_MEAN")
    313313        sqlLine.group("decMean",         "DEC_MEAN")
    314         sqlLine.group("objName",         "IAU_NAME")
    315         sqlLine.group("objPSOName",      "PSO_NAME")
     314        sqlLine.group("objName",         "PSO_NAME")
     315        sqlLine.group("objNameHMS",      "PSX_NAME")
    316316        sqlLine.group("epochMean",       "EPOCH_MEAN")
    317317        sqlLine.group("raMeanErr",       "RA_ERR")
  • branches/czw_branch/20170908/ippToPsps/jython/queue.py

    r39785 r40483  
    134134                    #if (dec > 85): raise
    135135                    # this may be a problem for poles # HAF XXX
    136                     if (dec > 90): raise
     136                    ####if (dec > 90): raise
    137137                    # print "dec, dD: ", dec, dD ,self.skychunk.maxDec
    138138
     
    178178                        dec = dec + 2*dD
    179179                        #if (dec > 85): raise
    180                         if (dec > 90): raise
     180                        ###if (dec > 90): raise
    181181                       #dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
    182182                        dR = 0.5*self.skychunk.boxSize
  • branches/czw_branch/20170908/ippToPsps/jython/scratchdb.py

    r40011 r40483  
    271271        zeroPoint = -999
    272272
    273         sql = "SELECT MCAL, SECZ, C_LAM, K FROM %s AS a JOIN %s as b WHERE EXTERN_ID = %s AND a.PHOTCODE = b.CODE" % (self.dvoImagesTable, self.dvoPhotcodesTable, (externID))
     273        # MCAL_PSF, MCAL_APER, SECZ are from dvoImagesTabl
     274        # C_LAM, K are from dvoPhotcodeTable
     275        sql = "SELECT MCAL_PSF, SECZ, C_LAM, K FROM %s AS a JOIN %s as b WHERE EXTERN_ID = %s AND a.PHOTCODE = b.CODE" % (self.dvoImagesTable, self.dvoPhotcodesTable, (externID))
    274276        rs = self.executeQuery(sql) 
    275277        if not rs:
     
    288290        zeroPoint = 0.001*Clam + Klam*(airmass - 1.0) - Mcal
    289291        return zeroPoint
     292
     293    '''
     294    Gets zero point for image (PSF and APER)
     295    '''
     296    def getStackZeroPoint(self, externID):
     297
     298        zeroPointPSF  = -999
     299        zeroPointAPER = -999
     300
     301        # MCAL_PSF, MCAL_APER, SECZ are from dvoImagesTabl
     302        # C_LAM, K are from dvoPhotcodeTable
     303        sql = "SELECT MCAL_PSF, MCAL_APER, SECZ, C_LAM, K FROM %s AS a JOIN %s as b WHERE EXTERN_ID = %s AND a.PHOTCODE = b.CODE" % (self.dvoImagesTable, self.dvoPhotcodesTable, (externID))
     304        rs = self.executeQuery(sql) 
     305        if not rs:
     306            print "missing result set for imageID query"
     307            os._exit(2)
     308
     309        if not rs.first():
     310            self.logger.infoPair("no zero point; image is missing, externID: ", externID)
     311            return zeroPoint
     312           
     313        McalPSF  = rs.getFloat(1)
     314        McalAPER = rs.getFloat(2)
     315        airmass  = rs.getFloat(3)
     316        Clam     = rs.getFloat(4)
     317        Klam     = rs.getFloat(5)
     318
     319        zeroPointPSF  = 0.001*Clam + Klam*(airmass - 1.0) - McalPSF
     320        zeroPointAPER = 0.001*Clam + Klam*(airmass - 1.0) - McalAPER
     321        return (zeroPointPSF, zeroPointAPER)
    290322
    291323    '''
     
    576608               EXTERN_ID INT, \
    577609               FLAGS INT, \
    578                MCAL FLOAT, \
     610               MCAL_PSF FLOAT, \
     611               MCAL_APER FLOAT, \
    579612               SECZ FLOAT, \
    580613               PHOTCODE SMALLINT, \
     
    607640               raErr FLOAT, \
    608641               decErr FLOAT, \
    609                zp FLOAT, \
    610                zpFactor FLOAT, \
     642               zpPSF FLOAT, \
     643               zpFactorPSF FLOAT, \
     644               zpAPER FLOAT, \
     645               zpFactorAPER FLOAT, \
    611646               telluricExt FLOAT, \
    612647               airmass FLOAT, \
     
    620655               flags INT, \
    621656               objflags INT, \
     657               filtflags INT, \
    622658               PRIMARY KEY (imageID, ippDetectID), \
    623659               KEY (objID, detectID), \
  • branches/czw_branch/20170908/ippToPsps/jython/stackbatch.py

    r39764 r40483  
    307307
    308308        # zp correction should comes from DVO (unless image is not in DVO)
    309         zpImage = self.scratchDb.getImageZeroPoint(stackID)
    310 
    311         if (zpImage == "NULL"):
    312             zpImage = zp
     309        (zpImagePSF, zpImageAPER) = self.scratchDb.getStackZeroPoint(stackID)
     310
     311        # zp is the value in the header, zpImage includes the McalPSF value from DVO
     312        if (zpImagePSF  == "NULL"): zpImagePSF  = zp
     313        if (zpImageAPER == "NULL"): zpImageAPER = zpImagePSF
    313314
    314315        detectionThreshold = "NULL"
    315         if (magref != "NULL") and (zpImage != "NULL") and (expTime != "NULL"):
    316             detectionThreshold = magref + zpImage + 2.5 * math.log10(expTime)
     316        if (magref != "NULL") and (zpImagePSF != "NULL") and (expTime != "NULL"):
     317            detectionThreshold = magref + zpImagePSF + 2.5 * math.log10(expTime)
    317318
    318319        # insert stack metadata into table
     
    340341#       sqlLine.group("psfFwhm_max",        fwhm_maj_uq)
    341342        sqlLine.group("astroScat",          astroscat)
    342         sqlLine.group("photoZero",          zpImage)
     343        sqlLine.group("photoZero",          zpImagePSF)
     344        sqlLine.group("photoZeroAperture",  zpImageAPER)
    343345        sqlLine.group("photoScat",          zpErr)
    344346        sqlLine.group("nAstroRef",          header['NASTRO'])
     
    429431            sqlLine.group("a."+filter+"Epoch",         str(stackEpoch))
    430432
    431             sqlLine.group("a."+filter+"PSFMag",        "b.Mpsf")
     433            # the Mag values below are set in dvopsps/insert_detections_dvopsps_catalog.c using either zpPSF (PSFMag) or zpAPER (KronMag, ApMag)
     434            sqlLine.group("a."+filter+"PSFMag",        "b.Mpsf")
    432435            sqlLine.group("a."+filter+"PSFMagErr",     "b.dMpsf")
    433436            sqlLine.group("a."+filter+"KronMag",       "b.Mkron")
     
    440443         
    441444            sqlLine.group("a."+filter+"infoFlag3",     "b.flags")
     445            sqlLine.group("a."+filter+"infoFlag4",     "b.filtflags")
    442446            sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID))
    443447
     
    557561            sqlLine = sqlUtility("UPDATE " + tablename + " AS a, " + self.scratchDb.dvoDetectionTable + " as b SET")
    558562            sqlLine.group("a."+filter+"expTime",       "b.expTime")
    559             sqlLine.group("a."+filter+"zp",            "b.zp")
    560             sqlLine.group("a."+filter+"PSFFlux",       "a."+filter+"PSFFlux     * b.zpFactor")
    561             sqlLine.group("a."+filter+"PSFFluxErr",    "a."+filter+"PSFFluxErr  * b.zpFactor")
    562             sqlLine.group("a."+filter+"ApFlux",        "a."+filter+"ApFlux      * b.zpFactor")
    563             sqlLine.group("a."+filter+"ApFluxErr",     "a."+filter+"ApFluxErr   * b.zpFactor")
    564             sqlLine.group("a."+filter+"KronFlux",      "a."+filter+"KronFlux    * b.zpFactor")
    565             sqlLine.group("a."+filter+"KronFluxErr",   "a."+filter+"KronFluxErr * b.zpFactor")
    566 
    567             sqlLine.group("a."+filter+"sky",           "a."+filter+"sky         * b.zpFactor")
    568             sqlLine.group("a."+filter+"skyErr",        "a."+filter+"skyErr      * b.zpFactor")
     563            sqlLine.group("a."+filter+"zp",            "b.zpPSF")
     564            sqlLine.group("a."+filter+"zpAPER",        "b.zpAPER")
     565            sqlLine.group("a."+filter+"PSFFlux",       "a."+filter+"PSFFlux     * b.zpFactorPSF")
     566            sqlLine.group("a."+filter+"PSFFluxErr",    "a."+filter+"PSFFluxErr  * b.zpFactorPSF")
     567            sqlLine.group("a."+filter+"ApFlux",        "a."+filter+"ApFlux      * b.zpFactorAPER")
     568            sqlLine.group("a."+filter+"ApFluxErr",     "a."+filter+"ApFluxErr   * b.zpFactorAPER")
     569            sqlLine.group("a."+filter+"KronFlux",      "a."+filter+"KronFlux    * b.zpFactorAPER")
     570            sqlLine.group("a."+filter+"KronFluxErr",   "a."+filter+"KronFluxErr * b.zpFactorAPER")
     571
     572            sqlLine.group("a."+filter+"sky",           "a."+filter+"sky         * b.zpFactorAPER")
     573            sqlLine.group("a."+filter+"skyErr",        "a."+filter+"skyErr      * b.zpFactorAPER")
    569574
    570575            # where should these go?
     
    700705        imageID = self.imageIDs[filter]
    701706        self.logger.infoPair("selecting imageID", imageID)
     707
     708        # NOTE: for model magnitudes, we use zpPSF not zpAPER since they are PSF-matched
     709        # (maybe that is the wrong solution?)
    702710
    703711        # model calibrated magnitude = instrumental magnitude + 2.5*log10(exptime) + ZP (added below from dvoDetectionTable)
     
    765773        sqlLine = sqlUtility("UPDATE " + tablename + " AS a, " + self.scratchDb.dvoDetectionTable + " as b SET")
    766774
    767         sqlLine.group("a." + filter + model + "Mag",       "a." + filter + model + "Mag       + b.zp")
     775        sqlLine.group("a." + filter + model + "Mag",       "a." + filter + model + "Mag       + b.zpPSF")
    768776
    769777        sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID))
     
    884892        # PETRO_MAG is instrumental + 2.5log(exptime) + FPA.ZP
    885893        # we want to apply the DVO zero point, so remove FPA.ZP:
    886         ## XXX is this statement true: is FPA.ZP + 2.5log(exptime) applied to PETRO_MAG?
    887894
    888895        hdrZP   = str(self.zpImage[filter])
     
    897904        sqlLine.group("a."+filter+"haveData",         "'1'")
    898905
    899         sqlLine.group("a." + filter + "petMag",       "b.PETRO_MAG - " + hdrZP)  
     906        sqlLine.group("a." + filter + "petMag",       "b.PETRO_MAG - " + hdrZP) # note that this is **subtracting** the hdrZP (zpAPER is added in below)
    900907        sqlLine.group("a." + filter + "petMagErr",    "1.0 / b.PETRO_MAG_ERR")  # still inverted? (yes)
    901908
     
    913920        # modify petMag to apply the zero point
    914921        sqlLine = sqlUtility("UPDATE " + tablename + " AS a, " + self.scratchDb.dvoDetectionTable + " as b SET")
    915         sqlLine.group("a." + filter + "petMag",       "a." + filter + "petMag    + b.zp")
     922        sqlLine.group("a." + filter + "petMag",       "a." + filter + "petMag    + b.zpAPER")
    916923        sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID))
    917924
     
    10191026        # care of this, but does not?
    10201027
    1021         sqlLine = sqlUtility("UPDATE " + tablename + " SET")
    1022         for radius in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
    1023             if radius < minRadius: continue
    1024             if radius > maxRadius: continue
    1025             pspsRadius = radius + 2
    1026             sqlLine.group(filter + prefix + "flxR" + str(pspsRadius),          "-999")
    1027             sqlLine.group(filter + prefix + "flxR" + str(pspsRadius) + "Err",  "-999")
    1028             sqlLine.group(filter + prefix + "flxR" + str(pspsRadius) + "Std",  "-999")
    1029             sqlLine.group(filter + prefix + "flxR" + str(pspsRadius) + "Fill", "-999")
    1030 
    1031         sql = sqlLine.makeEquals("")
    1032        
    1033         try: self.scratchDb.execute(sql)
    1034         except:
    1035             self.logger.errorPair('failed sql',sql)
    1036             raise
     1028        # chopping this out to see if it still works
     1029
     1030        #sqlLine = sqlUtility("UPDATE " + tablename + " SET")
     1031        #for radius in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
     1032        #    if radius < minRadius: continue
     1033        #    if radius > maxRadius: continue
     1034        #    pspsRadius = radius + 2
     1035        #    sqlLine.group(filter + prefix + "flxR" + str(pspsRadius),          "-999")
     1036        #    sqlLine.group(filter + prefix + "flxR" + str(pspsRadius) + "Err",  "-999")
     1037        #    sqlLine.group(filter + prefix + "flxR" + str(pspsRadius) + "Std",  "-999")
     1038        #    sqlLine.group(filter + prefix + "flxR" + str(pspsRadius) + "Fill", "-999")#
     1039
     1040        #sql = sqlLine.makeEquals("")
     1041         
     1042        #        try: self.scratchDb.execute(sql)
     1043        #        except:
     1044        #            self.logger.errorPair('failed sql',sql)
     1045        #            raise
    10371046
    10381047        # set the flux values from the cmf file
     
    11101119            pspsNum  = str(int(number) + 2)
    11111120            field = filter + prefix + "flxR" + pspsNum
    1112             sqlLine.group(field,               field         + " * b.zpFactor")
    1113             sqlLine.group(field + "Err",       field + "err" + " * b.zpFactor")
    1114             sqlLine.group(field + "Std",       field + "Std" + " * b.zpFactor")
     1121            sqlLine.group(field,               field         + " * b.zpFactorAPER")
     1122            sqlLine.group(field + "Err",       field + "err" + " * b.zpFactorAPER")
     1123            sqlLine.group(field + "Std",       field + "Std" + " * b.zpFactorAPER")
    11151124
    11161125        sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID))
     
    11201129            self.logger.infoPair("failed sql",sql)
    11211130            raise
     1131
    11221132    '''
    11231133    Populates the StackToImage table
  • branches/czw_branch/20170908/ippToPsps/jython/testCode.py

    r39134 r40483  
    4646    def importIppTables(self):
    4747
     48        if len(sys.argv) != 2:
     49            print "USAGE: ippjython testCode.py (filename)"
     50            os._exit(2)
     51
     52        self.filename = sys.argv[1]
     53
    4854        try:
    4955            tables = stilts.treads(self.filename)
     
    5460        for table in tables:
    5561
    56             print "import smf table " + table.name
     62            print "import table " + table.name
    5763
    5864            # need to generate an index on the IPP_IDET column
    5965            # table = stilts.tpipe(table, cmd='addcol table_index $0')
    60             table = stilts.tpipe(table, cmd='explodeall')
     66            try:
     67                table = stilts.tpipe(table, cmd='explodeall')
     68            except Exception,e:
     69                # print the error, wait a few secs then try again
     70                print str(e)
     71                return False
    6172
    62             print "read smf table " + table.name
     73            try:
     74                myColumns = table.columns()
     75            except Exception,e:
     76                # print the error, wait a few secs then try again
     77                print str(e)
     78                return False
     79
     80            print "got myColumns"
     81
     82            try:
     83                for column in myColumns:
     84                    print "got column " + column.name
     85            except Exception,e:
     86                # print the error, wait a few secs then try again
     87                print str(e)
     88                return False
     89
     90            print "read table " + table.name
    6391
    6492            # drop any previous tables before import
     
    6997
    7098            # IPP FITS files are littered with infinities, so remove these
    71             print "Removing Infinity values from all columns"
    72             table = stilts.tpipe(table, cmd='replaceval -Infinity null *')
    73             table = stilts.tpipe(table, cmd='replaceval Infinity null *')
    74 
    75             try:
    76                 table.write(self.url + '#' + table.name)
    77             except:
    78                 print "Problem writing table '" + table.name + "' to the database"
    79                 os._exit(4)
     99            ## print "Removing Infinity values from all columns"
     100            ## table = stilts.tpipe(table, cmd='replaceval -Infinity null *')
     101            ## table = stilts.tpipe(table, cmd='replaceval Infinity null *')
     102            ##
     103            ## try:
     104            ##     table.write(self.url + '#' + table.name)
     105            ## except:
     106            ##     print "Problem writing table '" + table.name + "' to the database"
     107            ##     os._exit(4)
    80108
    81109        return True
     
    103131            print "alt word1"
    104132       
     133        self.importIppTables()
    105134
    106135        # self.connectMysql(argv)
  • branches/czw_branch/20170908/ippToPsps/test/fulltest.sh

    r39165 r40483  
    1616end
    1717setenv IPPTOPSPS_DATA $datadir/ipptopsps
     18
     19set DRversion = "DR2"
     20set myScript = "none"
     21if ($DRversion == "DR1") then
     22  set myScript = mkgpc1data.dvo
     23  set CATDIR_CAM = catdir.cam
     24  set CATDIR_STK = catdir.stk
     25  set CATDIR_WRP = catdir.wrp
     26  set CATDIR_DIF = catdir.dif
     27endif
     28if ($DRversion == "DR2") then
     29  set myScript = mkgpc1data.dr2.dvo
     30  set CATDIR_CAM = catdir.mrg
     31  set CATDIR_STK = catdir.mrg
     32  set CATDIR_WRP = catdir.mrg
     33  set CATDIR_DIF = catdir.dif
     34endif
     35if ($DRversion == "none") then
     36  echo "invalid DRversion $DRversion"
     37  exit 2
     38endif
     39
     40set coords = `$myScript -dump-region`
    1841
    1942# before running this test, you must have a mysql user:
     
    217240if ($mkgpc1) then
    218241  echo ""
    219   echo " ---- mkgpc1data.dvo : creating the dvo & gpc1 database entries ----"
    220   mkgpc1data.dvo
     242  echo " ---- $myScript : creating the dvo & gpc1 database entries ----"
     243  $myScript
    221244  if ($status) then
    222245    echo "failed to generate the data & dvo, quitting"
     
    283306  echo "0                      " >> initbatch.dat # queue_FW
    284307  echo "0                      " >> initbatch.dat # queue_FO
     308  echo "0                      " >> initbatch.dat # queue_FG
     309  echo "0                      " >> initbatch.dat # queue_GO
    285310  echo "1                      " >> initbatch.dat # active
    286311  echo "0                      " >> initbatch.dat # parallel
     
    313338  echo "0                     " >> cambatch.dat # datastore_publish
    314339  echo "catdir.cam            " >> cambatch.dat # dvo_label
    315   echo "$OUTDIR/catdir.cam    " >> cambatch.dat # dvo_location
    316   echo "9                     " >> cambatch.dat # min_ra
    317   echo "11                    " >> cambatch.dat # max_ra
    318   echo "19                    " >> cambatch.dat # min_dec
    319   echo "21                    " >> cambatch.dat # max_dec
     340  echo "$OUTDIR/$CATDIR_CAM   " >> cambatch.dat # dvo_location
     341  echo "$coords[1]            " >> cambatch.dat # min_ra
     342  echo "$coords[2]            " >> cambatch.dat # max_ra
     343  echo "$coords[3]            " >> cambatch.dat # min_dec
     344  echo "$coords[4]            " >> cambatch.dat # max_dec
    320345  echo "2                     " >> cambatch.dat # box_size
    321346  echo "$OUTDIR               " >> cambatch.dat # base_path
     
    334359  echo "0                     " >> cambatch.dat # queue_FW
    335360  echo "0                     " >> cambatch.dat # queue_FO
     361  echo "0                     " >> cambatch.dat # queue_FG
     362  echo "0                     " >> cambatch.dat # queue_GO
    336363  echo "1                     " >> cambatch.dat # active
    337364  echo "0                     " >> cambatch.dat # parallel
     
    366393  echo "0                     " >> objectbatch.dat # datastore_publish
    367394  echo "catdir.cam            " >> objectbatch.dat # dvo_label
    368   echo "$OUTDIR/catdir.cam    " >> objectbatch.dat # dvo_location
    369   echo "9                     " >> objectbatch.dat # min_ra
    370   echo "11                    " >> objectbatch.dat # max_ra
    371   echo "19                    " >> objectbatch.dat # min_dec
    372   echo "21                    " >> objectbatch.dat # max_dec
     395  echo "$OUTDIR/$CATDIR_CAM    " >> objectbatch.dat # dvo_location
     396  echo "$coords[1]            " >> objectbatch.dat # min_ra
     397  echo "$coords[2]            " >> objectbatch.dat # max_ra
     398  echo "$coords[3]            " >> objectbatch.dat # min_dec
     399  echo "$coords[4]            " >> objectbatch.dat # max_dec
    373400  echo "2                     " >> objectbatch.dat # box_size
    374401  echo "$OUTDIR               " >> objectbatch.dat # base_path
     
    387414  echo "0                     " >> objectbatch.dat # queue_FW
    388415  echo "0                     " >> objectbatch.dat # queue_FO
     416  echo "0                     " >> objectbatch.dat # queue_FG
     417  echo "0                     " >> objectbatch.dat # queue_GO
    389418  echo "1                     " >> objectbatch.dat # active
    390419  echo "0                     " >> objectbatch.dat # parallel
     
    419448  echo "0                     " >> stackbatch.dat # datastore_publish
    420449  echo "catdir.stk            " >> stackbatch.dat # dvo_label
    421   echo "$OUTDIR/catdir.stk    " >> stackbatch.dat # dvo_location
    422   echo "9                     " >> stackbatch.dat # min_ra
    423   echo "11                    " >> stackbatch.dat # max_ra
    424   echo "19                    " >> stackbatch.dat # min_dec
    425   echo "21                    " >> stackbatch.dat # max_dec
     450  echo "$OUTDIR/$CATDIR_STK   " >> stackbatch.dat # dvo_location
     451  echo "$coords[1]            " >> stackbatch.dat # min_ra
     452  echo "$coords[2]            " >> stackbatch.dat # max_ra
     453  echo "$coords[3]            " >> stackbatch.dat # min_dec
     454  echo "$coords[4]            " >> stackbatch.dat # max_dec
    426455  echo "2                     " >> stackbatch.dat # box_size
    427456  echo "$OUTDIR               " >> stackbatch.dat # base_path
     
    440469  echo "0                     " >> stackbatch.dat # queue_FW
    441470  echo "0                     " >> stackbatch.dat # queue_FO
     471  echo "0                     " >> stackbatch.dat # queue_FG
     472  echo "0                     " >> stackbatch.dat # queue_GO
    442473  echo "1                     " >> stackbatch.dat # active
    443474  echo "0                     " >> stackbatch.dat # parallel
     
    472503  echo "0                     " >> forcebatch.dat # datastore_publish
    473504  echo "catdir.wrp            " >> forcebatch.dat # dvo_label
    474   echo "$OUTDIR/catdir.wrp    " >> forcebatch.dat # dvo_location
    475   echo "9                     " >> forcebatch.dat # min_ra
    476   echo "11                    " >> forcebatch.dat # max_ra
    477   echo "19                    " >> forcebatch.dat # min_dec
    478   echo "21                    " >> forcebatch.dat # max_dec
     505  echo "$OUTDIR/$CATDIR_WRP   " >> forcebatch.dat # dvo_location
     506  echo "$coords[1]            " >> forcebatch.dat # min_ra
     507  echo "$coords[2]            " >> forcebatch.dat # max_ra
     508  echo "$coords[3]            " >> forcebatch.dat # min_dec
     509  echo "$coords[4]            " >> forcebatch.dat # max_dec
    479510  echo "2                     " >> forcebatch.dat # box_size
    480511  echo "$OUTDIR               " >> forcebatch.dat # base_path
     
    493524  echo "1                     " >> forcebatch.dat # queue_FW
    494525  echo "0                     " >> forcebatch.dat # queue_FO
     526  echo "0                     " >> forcebatch.dat # queue_FG
     527  echo "0                     " >> forcebatch.dat # queue_GO
    495528  echo "1                     " >> forcebatch.dat # active
    496529  echo "0                     " >> forcebatch.dat # parallel
     
    525558  echo "0                     " >> forcedobjectbatch.dat # datastore_publish
    526559  echo "catdir.wrp            " >> forcedobjectbatch.dat # dvo_label
    527   echo "$OUTDIR/catdir.wrp    " >> forcedobjectbatch.dat # dvo_location
    528   echo "9                     " >> forcedobjectbatch.dat # min_ra
    529   echo "11                    " >> forcedobjectbatch.dat # max_ra
    530   echo "19                    " >> forcedobjectbatch.dat # min_dec
    531   echo "21                    " >> forcedobjectbatch.dat # max_dec
     560  echo "$OUTDIR/$CATDIR_WRP   " >> forcedobjectbatch.dat # dvo_location
     561  echo "$coords[1]            " >> forcedobjectbatch.dat # min_ra
     562  echo "$coords[2]            " >> forcedobjectbatch.dat # max_ra
     563  echo "$coords[3]            " >> forcedobjectbatch.dat # min_dec
     564  echo "$coords[4]            " >> forcedobjectbatch.dat # max_dec
    532565  echo "2                     " >> forcedobjectbatch.dat # box_size
    533566  echo "$OUTDIR               " >> forcedobjectbatch.dat # base_path
     
    546579  echo "0                     " >> forcedobjectbatch.dat # queue_FW
    547580  echo "1                     " >> forcedobjectbatch.dat # queue_FO
     581  echo "0                     " >> forcedobjectbatch.dat # queue_FG
     582  echo "0                     " >> forcedobjectbatch.dat # queue_GO
    548583  echo "1                     " >> forcedobjectbatch.dat # active
    549584  echo "0                     " >> forcedobjectbatch.dat # parallel
     
    579614  echo "0                     " >> diffbatch.dat # datastore_publish
    580615  echo "catdir.dif            " >> diffbatch.dat # dvo_label
    581   echo "$OUTDIR/catdir.dif    " >> diffbatch.dat # dvo_location
    582   echo "9                     " >> diffbatch.dat # min_ra
    583   echo "11                    " >> diffbatch.dat # max_ra
    584   echo "19                    " >> diffbatch.dat # min_dec
    585   echo "21                    " >> diffbatch.dat # max_dec
     616  echo "$OUTDIR/$CATDIR_DIF    " >> diffbatch.dat # dvo_location
     617  echo "$coords[1]            " >> diffbatch.dat # min_ra
     618  echo "$coords[2]            " >> diffbatch.dat # max_ra
     619  echo "$coords[3]            " >> diffbatch.dat # min_dec
     620  echo "$coords[4]            " >> diffbatch.dat # max_dec
    586621  echo "2                     " >> diffbatch.dat # box_size
    587622  echo "$OUTDIR               " >> diffbatch.dat # base_path
     
    600635  echo "0                     " >> diffbatch.dat # queue_FW
    601636  echo "0                     " >> diffbatch.dat # queue_FO
     637  echo "0                     " >> diffbatch.dat # queue_FG
     638  echo "0                     " >> diffbatch.dat # queue_GO
    602639  echo "1                     " >> diffbatch.dat # active
    603640  echo "0                     " >> diffbatch.dat # parallel
     
    631668  echo "0                     " >> diffobjbatch.dat # datastore_publish
    632669  echo "catdir.dif            " >> diffobjbatch.dat # dvo_label
    633   echo "$OUTDIR/catdir.dif    " >> diffobjbatch.dat # dvo_location
    634   echo "9                     " >> diffobjbatch.dat # min_ra
    635   echo "11                    " >> diffobjbatch.dat # max_ra
    636   echo "19                    " >> diffobjbatch.dat # min_dec
    637   echo "21                    " >> diffobjbatch.dat # max_dec
     670  echo "$OUTDIR/$CATDIR_DIF    " >> diffobjbatch.dat # dvo_location
     671  echo "$coords[1]            " >> diffobjbatch.dat # min_ra
     672  echo "$coords[2]            " >> diffobjbatch.dat # max_ra
     673  echo "$coords[3]            " >> diffobjbatch.dat # min_dec
     674  echo "$coords[4]            " >> diffobjbatch.dat # max_dec
    638675  echo "2                     " >> diffobjbatch.dat # box_size
    639676  echo "$OUTDIR               " >> diffobjbatch.dat # base_path
     
    652689  echo "0                     " >> diffobjbatch.dat # queue_FW
    653690  echo "0                     " >> diffobjbatch.dat # queue_FO
     691  echo "0                     " >> diffobjbatch.dat # queue_FG
     692  echo "0                     " >> diffobjbatch.dat # queue_GO
    654693  echo "1                     " >> diffobjbatch.dat # active
    655694  echo "0                     " >> diffobjbatch.dat # parallel
  • branches/czw_branch/20170908/ippToPsps/test/mkgpc1.sh

    r39021 r40483  
    1515endif
    1616
     17if ("$1" == "user.sudo") then
     18  if ($#argv != 4) goto usage;
     19  set dbhost = $2
     20  set dbuser = $3
     21  set dbpass = $4
     22
     23  sudo mysql -h $dbhost -u root -p -e "grant all on *.* to $dbuser@"$dbhost" identified by '$dbpass'"
     24  exit 0;
     25endif
     26
    1727if ("$1" == "create") then
    1828  if ($#argv < 4) goto usage;
     
    2838  # create a database with completely minimal tables needed to test
    2939  mysql -h $dbhost -u $dbuser $dbpass -e "CREATE DATABASE $dbname"
     40  if ($status) then
     41    echo "ERROR: failed to create mysql database $dbname ($0)"
     42    echo " NOTE: before running this test, you must have a mysql user:"
     43    echo "       mkgpc1.sh user localhost dvo dvo (requires root password)"
     44    exit 1
     45  endif
    3046  mysql -h $dbhost -u $dbuser $dbpass $dbname < gpc1schema.sql
    3147  exit 0;
     
    4561  (mysql -B -h $dbhost -u $dbuser $dbpass -e "show databases" | grep ^$dbname\$) >& /dev/null
    4662  if ($status) then
    47     echo "database $dbname does not yet exist"
     63    echo "INFO: database $dbname does not yet exist ($0)"
    4864    exit 0
    4965  endif
    5066
    51   # mysql -h $dbhost -u $dbuser $dbpass $dbname -e "show tables"
     67  echo mysql -B -h $dbhost -u $dbuser $dbpass $dbname -e "show tables"
     68  mysql -h $dbhost -u $dbuser $dbpass $dbname -e "show tables"
    5269  mysql -h $dbhost -u $dbuser $dbpass $dbname -e "describe ippToPspsFake" >& /dev/null
    5370  if ($status) then
     
    91108  endif
    92109
     110  echo mysql -B -h $dbhost -u $dbuser $dbpass $dbname -e "show tables"
    93111  set ntable = `mysql -B -h $dbhost -u $dbuser $dbpass $dbname -e "show tables" | wc -l`
    94112  echo ntable: $ntable
     
    112130  echo "      delete an existing test db (enter pass 3x)"
    113131  echo ""
     132  echo "  mkgpc1.sh forcedelete (dbhost) (dbname) (dbuser) [dbpass]"
     133  echo "      delete an existing test db (enter pass 3x), even if the number of tables is wrong"
     134  echo ""
    114135  echo "  mkgpc1.sh user (dbhost) (dbuser) (password)"
    115136  echo "      create a new user and password for the test db"
    116137  echo ""
     138  echo "  mkgpc1.sh user.sudo (dbhost) (dbuser) (password)"
     139  echo "      create a new user and password for the test db, using sudo mysql"
     140  echo "      (this option is needed if your mysql installation uses the auth_socket plugin"
     141  echo ""
    117142  exit 2
  • branches/czw_branch/20170908/ippToPsps/test/mkgpc1data.dvo

    r39165 r40483  
    1717$RA = 10.0
    1818$DEC = 20.0
    19 $SKYCELL = "skycell.1133.081"
    20 $TESS_ID = "RINGS.V3"
    21 $BAD_PSFQF_FRAC = 0.2
     19$SKYCELL = skycell.1133.081
     20$TESS_ID = RINGS.V3
     21$BAD_PSFQF_FRAC = 0.0
     22$ADDNOISE = "-no-noise"
     23
     24# a note on double quotes and TESS_ID:
     25# since the variables TESS_ID and SKYCELL are used below to construct the list, their values should NOT be wrapped in double quotes
     26# or those double quotes are embedded in the strings in the list
     27# when TESS_ID and SKYCELL appear in mysql commands as values they need to be protected with double quotes so mysql does not
     28# interpret them as db table fields
    2229
    2330# imagedata describes the full fake exposure set.  the fields are
    2431list imagedata
    25 # exp_id stk_id filebase         M_off date       time      warpfile         filter  difffile
    26    1     1      $OUTDIR/test.01  0.000 2010/01/01 01:00:00  $OUTDIR/warp.01  g       $OUTDIR/diff.01
    27    2     1      $OUTDIR/test.02 -0.025 2010/01/01 02:00:00  $OUTDIR/warp.02  g       $OUTDIR/diff.02
    28    3     1      $OUTDIR/test.03  0.025 2010/01/01 03:00:00  $OUTDIR/warp.03  g       $OUTDIR/diff.03
    29    4     1      $OUTDIR/test.04  0.010 2010/01/01 04:00:00  $OUTDIR/warp.04  g       $OUTDIR/diff.04
    30    5     2      $OUTDIR/test.05  0.000 2010/01/01 05:00:00  $OUTDIR/warp.05  g       $OUTDIR/diff.05
    31    6     2      $OUTDIR/test.06 -0.025 2010/01/01 06:00:00  $OUTDIR/warp.06  g       $OUTDIR/diff.06
    32    7     2      $OUTDIR/test.07  0.025 2010/01/01 07:00:00  $OUTDIR/warp.07  g       $OUTDIR/diff.07
    33    8     2      $OUTDIR/test.08  0.010 2010/01/01 08:00:00  $OUTDIR/warp.08  g       $OUTDIR/diff.08
    34    9     3      $OUTDIR/test.09  0.000 2010/01/01 09:00:00  $OUTDIR/warp.09  g       $OUTDIR/diff.09
    35   10     3      $OUTDIR/test.10 -0.025 2010/01/01 10:00:00  $OUTDIR/warp.10  g       $OUTDIR/diff.10
    36   11     3      $OUTDIR/test.11  0.025 2010/01/01 11:00:00  $OUTDIR/warp.11  g       $OUTDIR/diff.11
    37   12     3      $OUTDIR/test.12  0.010 2010/01/01 12:00:00  $OUTDIR/warp.12  g       $OUTDIR/diff.12
    38   13     4      $OUTDIR/test.13 -0.025 2010/01/02 01:00:00  $OUTDIR/warp.13  r       $OUTDIR/diff.13
    39   14     4      $OUTDIR/test.14  0.025 2010/01/02 02:00:00  $OUTDIR/warp.14  r       $OUTDIR/diff.14
    40   15     4      $OUTDIR/test.15  0.010 2010/01/02 03:00:00  $OUTDIR/warp.15  r       $OUTDIR/diff.15
    41   16     4      $OUTDIR/test.16  0.000 2010/01/02 04:00:00  $OUTDIR/warp.16  r       $OUTDIR/diff.16
    42   17     5      $OUTDIR/test.17 -0.025 2010/01/02 05:00:00  $OUTDIR/warp.17  r       $OUTDIR/diff.17
    43   18     5      $OUTDIR/test.18  0.025 2010/01/02 06:00:00  $OUTDIR/warp.18  r       $OUTDIR/diff.18
    44   19     5      $OUTDIR/test.19  0.010 2010/01/02 07:00:00  $OUTDIR/warp.19  r       $OUTDIR/diff.19
    45   20     5      $OUTDIR/test.20  0.000 2010/01/02 08:00:00  $OUTDIR/warp.20  r       $OUTDIR/diff.20
    46   21     6      $OUTDIR/test.21 -0.025 2010/01/02 09:00:00  $OUTDIR/warp.21  r       $OUTDIR/diff.21
    47   22     6      $OUTDIR/test.22  0.025 2010/01/02 10:00:00  $OUTDIR/warp.22  r       $OUTDIR/diff.22
    48   23     6      $OUTDIR/test.23  0.010 2010/01/02 11:00:00  $OUTDIR/warp.23  r       $OUTDIR/diff.23
    49   24     6      $OUTDIR/test.24 -0.020 2010/01/02 12:00:00  $OUTDIR/warp.24  r       $OUTDIR/diff.24
     32# exp_id stk_id filebase          M_off date       time      warpfile                       filter  difffile
     33   1     1      $OUTDIR/test.cam  0.000 2010/01/01 01:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     34   2     1      $OUTDIR/test.cam -0.025 2010/01/01 02:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     35   3     1      $OUTDIR/test.cam  0.025 2010/01/01 03:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     36   4     1      $OUTDIR/test.cam  0.010 2010/01/01 04:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     37   5     2      $OUTDIR/test.cam  0.000 2010/01/01 05:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     38   6     2      $OUTDIR/test.cam -0.025 2010/01/01 06:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     39   7     2      $OUTDIR/test.cam  0.025 2010/01/01 07:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     40   8     2      $OUTDIR/test.cam  0.010 2010/01/01 08:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     41   9     3      $OUTDIR/test.cam  0.000 2010/01/01 09:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     42  10     3      $OUTDIR/test.cam -0.025 2010/01/01 10:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     43  11     3      $OUTDIR/test.cam  0.025 2010/01/01 11:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     44  12     3      $OUTDIR/test.cam  0.010 2010/01/01 12:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  g       $OUTDIR/$TESS_ID.$SKYCELL.diff
     45  13     4      $OUTDIR/test.cam -0.025 2010/01/02 01:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     46  14     4      $OUTDIR/test.cam  0.025 2010/01/02 02:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     47  15     4      $OUTDIR/test.cam  0.010 2010/01/02 03:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     48  16     4      $OUTDIR/test.cam  0.000 2010/01/02 04:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     49  17     5      $OUTDIR/test.cam -0.025 2010/01/02 05:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     50  18     5      $OUTDIR/test.cam  0.025 2010/01/02 06:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     51  19     5      $OUTDIR/test.cam  0.010 2010/01/02 07:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     52  20     5      $OUTDIR/test.cam  0.000 2010/01/02 08:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     53  21     6      $OUTDIR/test.cam -0.025 2010/01/02 09:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     54  22     6      $OUTDIR/test.cam  0.025 2010/01/02 10:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     55  23     6      $OUTDIR/test.cam  0.010 2010/01/02 11:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
     56  24     6      $OUTDIR/test.cam -0.020 2010/01/02 12:00:00  $OUTDIR/$TESS_ID.$SKYCELL.wrp  r       $OUTDIR/$TESS_ID.$SKYCELL.diff
    5057end
    5158
    5259list stackdata
    53 # stk_id sky_id filename         M_off filter  forcedgalaxy         
    54   1      1      $OUTDIR/stack.01 0.010 g       $OUTDIR/fgal.01
    55   2      2      $OUTDIR/stack.02 0.020 g       $OUTDIR/fgal.02
    56   3      3      $OUTDIR/stack.03 0.030 g       $OUTDIR/fgal.03
    57   4      1      $OUTDIR/stack.04 0.025 r       $OUTDIR/fgal.04
    58   5      2      $OUTDIR/stack.05 0.035 r       $OUTDIR/fgal.05
    59   6      3      $OUTDIR/stack.06 0.045 r       $OUTDIR/fgal.06
     60# stk_id sky_id filename                      M_off filter  forcedgalaxy         
     61  1      1      $OUTDIR/$TESS_ID.$SKYCELL.stk 0.010 g       $OUTDIR/$TESS_ID.$SKYCELL.fgal
     62  2      2      $OUTDIR/$TESS_ID.$SKYCELL.stk 0.020 g       $OUTDIR/$TESS_ID.$SKYCELL.fgal
     63  3      3      $OUTDIR/$TESS_ID.$SKYCELL.stk 0.030 g       $OUTDIR/$TESS_ID.$SKYCELL.fgal
     64  4      1      $OUTDIR/$TESS_ID.$SKYCELL.stk 0.025 r       $OUTDIR/$TESS_ID.$SKYCELL.fgal
     65  5      2      $OUTDIR/$TESS_ID.$SKYCELL.stk 0.035 r       $OUTDIR/$TESS_ID.$SKYCELL.fgal
     66  6      3      $OUTDIR/$TESS_ID.$SKYCELL.stk 0.045 r       $OUTDIR/$TESS_ID.$SKYCELL.fgal
    6067end
    6168 
     
    6774  mkcatdir.dif PS1_DV5 PS1_V5
    6875  insert.stack.set
     76
     77  exec rm -rf testdata/catdir.mrg
     78  exec dvomerge -matched-tables testdata/catdir.cam into testdata/catdir.mrg
     79  exec dvomerge -matched-tables testdata/catdir.stk into testdata/catdir.mrg
     80  exec dvomerge -matched-tables testdata/catdir.wrp into testdata/catdir.mrg
     81
     82  # relphot -D CATDIR testdata/catdir.mrg -D CAMERA simtest -region 8 12 18 22 -update -vv -averages -boundary-tree tess.3pi.fits
     83  exec relphot -D CATDIR testdata/catdir.mrg -D CAMERA simtest -region 8 12 18 22 -update -vv -images g,r -reset -reset-zpts -D STAR_TOOFEW 0 -boundary-tree tess.3pi.fits -cloud-limit 0.1
    6984end
    7085
     
    7590  $dbuser = dvo
    7691  $dbpass = dvo
    77 #  $dbuser = czw
    78 #  $dbpass = czw
    79 
     92
     93  $gscfile = `gconfig GSCFILE`
     94  if ("$gscfile" == "not found")
     95    echo "problem with dvo / ptolemy configuration.  check ~/.ptolemyrc"
     96    break
     97  end
     98   
    8099  exec mkgpc1.sh delete $dbhost $dbname $dbuser $dbpass
    81100  exec mkgpc1.sh create $dbhost $dbname $dbuser $dbpass
     
    85104  # system-wide info
    86105  dbinsert ippToPspsFake (my_id) values (2)
    87   dbinsert skycell (radeg, decdeg, tess_id, skycell_id) values ($RA, $DEC, $TESS_ID, $SKYCELL)
     106  dbinsert skycell (radeg, decdeg, tess_id, skycell_id) values ($RA, $DEC, "$TESS_ID", "$SKYCELL")
    88107end
    89108
     
    110129    $ID = $word:0
    111130    $stkID = $word:1
    112     $rawfile = $word:2\.txt
    113     $cmffile = $word:2\.smf
     131    sprintf rawfile "%s.%02d.txt" $word:2 $ID
     132    sprintf cmffile "%s.%02d.smf" $word:2 $ID
    114133    $offset = $word:3
    115134    sprintf myDATE "%s" $word:4
     
    172191
    173192    mkinput $offset $rawfile
    174     echo mkcmf -photcode SIMTEST.$filter.Chip -no-noise -append $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 0
    175     exec mkcmf -photcode SIMTEST.$filter.Chip -no-noise -append $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 0
     193    echo mkcmf -photcode SIMTEST.$filter.Chip $ADDNOISE -append $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 0 -coords
     194    exec mkcmf -photcode SIMTEST.$filter.Chip $ADDNOISE -append $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 0 -coords
    176195
    177196    if ($i == 3)
     
    198217
    199218  if ($SMALLTEST)
    200     echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -nloop 0 -D STAR_TOOFEW 0 -update
    201     exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -nloop 0 -D STAR_TOOFEW 0 -update
    202 
    203     echo relastro -v -D CATDIR $catdir -images -update-chips -region 8 12 18 22 -update -apply-offsets
    204     exec relastro -v -D CATDIR $catdir -images -update-chips -region 8 12 18 22 -update -apply-offsets
     219    echo relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -nloop 0 -D STAR_TOOFEW 0 -update
     220    exec relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -nloop 0 -D STAR_TOOFEW 0 -update
     221
     222    echo relastro -v -D CATDIR $catdir -D CAMERA simtest -images -update-chips -update-all-cameras -region 8 12 18 22 -update -apply-offsets
     223    exec relastro -v -D CATDIR $catdir -D CAMERA simtest -images -update-chips -update-all-cameras -region 8 12 18 22 -update -apply-offsets
    205224  else
    206     echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update
    207     exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update
     225    echo relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -update
     226    exec relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -update
    208227  end
    209228
     
    246265    $stkID = $word:0
    247266    $skyID = $word:1
    248     $rawfile = $word:2\.txt
    249     $cmffile = $word:2\.cmf
     267    sprintf rawfile "%s.%02d.txt" $word:2 $stkID
     268    sprintf cmffile "%s.%02d.cmf" $word:2 $stkID
    250269    $offset = $word:3
    251270    $filter = $word:4
     
    255274
    256275    mkinput $offset $rawfile
    257     echo mkcmf -stack -photcode SIMTEST.$filter.SkyChip $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL
    258     exec mkcmf -stack -photcode SIMTEST.$filter.SkyChip $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL
     276    echo mkcmf -stack -photcode SIMTEST.$filter.SkyChip $ADDNOISE $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL -coords
     277    exec mkcmf -stack -photcode SIMTEST.$filter.SkyChip $ADDNOISE $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL -coords
    259278
    260279    # add some required header keywords:
     
    267286
    268287  if ($SMALLTEST)
    269     echo relphot -D CATDIR $catdir -region 8 12 18 22 -averages -update
    270     exec relphot -D CATDIR $catdir -region 8 12 18 22 -averages -update
     288    echo relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -averages -update
     289    exec relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -averages -update
    271290  else
    272     echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update
    273     exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update
     291    echo relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -update
     292    exec relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -update
    274293  end
    275294
     
    315334    $ID = $word:0
    316335    $stkID = $word:1
    317     $rawfile = $word:2\.txt; # use the cam-stage rawfile
    318     $cmffile = $word:6\.cmf
     336    sprintf rawfile "%s.%02d.txt" $word:2 $ID; # use the cam-stage rawfile
     337    sprintf cmffile "%s.%02d.smf" $word:6 $ID
    319338    $offset = $word:3
    320339    sprintf myDATE "%s" $word:4
     
    330349
    331350    mkinput $offset $rawfile
    332     echo mkcmf -forcedwarp -photcode SIMTEST.$filter.ForcedWarp $rawfile $cmffile -extroot SkyChip -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 2 -tess_id $TESS_ID -skycell $SKYCELL -bad-psfqf-frac $BAD_PSFQF_FRAC
    333     exec mkcmf -forcedwarp -photcode SIMTEST.$filter.ForcedWarp $rawfile $cmffile -extroot SkyChip -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 2 -tess_id $TESS_ID -skycell $SKYCELL -bad-psfqf-frac $BAD_PSFQF_FRAC
     351    echo mkcmf -forcedwarp -photcode SIMTEST.$filter.ForcedWarp $ADDNOISE $rawfile $cmffile -extroot SkyChip -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 2 -tess_id $TESS_ID -skycell $SKYCELL -bad-psfqf-frac $BAD_PSFQF_FRAC -coords
     352    exec mkcmf -forcedwarp -photcode SIMTEST.$filter.ForcedWarp $ADDNOISE $rawfile $cmffile -extroot SkyChip -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 2 -tess_id $TESS_ID -skycell $SKYCELL -bad-psfqf-frac $BAD_PSFQF_FRAC -coords
    334353
    335354    echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -xrad
     
    341360    list word -split $stackdata:$i
    342361    $stkID = $word:0
    343     $rawfile = $word:2\.txt
    344     $cmffile = $word:5\.cmf
     362    sprintf rawfile "%s.%02d.txt" $word:2 $stkID
     363    sprintf cmffile "%s.%02d.smf" $word:5 $stkID
    345364    $offset = $word:3
    346365    $filter = $word:4
     
    349368    if ($SMALLTEST && ($stkID != 1) && ($stkID != 4)) continue
    350369
    351     echo mkcmf -forcedgalaxy -photcode SIMTEST.$filter.ForcedWarp $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL
    352     exec mkcmf -forcedgalaxy -photcode SIMTEST.$filter.ForcedWarp $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL
    353 
    354     echo loadgalphot -D CATDIR $catdir -photcode SIMTEST.$filter.ForcedWarp -image-id $stkID $cmffile
    355     exec loadgalphot -D CATDIR $catdir -photcode SIMTEST.$filter.ForcedWarp -image-id $stkID $cmffile
     370    echo mkcmf -forcedgalaxy -photcode SIMTEST.$filter.ForcedWarp $ADDNOISE $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL -coords
     371    exec mkcmf -forcedgalaxy -photcode SIMTEST.$filter.ForcedWarp $ADDNOISE $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL -coords
     372
     373    echo loadgalphot -D CATDIR $catdir -D CAMERA simtest -photcode SIMTEST.$filter.ForcedWarp -image-id $stkID $cmffile
     374    exec loadgalphot -D CATDIR $catdir -D CAMERA simtest -photcode SIMTEST.$filter.ForcedWarp -image-id $stkID $cmffile
    356375  end
    357376
    358377  if ($SMALLTEST)
    359     echo relphot -D CATDIR $catdir -region 8 12 18 22 -averages -update
    360     exec relphot -D CATDIR $catdir -region 8 12 18 22 -averages -update
     378    echo relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -averages -update
     379    exec relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -averages -update
    361380  else
    362     echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update
    363     exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update
    364   end
    365 
    366   echo dvolens -D CATDIR $catdir -region 8 12 18 22 -update-objects -update
    367   exec dvolens -D CATDIR $catdir -region 8 12 18 22 -update-objects -update
     381    echo relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -update
     382    exec relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -update
     383  end
     384
     385  echo dvolens -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -update-objects -update
     386  exec dvolens -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -update-objects -update
    368387
    369388  if ($PARALLEL)
     
    406425  dbinsert camProcessedExp (cam_id, path_base, fault) values ($myID, "$filename", 0)
    407426  dbinsert fakeRun (fake_id, cam_id) values ($myID, $myID)
    408   dbinsert warpRun (warp_id, fake_id, tess_id, state) values ($myID, $myID, $TESS_ID, "full")
    409   dbinsert warpSkyCellMap (warp_id, skycell_id, class_id) values ($myID, $SKYCELL, "XY00")
    410   dbinsert warpImfile (warp_id, skycell_id, warp_skyfile_id) values ($myID, $SKYCELL, $myID)
     427  dbinsert warpRun (warp_id, fake_id, tess_id, state) values ($myID, $myID, "$TESS_ID", "full")
     428  dbinsert warpSkyCellMap (warp_id, skycell_id, class_id) values ($myID, "$SKYCELL", "XY00")
     429  dbinsert warpImfile (warp_id, skycell_id, warp_skyfile_id) values ($myID, "$SKYCELL", $myID)
    411430
    412431  dbinsert addRun (add_id, stage, state, stage_id, minidvodb_name) values ($myID, "cam", "full", $myID, "catdir.cam")
     
    452471  $skycalID = $stkID + 20
    453472
    454   dbinsert stackRun (stack_id, skycell_id, filter, software_ver) values ($stkID, $SKYCELL, "$filter.00000", "37500")
     473  dbinsert stackRun (stack_id, skycell_id, filter, software_ver) values ($stkID, "$SKYCELL", "$filter.00000", "37500")
    455474
    456475  # we have a single fullForceRun for each stack, so we can match fullForceRun ids to stackRun ids
     
    520539    $ID = $word:0
    521540    $stkID = $word:1
    522     $rawfile = $word:2\.txt
    523     $cmffile = $word:8\.cmf
    524     $invfile = $word:8\.inv.cmf
     541    sprintf rawfile "%s.%02d.txt" $word:2 $stkID
     542    sprintf cmffile "%s.%02d.smf" $word:8 $stkID
     543    sprintf invfile "%s.%02d.inv.smf" $word:8 $stkID
    525544    $offset = $word:3
    526545    sprintf myDATE "%s" $word:4
     
    535554    mkinput $offset $rawfile
    536555    $diff_skyfile_id = $ID + 25
    537     echo mkcmf -diff -photcode SIMTEST.$filter.SkyChip -no-noise -extroot SkyChip $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $diff_skyfile_id -sourceID 36 -bad-psfqf-frac $BAD_PSFQF_FRAC
    538     exec mkcmf -diff -photcode SIMTEST.$filter.SkyChip -no-noise -extroot SkyChip $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $diff_skyfile_id -sourceID 36 -bad-psfqf-frac $BAD_PSFQF_FRAC
    539 
    540     echo mkcmf -diff -photcode SIMTEST.$filter.SkyChip -no-noise -extroot SkyChip $rawfile $invfile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $diff_skyfile_id -sourceID 36 -bad-psfqf-frac $BAD_PSFQF_FRAC
    541     exec mkcmf -diff -photcode SIMTEST.$filter.SkyChip -no-noise -extroot SkyChip $rawfile $invfile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $diff_skyfile_id -sourceID 36 -bad-psfqf-frac $BAD_PSFQF_FRAC
     556    echo mkcmf -diff -photcode SIMTEST.$filter.SkyChip $ADDNOISE -extroot SkyChip $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $diff_skyfile_id -sourceID 36 -bad-psfqf-frac $BAD_PSFQF_FRAC -coords
     557    exec mkcmf -diff -photcode SIMTEST.$filter.SkyChip $ADDNOISE -extroot SkyChip $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $diff_skyfile_id -sourceID 36 -bad-psfqf-frac $BAD_PSFQF_FRAC -coords
     558
     559    echo mkcmf -diff -photcode SIMTEST.$filter.SkyChip $ADDNOISE -extroot SkyChip $rawfile $invfile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $diff_skyfile_id -sourceID 36 -bad-psfqf-frac $BAD_PSFQF_FRAC -coords
     560    exec mkcmf -diff -photcode SIMTEST.$filter.SkyChip $ADDNOISE -extroot SkyChip $rawfile $invfile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $diff_skyfile_id -sourceID 36 -bad-psfqf-frac $BAD_PSFQF_FRAC -coords
    542561
    543562    insert.dif $ID $ID $stkID $word:8
     
    557576  end
    558577  if ($SMALLTEST)
    559     echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -nloop 0 -D STAR_TOOFEW 0 -update -boundary-tree tess.3pi.fits -is-diff-db -statmode WT_MEAN
    560     exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -nloop 0 -D STAR_TOOFEW 0 -update -boundary-tree tess.3pi.fits -is-diff-db -statmode WT_MEAN
     578    echo relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -nloop 0 -D STAR_TOOFEW 0 -update -boundary-tree tess.3pi.fits -is-diff-db -statmode WT_MEAN
     579    exec relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -nloop 0 -D STAR_TOOFEW 0 -update -boundary-tree tess.3pi.fits -is-diff-db -statmode WT_MEAN
    561580  else
    562     echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update
    563     exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update
     581    echo relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -update
     582    exec relphot -D CATDIR $catdir -D CAMERA simtest -region 8 12 18 22 -images g,r,i,z,y -update
    564583  end
    565584
     
    592611    $stkID = $word:0
    593612    $skyID = $word:1
    594     $cmffile = $word:2
     613    sprintf cmffile "%s.%02d.cmf" $word:2 $stkID
    595614    $filter = $word:4
    596615
     
    652671  dbinsert addProcessedExp (add_id, fault) values ($addID, 0)
    653672
    654   dbinsert diffRun (diff_id, tess_id, state, diff_mode, software_ver) values ($difID, $TESS_ID, "full", 2, "38000M")
    655   dbinsert diffInputSkyfile (diff_id, warp1, stack2, diff_skyfile_id, tess_id, skycell_id) values ($difID, $wrpID, $stkID, $diffSkyfileID, $TESS_ID,  $SKYCELL )
    656   dbinsert diffSkyfile (diff_id, skycell_id, path_base) values ($difID, $SKYCELL, "$filename")
     673  dbinsert diffRun (diff_id, tess_id, state, diff_mode, software_ver) values ($difID, "$TESS_ID", "full", 2, "38000M")
     674  dbinsert diffInputSkyfile (diff_id, warp1, stack2, diff_skyfile_id, tess_id, skycell_id) values ($difID, $wrpID, $stkID, $diffSkyfileID, "$TESS_ID", "$SKYCELL" )
     675  dbinsert diffSkyfile (diff_id, skycell_id, path_base) values ($difID, "$SKYCELL", "$filename")
    657676end
    658677
     
    669688  exec rm -f $output
    670689
    671   local i j
     690  local i j ra dec
    672691  output $output
    673692  for i 10 1024 100
    674693    for j 10 1024 100
    675       fprintf " %6.1f %6.1f  %7.3f" $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0}
     694      $ra  = 10.0 + $i*0.25/3600
     695      $dec = 20.0 + $j*0.25/3600
     696      fprintf " %10.6f %10.6f %7.3f %6.1f %6.1f  %7.3f" $ra $dec {10.0 + $1 + 2.5*($i + $j)/1000.0} $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0}
    676697    end
    677698  end
    678699  # XXX add 2 duplicate detections
    679700  $i = 110; $j = 210
    680   fprintf " %6.1f %6.1f  %7.3f" $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0}
     701  # fprintf " %10.6f %10.6f %7.3f %6.1f %6.1f  %7.3f" $ra $dec {10.0 + $1 + 2.5*($i + $j)/1000.0} $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0}
     702  # fprintf " %6.1f %6.1f  %7.3f" $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0}
    681703  $i = 210; $j = 110
    682   fprintf " %6.1f %6.1f  %7.3f" $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0}
     704  # fprintf " %10.6f %10.6f %7.3f %6.1f %6.1f  %7.3f" $ra $dec {10.0 + $1 + 2.5*($i + $j)/1000.0} $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0}
     705  # fprintf " %6.1f %6.1f  %7.3f" $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0}
    683706  output stdout
     707end
     708
     709macro check.mags
     710
     711  # NOTE: relphot refuses to set the warp averages if there is no boundary tree: otherwise it cannot choose the correct subset of measurements
     712  # relphot -D CATDIR testdata/catdir.mrg -D CAMERA simtest -region 8 12 18 22 -update -vv -averages -boundary-tree tess.3pi.fits
     713  # relphot -D CATDIR testdata/catdir.mrg -D CAMERA simtest -region 8 12 18 22 -update -vv -images g,r -reset -reset-zpts -D STAR_TOOFEW 0 -boundary-tree tess.3pi.fits
     714
     715  catdir testdata/catdir.mrg
     716  skyregion 8 12 18 22
     717  avextract ra dec g:psf:chp g:kron:chp g:psf:stk g:psf:wrp
     718
     719  set dg:psf:chp:stk = g:psf:chp - g:psf:stk
     720  set dg:psf:chp:wrp = g:psf:chp - g:psf:wrp
     721  lim g:psf:chp dg:psf:chp:stk; clear; box; plot g:psf:chp dg:psf:chp:stk -c blue -pt 7; plot g:psf:chp dg:psf:chp:wrp -c red -pt 2
     722
     723# for i 0 10
     724#   echo ra[$i] dec[$i] g:psf:chp[$i] g:kron:chp[$i] g:psf:stk[$i] g:psf:wrp[$i]
     725# end
     726end
     727
     728macro check.mags.meas
     729
     730  # NOTE: relphot refuses to set the warp averages if there is no boundary tree: otherwise it cannot choose the correct subset of measurements
     731  # relphot -D CATDIR testdata/catdir.mrg -D CAMERA simtest -region 8 12 18 22 -update -vv -averages -boundary-tree tess.3pi.fits
     732  # relphot -D CATDIR testdata/catdir.mrg -D CAMERA simtest -region 8 12 18 22 -update -vv -images g,r -reset -reset-zpts -D STAR_TOOFEW 0 -boundary-tree tess.3pi.fits
     733
     734  catdir testdata/catdir.mrg
     735  skyregion 8 12 18 22
     736
     737  mextract ra dec mag:rel:psf mag:rel:kron mag:ave:psf mag:ave:kron photcode
     738  set dM:psf = mag:ave:psf - mag:rel:psf
     739  lim -n 0 mag:ave:psf dM:psf; clear; box; plot mag:ave:psf dM:psf
     740
     741  set dM:kron = mag:ave:kron - mag:rel:kron
     742  lim -n 1 mag:ave:kron dM:kron; clear; box; plot mag:ave:kron dM:kron
    684743end
    685744
  • branches/czw_branch/20170908/ippToPsps/test/notes.txt

    r35097 r40483  
     1
     22017.11.28 EAM:
     3
     4 updating the test suite (using my desktop kukui -- ubuntu 14.04).
     5
     6 * need to install xmllint to run ipptopsps
    17
    28In order to have a reasonably complete test, I need to have a bunch of things that mimic the IPP infrastructure
Note: See TracChangeset for help on using the changeset viewer.