IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25158


Ignore:
Timestamp:
Aug 20, 2009, 12:42:13 PM (17 years ago)
Author:
watersc1
Message:

More merging

Location:
branches/czw_branch/cleanup
Files:
2 deleted
48 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/cleanup

  • branches/czw_branch/cleanup/Ohana/src/opihi/dvo/dbExtractMeasures.c

    r25051 r25158  
    296296      value.Flt = pow (10.0, measure[0].dt * 0.4);
    297297      break;
    298     case MEAS_PHOTCODE: /* OK */
    299       value.Int = measure[0].photcode;
     298    case MEAS_PHOTCODE_EQUIV: /* OK */
     299      value.Int = GetPhotcodeEquivCodebyCode (measure[0].photcode);
    300300      break;
    301301    case MEAS_TIME: /* OK */
  • branches/czw_branch/cleanup/Ohana/src/opihi/dvo/dbFields.c

    r25051 r25158  
    1111    if (fields[i].photcode != NULL) {
    1212      if (fields[i].photcode[0].type == PHOT_MAG) {
    13         free (fields[i].photcode);
     13        free (fields[i].photcode);
    1414      }
    1515    }
     
    3030int GetMagMode (char *string) {
    3131
    32   if (!strcasecmp (string, "inst"))      return (MAG_INST);
    33   if (!strcasecmp (string, "cat"))       return (MAG_CAT);
    34   if (!strcasecmp (string, "sys"))       return (MAG_SYS);
    35   if (!strcasecmp (string, "rel"))       return (MAG_REL);
    36   if (!strcasecmp (string, "cal"))       return (MAG_CAL);
    37   if (!strcasecmp (string, "ave"))       return (MAG_AVE);
    38   if (!strcasecmp (string, "ref"))       return (MAG_REF);
    39   if (!strcasecmp (string, "ap"))       return (MAG_APER);
    40   if (!strcasecmp (string, "aper"))     return (MAG_APER);
    41   if (!strcasecmp (string, "err"))       return (MAG_ERR);
     32  if (!strcasecmp (string, "inst"))      return (MAG_INST);
     33  if (!strcasecmp (string, "cat"))       return (MAG_CAT);
     34  if (!strcasecmp (string, "sys"))       return (MAG_SYS);
     35  if (!strcasecmp (string, "rel"))       return (MAG_REL);
     36  if (!strcasecmp (string, "cal"))       return (MAG_CAL);
     37  if (!strcasecmp (string, "ave"))       return (MAG_AVE);
     38  if (!strcasecmp (string, "ref"))       return (MAG_REF);
     39  if (!strcasecmp (string, "ap"))       return (MAG_APER);
     40  if (!strcasecmp (string, "aper"))     return (MAG_APER);
     41  if (!strcasecmp (string, "err"))       return (MAG_ERR);
    4242  if (!strcasecmp (string, "photflags")) return (MAG_PHOT_FLAGS);
    43   if (!strcasecmp (string, "chisq"))     return (MAG_CHISQ);
    44   if (!strcasecmp (string, "ncode"))     return (MAG_NCODE);
    45   if (!strcasecmp (string, "nphot"))     return (MAG_NPHOT);
     43  if (!strcasecmp (string, "chisq"))     return (MAG_CHISQ);
     44  if (!strcasecmp (string, "ncode"))     return (MAG_NCODE);
     45  if (!strcasecmp (string, "nphot"))     return (MAG_NPHOT);
    4646  return (MAG_NONE);
    4747}
     
    140140  }
    141141
    142   if (!strcasecmp (fieldName, "RA"))         ESCAPE (MEAS_RA,             MAG_NONE, OPIHI_FLT);
    143   if (!strcasecmp (fieldName, "DEC"))        ESCAPE (MEAS_DEC,            MAG_NONE, OPIHI_FLT);
    144   if (!strcasecmp (fieldName, "RA:AVE"))     ESCAPE (MEAS_RA_AVE,         MAG_NONE, OPIHI_FLT);
    145   if (!strcasecmp (fieldName, "DEC:AVE"))    ESCAPE (MEAS_DEC_AVE,        MAG_NONE, OPIHI_FLT);
    146   if (!strcasecmp (fieldName, "RA:ERR"))     ESCAPE (MEAS_RA_AVE_ERR,     MAG_NONE, OPIHI_FLT);
    147   if (!strcasecmp (fieldName, "DEC:ERR"))    ESCAPE (MEAS_DEC_AVE_ERR,    MAG_NONE, OPIHI_FLT);
    148   if (!strcasecmp (fieldName, "uRA"))        ESCAPE (MEAS_U_RA,           MAG_NONE, OPIHI_FLT);
    149   if (!strcasecmp (fieldName, "uDEC"))       ESCAPE (MEAS_U_DEC,          MAG_NONE, OPIHI_FLT);
    150   if (!strcasecmp (fieldName, "duRA"))       ESCAPE (MEAS_U_RA_ERR,       MAG_NONE, OPIHI_FLT);
    151   if (!strcasecmp (fieldName, "duDEC"))      ESCAPE (MEAS_U_DEC_ERR,      MAG_NONE, OPIHI_FLT);
    152   if (!strcasecmp (fieldName, "PAR"))        ESCAPE (MEAS_PAR,            MAG_NONE, OPIHI_FLT);
    153   if (!strcasecmp (fieldName, "dPAR"))       ESCAPE (MEAS_PAR_ERR,        MAG_NONE, OPIHI_FLT);
    154   if (!strcasecmp (fieldName, "dR"))         ESCAPE (MEAS_RA_OFFSET,      MAG_NONE, OPIHI_FLT);
    155   if (!strcasecmp (fieldName, "dD"))         ESCAPE (MEAS_DEC_OFFSET,     MAG_NONE, OPIHI_FLT);
    156   if (!strcasecmp (fieldName, "dR:FIT"))     ESCAPE (MEAS_RA_FIT_OFFSET,  MAG_NONE, OPIHI_FLT);
    157   if (!strcasecmp (fieldName, "dD:FIT"))     ESCAPE (MEAS_DEC_FIT_OFFSET, MAG_NONE, OPIHI_FLT);
    158   if (!strcasecmp (fieldName, "dR:ERR"))     ESCAPE (MEAS_RA_OFFSET_ERR,  MAG_NONE, OPIHI_FLT);
    159   if (!strcasecmp (fieldName, "dD:ERR"))     ESCAPE (MEAS_DEC_OFFSET_ERR, MAG_NONE, OPIHI_FLT);
    160   if (!strcasecmp (fieldName, "xp"))         ESCAPE (MEAS_XP,             MAG_NONE, OPIHI_FLT);
    161   if (!strcasecmp (fieldName, "nmeas"))      ESCAPE (MEAS_NMEAS,          MAG_NONE, OPIHI_INT);
    162   if (!strcasecmp (fieldName, "nmiss"))      ESCAPE (MEAS_NMISS,          MAG_NONE, OPIHI_INT);
    163   if (!strcasecmp (fieldName, "objflags"))   ESCAPE (MEAS_OBJFLAGS,       MAG_NONE, OPIHI_INT);
    164   if (!strcasecmp (fieldName, "AIRMASS"))    ESCAPE (MEAS_AIRMASS,        MAG_NONE, OPIHI_FLT);
    165   if (!strcasecmp (fieldName, "ALT"))        ESCAPE (MEAS_ALT,            MAG_NONE, OPIHI_FLT);
    166   if (!strcasecmp (fieldName, "AZ"))         ESCAPE (MEAS_AZ,             MAG_NONE, OPIHI_FLT);
    167   if (!strcasecmp (fieldName, "EXPTIME"))    ESCAPE (MEAS_EXPTIME,        MAG_NONE, OPIHI_FLT);
    168   if (!strcasecmp (fieldName, "PHOTCODE"))   ESCAPE (MEAS_PHOTCODE,       MAG_NONE, OPIHI_INT);
    169   if (!strcasecmp (fieldName, "TIME"))       ESCAPE (MEAS_TIME,           MAG_NONE, OPIHI_FLT);
    170   if (!strcasecmp (fieldName, "FWHM"))       ESCAPE (MEAS_FWHM,           MAG_NONE, OPIHI_FLT);
    171   if (!strcasecmp (fieldName, "FWHM_MAJ"))   ESCAPE (MEAS_FWHM_MAJ,       MAG_NONE, OPIHI_FLT);
    172   if (!strcasecmp (fieldName, "FWHM_MIN"))   ESCAPE (MEAS_FWHM_MIN,       MAG_NONE, OPIHI_FLT);
    173   if (!strcasecmp (fieldName, "THETA"))      ESCAPE (MEAS_THETA,          MAG_NONE, OPIHI_FLT);
    174   if (!strcasecmp (fieldName, "DOPHOT"))     ESCAPE (MEAS_DOPHOT,         MAG_NONE, OPIHI_INT);
    175   if (!strcasecmp (fieldName, "DB_FLAGS"))   ESCAPE (MEAS_DB_FLAGS,       MAG_NONE, OPIHI_INT);
    176   if (!strcasecmp (fieldName, "PHOT_FLAGS")) ESCAPE (MEAS_PHOT_FLAGS,     MAG_NONE, OPIHI_INT);
    177   if (!strcasecmp (fieldName, "XCCD"))       ESCAPE (MEAS_XCCD,           MAG_NONE, OPIHI_FLT);
    178   if (!strcasecmp (fieldName, "YCCD"))       ESCAPE (MEAS_YCCD,           MAG_NONE, OPIHI_FLT);
    179   if (!strcasecmp (fieldName, "XCCD:ERR"))   ESCAPE (MEAS_XCCD_ERR,       MAG_NONE, OPIHI_FLT);
    180   if (!strcasecmp (fieldName, "YCCD:ERR"))   ESCAPE (MEAS_YCCD_ERR,       MAG_NONE, OPIHI_FLT);
    181   if (!strcasecmp (fieldName, "XMOSAIC"))    ESCAPE (MEAS_XMOSAIC,        MAG_NONE, OPIHI_FLT);
    182   if (!strcasecmp (fieldName, "YMOSAIC"))    ESCAPE (MEAS_YMOSAIC,        MAG_NONE, OPIHI_FLT);
    183   if (!strcasecmp (fieldName, "XCHIP"))      ESCAPE (MEAS_XCCD,           MAG_NONE, OPIHI_FLT);
    184   if (!strcasecmp (fieldName, "YCHIP"))      ESCAPE (MEAS_YCCD,           MAG_NONE, OPIHI_FLT);
    185   if (!strcasecmp (fieldName, "XFPA"))       ESCAPE (MEAS_XMOSAIC,        MAG_NONE, OPIHI_FLT);
    186   if (!strcasecmp (fieldName, "YFPA"))       ESCAPE (MEAS_YMOSAIC,        MAG_NONE, OPIHI_FLT);
    187   if (!strcasecmp (fieldName, "DETID"))      ESCAPE (MEAS_DET_ID,         MAG_NONE, OPIHI_INT);
    188   if (!strcasecmp (fieldName, "OBJID"))      ESCAPE (MEAS_OBJ_ID,         MAG_NONE, OPIHI_INT);
    189   if (!strcasecmp (fieldName, "CATID"))      ESCAPE (MEAS_CAT_ID,         MAG_NONE, OPIHI_INT);
    190   if (!strcasecmp (fieldName, "IMAGEID"))    ESCAPE (MEAS_IMAGE_ID,       MAG_NONE, OPIHI_INT);
    191   if (!strcasecmp (fieldName, "PSF_QF"))     ESCAPE (MEAS_PSF_QF,         MAG_NONE, OPIHI_FLT);
    192   if (!strcasecmp (fieldName, "PSF_CHISQ"))  ESCAPE (MEAS_PSF_CHISQ,      MAG_NONE, OPIHI_FLT);
    193   if (!strcasecmp (fieldName, "CR_NSIGMA"))  ESCAPE (MEAS_CR_NSIGMA,      MAG_NONE, OPIHI_FLT);
    194   if (!strcasecmp (fieldName, "EXT_NSIGMA")) ESCAPE (MEAS_EXT_NSIGMA,     MAG_NONE, OPIHI_FLT);
    195   if (!strcasecmp (fieldName, "SKY"))        ESCAPE (MEAS_SKY,            MAG_NONE, OPIHI_FLT);
    196   if (!strcasecmp (fieldName, "SKY_ERR"))    ESCAPE (MEAS_dSKY,           MAG_NONE, OPIHI_FLT);
     142  if (!strcasecmp (fieldName, "RA"))             ESCAPE (MEAS_RA,             MAG_NONE, OPIHI_FLT);
     143  if (!strcasecmp (fieldName, "DEC"))            ESCAPE (MEAS_DEC,            MAG_NONE, OPIHI_FLT);
     144  if (!strcasecmp (fieldName, "RA:AVE"))         ESCAPE (MEAS_RA_AVE,         MAG_NONE, OPIHI_FLT);
     145  if (!strcasecmp (fieldName, "DEC:AVE"))        ESCAPE (MEAS_DEC_AVE,        MAG_NONE, OPIHI_FLT);
     146  if (!strcasecmp (fieldName, "RA:ERR"))         ESCAPE (MEAS_RA_AVE_ERR,     MAG_NONE, OPIHI_FLT);
     147  if (!strcasecmp (fieldName, "DEC:ERR"))        ESCAPE (MEAS_DEC_AVE_ERR,    MAG_NONE, OPIHI_FLT);
     148  if (!strcasecmp (fieldName, "uRA"))            ESCAPE (MEAS_U_RA,           MAG_NONE, OPIHI_FLT);
     149  if (!strcasecmp (fieldName, "uDEC"))           ESCAPE (MEAS_U_DEC,          MAG_NONE, OPIHI_FLT);
     150  if (!strcasecmp (fieldName, "duRA"))           ESCAPE (MEAS_U_RA_ERR,       MAG_NONE, OPIHI_FLT);
     151  if (!strcasecmp (fieldName, "duDEC"))          ESCAPE (MEAS_U_DEC_ERR,      MAG_NONE, OPIHI_FLT);
     152  if (!strcasecmp (fieldName, "PAR"))            ESCAPE (MEAS_PAR,            MAG_NONE, OPIHI_FLT);
     153  if (!strcasecmp (fieldName, "dPAR"))           ESCAPE (MEAS_PAR_ERR,        MAG_NONE, OPIHI_FLT);
     154  if (!strcasecmp (fieldName, "dR"))             ESCAPE (MEAS_RA_OFFSET,      MAG_NONE, OPIHI_FLT);
     155  if (!strcasecmp (fieldName, "dD"))             ESCAPE (MEAS_DEC_OFFSET,     MAG_NONE, OPIHI_FLT);
     156  if (!strcasecmp (fieldName, "dR:FIT"))         ESCAPE (MEAS_RA_FIT_OFFSET,  MAG_NONE, OPIHI_FLT);
     157  if (!strcasecmp (fieldName, "dD:FIT"))         ESCAPE (MEAS_DEC_FIT_OFFSET, MAG_NONE, OPIHI_FLT);
     158  if (!strcasecmp (fieldName, "dR:ERR"))         ESCAPE (MEAS_RA_OFFSET_ERR,  MAG_NONE, OPIHI_FLT);
     159  if (!strcasecmp (fieldName, "dD:ERR"))         ESCAPE (MEAS_DEC_OFFSET_ERR, MAG_NONE, OPIHI_FLT);
     160  if (!strcasecmp (fieldName, "xp"))             ESCAPE (MEAS_XP,             MAG_NONE, OPIHI_FLT);
     161  if (!strcasecmp (fieldName, "nmeas"))          ESCAPE (MEAS_NMEAS,          MAG_NONE, OPIHI_INT);
     162  if (!strcasecmp (fieldName, "nmiss"))          ESCAPE (MEAS_NMISS,          MAG_NONE, OPIHI_INT);
     163  if (!strcasecmp (fieldName, "objflags"))       ESCAPE (MEAS_OBJFLAGS,       MAG_NONE, OPIHI_INT);
     164  if (!strcasecmp (fieldName, "AIRMASS"))        ESCAPE (MEAS_AIRMASS,        MAG_NONE, OPIHI_FLT);
     165  if (!strcasecmp (fieldName, "ALT"))            ESCAPE (MEAS_ALT,            MAG_NONE, OPIHI_FLT);
     166  if (!strcasecmp (fieldName, "AZ"))             ESCAPE (MEAS_AZ,             MAG_NONE, OPIHI_FLT);
     167  if (!strcasecmp (fieldName, "EXPTIME"))        ESCAPE (MEAS_EXPTIME,        MAG_NONE, OPIHI_FLT);
     168  if (!strcasecmp (fieldName, "PHOTCODE"))       ESCAPE (MEAS_PHOTCODE,       MAG_NONE, OPIHI_INT);
     169  if (!strcasecmp (fieldName, "PHOTCODE:EQUIV")) ESCAPE (MEAS_PHOTCODE_EQUIV, MAG_NONE, OPIHI_INT);
     170  if (!strcasecmp (fieldName, "TIME"))           ESCAPE (MEAS_TIME,           MAG_NONE, OPIHI_FLT);
     171  if (!strcasecmp (fieldName, "FWHM"))           ESCAPE (MEAS_FWHM,           MAG_NONE, OPIHI_FLT);
     172  if (!strcasecmp (fieldName, "FWHM_MAJ"))       ESCAPE (MEAS_FWHM_MAJ,       MAG_NONE, OPIHI_FLT);
     173  if (!strcasecmp (fieldName, "FWHM_MIN"))       ESCAPE (MEAS_FWHM_MIN,       MAG_NONE, OPIHI_FLT);
     174  if (!strcasecmp (fieldName, "THETA"))          ESCAPE (MEAS_THETA,          MAG_NONE, OPIHI_FLT);
     175  if (!strcasecmp (fieldName, "DOPHOT"))         ESCAPE (MEAS_DOPHOT,         MAG_NONE, OPIHI_INT);
     176  if (!strcasecmp (fieldName, "DB_FLAGS"))       ESCAPE (MEAS_DB_FLAGS,       MAG_NONE, OPIHI_INT);
     177  if (!strcasecmp (fieldName, "PHOT_FLAGS"))     ESCAPE (MEAS_PHOT_FLAGS,     MAG_NONE, OPIHI_INT);
     178  if (!strcasecmp (fieldName, "XCCD"))           ESCAPE (MEAS_XCCD,           MAG_NONE, OPIHI_FLT);
     179  if (!strcasecmp (fieldName, "YCCD"))           ESCAPE (MEAS_YCCD,           MAG_NONE, OPIHI_FLT);
     180  if (!strcasecmp (fieldName, "XCCD:ERR"))       ESCAPE (MEAS_XCCD_ERR,       MAG_NONE, OPIHI_FLT);
     181  if (!strcasecmp (fieldName, "YCCD:ERR"))       ESCAPE (MEAS_YCCD_ERR,       MAG_NONE, OPIHI_FLT);
     182  if (!strcasecmp (fieldName, "XMOSAIC"))        ESCAPE (MEAS_XMOSAIC,        MAG_NONE, OPIHI_FLT);
     183  if (!strcasecmp (fieldName, "YMOSAIC"))        ESCAPE (MEAS_YMOSAIC,        MAG_NONE, OPIHI_FLT);
     184  if (!strcasecmp (fieldName, "XCHIP"))          ESCAPE (MEAS_XCCD,           MAG_NONE, OPIHI_FLT);
     185  if (!strcasecmp (fieldName, "YCHIP"))          ESCAPE (MEAS_YCCD,           MAG_NONE, OPIHI_FLT);
     186  if (!strcasecmp (fieldName, "XFPA"))           ESCAPE (MEAS_XMOSAIC,        MAG_NONE, OPIHI_FLT);
     187  if (!strcasecmp (fieldName, "YFPA"))           ESCAPE (MEAS_YMOSAIC,        MAG_NONE, OPIHI_FLT);
     188  if (!strcasecmp (fieldName, "DETID"))          ESCAPE (MEAS_DET_ID,         MAG_NONE, OPIHI_INT);
     189  if (!strcasecmp (fieldName, "OBJID"))          ESCAPE (MEAS_OBJ_ID,         MAG_NONE, OPIHI_INT);
     190  if (!strcasecmp (fieldName, "CATID"))          ESCAPE (MEAS_CAT_ID,         MAG_NONE, OPIHI_INT);
     191  if (!strcasecmp (fieldName, "IMAGEID"))        ESCAPE (MEAS_IMAGE_ID,       MAG_NONE, OPIHI_INT);
     192  if (!strcasecmp (fieldName, "PSF_QF"))         ESCAPE (MEAS_PSF_QF,         MAG_NONE, OPIHI_FLT);
     193  if (!strcasecmp (fieldName, "PSF_CHISQ"))      ESCAPE (MEAS_PSF_CHISQ,      MAG_NONE, OPIHI_FLT);
     194  if (!strcasecmp (fieldName, "CR_NSIGMA"))      ESCAPE (MEAS_CR_NSIGMA,      MAG_NONE, OPIHI_FLT);
     195  if (!strcasecmp (fieldName, "EXT_NSIGMA"))     ESCAPE (MEAS_EXT_NSIGMA,     MAG_NONE, OPIHI_FLT);
     196  if (!strcasecmp (fieldName, "SKY"))            ESCAPE (MEAS_SKY,            MAG_NONE, OPIHI_FLT);
     197  if (!strcasecmp (fieldName, "SKY_ERR"))        ESCAPE (MEAS_dSKY,           MAG_NONE, OPIHI_FLT);
    197198
    198199  // for words that don't parse, try a photcode
  • branches/czw_branch/cleanup/Ohana/src/opihi/dvo/dbStackOps.c

    r20936 r25158  
    44  stack[0].type   = DB_STACK_NONE;
    55  stack[0].name   = NULL;
     6  stack[0].field  = 0;
     7  stack[0].FltValue = 0.0;
     8  stack[0].IntValue = 0;
    69}
    710
  • branches/czw_branch/cleanup/Ohana/src/opihi/include/dvoshell.h

    r25051 r25158  
    8383      MEAS_AZ,
    8484      MEAS_PHOTCODE,
     85      MEAS_PHOTCODE_EQUIV,
    8586      MEAS_TIME,
    8687      MEAS_FWHM,
  • branches/czw_branch/cleanup/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm

    r25151 r25158  
    2222                    $PSTAMP_SELECT_MASK
    2323                    $PSTAMP_SELECT_WEIGHT
    24                     $PSTAMP_SELECT_INVERSE
    2524                    $PSTAMP_SUCCESS
    2625                    $PSTAMP_SYSTEM_ERROR
     
    3534                    $PSTAMP_GONE
    3635                    $PSTAMP_NO_JOBS_QUEUED
    37                     $PSTAMP_NO_OVERLAP
    3836                    );
    3937our %EXPORT_TAGS = (standard => [@EXPORT_OK]);
     
    4846our $PSTAMP_SELECT_WEIGHT    = 4;
    4947
    50 our $PSTAMP_SELECT_INVERSE   = 1024;
    51 
    5248# job and result codes
    5349# NOTE: these must match the values in pstamp/src/pstamp.h
     
    5551our $PSTAMP_SYSTEM_ERROR     = 10;
    5652our $PSTAMP_NOT_IMPLEMENTED  = 11;
    57 our $PSTAMP_UNKNOWN_ERROR    = 12;
     53our $PSTAMP_UNKNOWN_ERROR   = 12;
    5854
    5955our $PSTAMP_DUP_REQUEST      = 20;
     
    6561our $PSTAMP_GONE             = 26;
    6662our $PSTAMP_NO_JOBS_QUEUED   = 27;
    67 our $PSTAMP_NO_OVERLAP       = 28;
    6863
    6964use IPC::Cmd 0.36 qw( can_run run );
  • branches/czw_branch/cleanup/doc/misc/docgen.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/czw_branch/cleanup/ippScripts/scripts/magic_destreak_revert.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/czw_branch/cleanup/ippScripts/scripts/publish_file.pl

    r25150 r25158  
    8383my %exp_id;                     # Exposure identifiers
    8484my %exp_name;                   # Exposure names
    85 my %direction;                  # Direction of subtraction
    8685{
    8786    my $command;                # Command to run
     
    115114        if ($stage eq 'diff') {
    116115            my $skycell_id = $comp->{skycell_id};
    117 
    118             # Positive direction
    119116            $files{"$skycell_id.pos"} = $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base );
     117            $files{"$skycell_id.neg"} = $ipprc->filename( "PPSUB.INVERSE.SOURCES", $path_base ) if
     118                defined $comp->{bothways} and $comp->{bothways};
    120119            $zp{"$skycell_id.pos"} = $zp;
     120            $zp{"$skycell_id.neg"} = $zp if defined $comp->{bothways} and $comp->{bothways};
    121121            $exp_id{"$skycell_id.pos"} = $comp->{exp_id_1};
     122            $exp_id{"$skycell_id.neg"} = $comp->{exp_id_2} if defined $comp->{bothways} and $comp->{bothways};
    122123            $exp_name{"$skycell_id.pos"} = $comp->{exp_name_1};
    123             $direction{"$skycell_id.pos"} = 1;
    124 
    125             # Negative direction
    126             if (defined $comp->{bothways} and $comp->{bothways}) {
    127                 $files{"$skycell_id.neg"} = $ipprc->filename( "PPSUB.INVERSE.SOURCES", $path_base );
    128                 $zp{"$skycell_id.neg"} = $zp;
    129                 $exp_id{"$skycell_id.neg"} = $comp->{exp_id_2};
    130                 $direction{"$skycell_id.neg"} = 0;
    131                 $exp_name{"$skycell_id.neg"} = $comp->{exp_name_2};
    132             }
    133 
     124            $exp_name{"$skycell_id.neg"} = $comp->{exp_name_2} if defined $comp->{bothways} and $comp->{bothways};
    134125        } elsif ($stage eq 'camera') {
    135126            my $cam_id = $comp->{cam_id};
     
    138129            $exp_id{$cam_id} = $comp->{exp_id};
    139130            $exp_name{$cam_id} = $comp->{exp_name};
    140             $direction{$cam_id} = 1;
    141131        }
    142132    }
     
    155145    my $exp_id = $exp_id{$comp};
    156146    my $exp_name = $exp_name{$comp};
    157     my $direction = $direction{$comp};
    158147    if ($product eq "IPP-MOPS") {
    159148        my $outuri = "$outroot.$comp.fits";
     
    161150            &my_die( "Unable to resolve output file $outuri", $pub_id, $PS_EXIT_SYS_ERROR);
    162151
    163         my $command = "$ppMops $file $zp $exp_id $exp_name $direction $out";
     152        my $command = "$ppMops $file $zp $exp_id $exp_name $out";
    164153        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    165154            run(command => $command, verbose => $verbose);
  • branches/czw_branch/cleanup/ippTasks/pstamp.pro

    r25051 r25158  
    178178        book getword pstampRequest $pageName ds_outProduct -var PRODUCT
    179179
     180        host anyhost
     181
    180182        $run = pstamp_parser_run.pl --req_id $REQ_ID --uri $URI --product $PRODUCT --redirect-output
    181183
     
    374376        end
    375377
     378        host anyhost
    376379
    377380        $run = pstamp_job_run.pl --job_id $JOB_ID --job_type $JOB_TYPE --rownum $ROWNUM --output_base $OUTPUT_BASE --redirect-output
  • branches/czw_branch/cleanup/ippTests/tap/mailTestResults.pl

    r25051 r25158  
    66use Email::Send;
    77
    8 my $email="giebink\@ifa.hawaii.edu";
     8my $email="ps-ipp-dev\@ifa.hawaii.edu";
    99
    1010my $today = `date -u +%Y%m%d`;
  • branches/czw_branch/cleanup/ippTests/tap/proveParser.pl

    r25051 r25158  
    1313while (<IF>) {
    1414  print $_;
    15   if (/Failed Test                      Stat Wstat Total Fail  List of Failed/) {
     15  if (/^Failed Test/) {
    1616    $flag = 1;
    1717  }
  • branches/czw_branch/cleanup/ippTests/tap/tapTest.pl

    r25051 r25158  
    66
    77#delete modules with tap tests
    8 system `rm -rf /data/ipp001.0/ippTests/tap/ipp/Nebulous/*`;
     8system `rm -rf /data/ipp001.0/ippTests/tap/ipp/Nebulous`;
    99
    1010#delete Nebulous binaries
     
    2828        chdir "/data/ipp001.0/ippTests/tap/ipp/$dir/nebclient";
    2929        system ("autogen.sh --prefix=/data/ipp001.0/ippTests/tap/usr");
    30         system ("make");
     30        system ("/usr/bin/make");
    3131        chdir "/data/ipp001.0/ippTests/tap/ipp/$dir";
    3232        system ("perl Build.PL --prefix=/data/ipp001.0/ippTests/tap/usr");
  • branches/czw_branch/cleanup/ippTools/share/Makefile.am

    r25147 r25158  
    180180     magicdstool_torevert_warp.sql \
    181181     magicdstool_torevert_diff.sql \
    182      pstamptool_addjob_otherjob.sql \
    183      pstamptool_addjob_stampjob.sql \
    184182     pstamptool_datastore.sql \
    185183     pstamptool_pendingjob.sql \
  • branches/czw_branch/cleanup/ippTools/share/difftool_skyfile.sql

    r24512 r25158  
    66    diffRun.workdir,
    77    diffRun.bothways,
    8     camProcessedExp.zpt_obs,
    9     camProcessedExp.zpt_stdev,
    10     camProcessedExp.zpt_lq,
    11     camProcessedExp.zpt_uq,
    12     rawExp.exp_time,
    13     rawExp.camera,
    148    warp1,
    159    stack1,
    1610    warp2,
    17     stack2
     11    stack2,
     12    -- The following are only valid for warps
     13    -- XXX This needs to be more clever to handle diffs between stacks
     14    camProcessedInput.zpt_obs,
     15    camProcessedInput.zpt_stdev,
     16    camProcessedInput.zpt_lq,
     17    camProcessedInput.zpt_uq,
     18    rawInput.exp_time,
     19    rawInput.camera,
     20    rawInput.exp_name AS exp_name_1,
     21    rawTemplate.exp_name AS exp_name_2,
     22    rawInput.exp_id AS exp_id_1,
     23    rawTemplate.exp_id AS exp_id_2
    1824FROM diffRun
    1925JOIN diffSkyfile USING(diff_id)
    2026JOIN diffInputSkyfile USING(diff_id, skycell_id)
    21 JOIN warpRun
    22 -- NOTE: joining input only!
    23 -- This is so that we can get the correct zero point
    24 -- XXX This needs to be more clever to handle diffs between stacks
    25     ON warpRun.warp_id = diffInputSkyfile.warp1
    26 JOIN fakeRun USING(fake_id)
    27 JOIN camRun USING(cam_id)
    28 JOIN camProcessedExp USING(cam_id)
    29 JOIN chipRun USING(chip_id)
    30 JOIN rawExp USING(exp_id)
     27LEFT JOIN warpRun AS warpInput
     28    ON warpInput.warp_id = diffInputSkyfile.warp1
     29LEFT JOIN fakeRun AS fakeInput
     30    ON fakeInput.fake_id = warpInput.fake_id
     31LEFT JOIN camRun AS camInput
     32    ON camInput.cam_id = fakeInput.cam_id
     33LEFT JOIN camProcessedExp AS camProcessedInput
     34    ON camProcessedInput.cam_id = camInput.cam_id
     35LEFT JOIN chipRun AS chipInput
     36    ON chipInput.chip_id = camInput.chip_id
     37LEFT JOIN rawExp AS rawInput
     38    ON rawInput.exp_id = chipInput.exp_id
     39LEFT JOIN warpRun AS warpTemplate
     40    ON warpTemplate.warp_id = diffInputSkyfile.warp2
     41LEFT JOIN fakeRun AS fakeTemplate
     42    ON fakeTemplate.fake_id = warpTemplate.fake_id
     43LEFT JOIN camRun AS camTemplate
     44    ON camTemplate.cam_id = fakeTemplate.cam_id
     45LEFT JOIN chipRun AS chipTemplate
     46    ON chipTemplate.chip_id = camTemplate.chip_id
     47LEFT JOIN rawExp AS rawTemplate
     48    ON rawTemplate.exp_id = chipTemplate.exp_id
  • branches/czw_branch/cleanup/ippTools/src/difftool.c

    r25051 r25158  
    584584    PXOPT_COPY_STR(config->args, where, "-tess_id", "diffRun.tess_id", "==");
    585585    PXOPT_COPY_S16(config->args, where, "-fault", "diffSkyfile.fault", "==");
    586     PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "==");
    587     PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "==");
    588     PXOPT_COPY_STR(config->args, where, "-warp_id", "warpRun.warp_id", "==");
     586    PXOPT_COPY_S64(config->args, where, "-exp_id", "rawInput.exp_id", "==");
     587    PXOPT_COPY_STR(config->args, where, "-exp_name", "rawInput.exp_name", "==");
     588    PXOPT_COPY_STR(config->args, where, "-warp_id", "warpInput.warp_id", "==");
    589589
    590590    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     
    11791179
    11801180        if (!available && (num != skycell_count)) {
    1181             psTrace("difftool", PS_LOG_INFO, "%" PRId64 " skyfiles with stack found for warp_id %"
    1182                 PRId64 " need %" PRId64, num, skycell_count, warp_id);
     1181            psTrace("difftool", PS_LOG_INFO, "%" PRId64 " skyfiles with stack found for warp_id %" PRId64
     1182                    " need %" PRId64, num, warp_id, skycell_count);
    11831183            continue;
    11841184        }
  • branches/czw_branch/cleanup/ippTools/src/pstamptool.c

    r25149 r25158  
    315315    PS_ASSERT_PTR_NON_NULL(config, false);
    316316
    317     psMetadata *where = psMetadataAlloc();
    318     PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "==");
    319     PXOPT_COPY_STR(config->args, where, "-name", "name", "==");
    320 
     317    PXOPT_LOOKUP_S64(req_id,  config->args, "-req_id", false, false);
     318    PXOPT_LOOKUP_STR(name,  config->args, "-name", false, false);
    321319    PXOPT_LOOKUP_U64(limit,   config->args, "-limit",  false, false);
    322320    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    323321
    324     if (!psListLength(where->list)) {
     322    if (!req_id && !name) {
    325323        psError(PS_ERR_UNKNOWN, true, "-req_id or -name must be supplied");
    326324        return false;
    327325    }
    328326
    329     psString query = psStringCopy("SELECT * from pstampRequest");
    330 
    331     psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    332     psStringAppend(&query, " WHERE %s", whereClause);
    333     psFree(whereClause);
    334     psFree(where);
     327    psString query = NULL;
     328    psStringAppend(&query, "SELECT * from pstampRequest WHERE req_id = %" PRId64, req_id);
    335329   
    336330    // treat limit == 0 as "no limit"
     
    529523
    530524    // default value for job_type is defined in pstamptoolConfig.c
    531     if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query") || !strcmp(job_type, "none")) {
     525    if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query")) {
    532526        stampJob = false;
    533527    } else if (!strcmp(job_type, "stamp")) {
  • branches/czw_branch/cleanup/ippTools/src/pstamptoolConfig.c

    r25051 r25158  
    7575    // -listreq
    7676    psMetadata *listreqArgs = psMetadataAlloc();
    77     psMetadataAddS64(listreqArgs, PS_LIST_TAIL, "-req_id", 0,            "define req_id (required)", 0);
     77    psMetadataAddS64(listreqArgs, PS_LIST_TAIL, "-req_id", 0,            "list by req_id", 0);
     78    psMetadataAddStr(listreqArgs, PS_LIST_TAIL, "-name", 0,              "list by name", NULL);
    7879    psMetadataAddU64(listreqArgs, PS_LIST_TAIL, "-limit",  0,            "limit result set to N items", 0);
    7980    psMetadataAddBool(listreqArgs, PS_LIST_TAIL, "-simple", 0,            "use the simple output format", false);
     
    106107    psMetadataAddStr(addjobArgs, PS_LIST_TAIL, "-state", 0,            "new state", "run");
    107108    psMetadataAddS64(addjobArgs, PS_LIST_TAIL, "-exp_id", 0,           "exposure id", 0);
    108     psMetadataAddStr(addjobArgs, PS_LIST_TAIL, "-fault", 0,            "new result", NULL);
     109    psMetadataAddS16(addjobArgs, PS_LIST_TAIL, "-fault", 0,            "new result", 0);
    109110
    110111    // -listjob
  • branches/czw_branch/cleanup/magic/Makefile.in

    r24951 r25158  
    1212
    1313update:
    14         # get the source code (replace this with SVN interactions)
     14# get the source code (replace this with SVN interactions)
    1515        tar xvzf ~/magic.tgz
    1616        tar xvzf ~/ssa-core-cpp.tgz
  • branches/czw_branch/cleanup/magic/censorObjects/src/censorLoop.c

    r24951 r25158  
    2222 */
    2323bool censorLoop (pmConfig *config) {
    24 
    2524    pmChip *chip;
    2625    pmCell *cell;
     
    2827
    2928    psTimerStart ("censor");
     29
     30
     31
    3032
    3133    // select the current recipe
     
    5153
    5254    pmFPAview *view = pmFPAviewAlloc (0);
     55
    5356    bool badMaskFile = false;
    5457
     
    5962    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    6063
     64    // check PHU header to see if we are using mosaic-level or per-chip astrometry
     65    bool bilevelAstrometry = false;
     66    pmHDU *phu = pmFPAviewThisPHU (view, input->fpa);
     67    if (phu) {
     68      char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");
     69      if (ctype) bilevelAstrometry = !strcmp (&ctype[4], "-DIS");
     70    }
     71    if (bilevelAstrometry) {
     72      pmAstromReadBilevelMosaic (input->fpa, phu->header);
     73    }
     74
    6175    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    6276        psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    6377        if (!chip->process || !chip->file_exists) { continue; }
    64 
     78       
    6579        // check on the mask file at this level if possible
    6680        badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
    6781
    6882        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
     83
     84        // read WCS data from the corresponding header
     85
     86        pmHDU *hdu = pmFPAviewThisHDU (view, input->fpa);
     87       
     88        if (bilevelAstrometry) {
     89          if (!pmAstromReadBilevelChip (chip, hdu->header)) {
     90            psWarning("Could not get WCS information from header for chip %d, skipping", view->chip);
     91            continue;
     92          }
     93        } else {
     94          if (!pmAstromReadWCS(input->fpa, chip, hdu->header, 1.0)) {
     95            psWarning( "Unable to read WCS astrometry from chip %d, skipping", view->chip);
     96            continue;
     97          }
     98        }
    6999
    70100        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
  • branches/czw_branch/cleanup/magic/remove/src/Line.c

    r25051 r25158  
    3636    // If the current line is not vertical, check to see if the point
    3737    // is inside the two endpoints independent of direction
    38    
     38
    3939    if (line->begin.x != line->end.x)
    4040    {
     
    5959    ux = line->end.x - line->begin.x;
    6060    uy = line->end.y - line->begin.y;
    61    
     61
    6262    vx = x - line->begin.x;
    6363    vy = y - line->begin.y;
    64    
     64
    6565    double u_u = ux * ux + uy * uy;                         // (u . u)
    6666    double u_v = ux * vx + uy * vy;                         // (u . v)
    67    
     67
    6868    if (u_v <= 0) return vx * vx + vy * vy;                 // (v . v)
    6969    if (u_u <= u_v)
     
    7373        return wx * wx + wy * wy;                           // (w . w)
    7474    }
    75    
     75
    7676    // Compute P(b) is the base of the perpendicular dropped from tuple to
    7777    // the line
    78    
     78
    7979    b = u_v / u_u;
    8080    px = vx - b * ux;
     
    109109    double wx  = first->begin.x - second->begin.x;
    110110    double wy  = first->begin.y - second->begin.y;
    111    
     111
    112112    // Calculate the perpendicular product, dt
    113    
     113
    114114    double dt = dx1 * dy2 - dy1 * dx2;
    115    
     115
    116116    // Are the lines parallel?
    117    
     117
    118118    if (fabs (dt) <= 1e-8)
    119119    {
    120120        // Check to see if they are overlap
    121        
     121
    122122        if (dx1 * wy - dy1 * wx != 0 || dx2 * wy - dy2 * wx != 0) return 0;
    123        
     123
    124124        // The line are coplanar, so check to see if they are degenerate
    125        
     125
    126126        len1 = dx1 * dx1 + dy1 * dy1;
    127127        len2 = dx2 * dx2 + dy2 * dy2;
    128        
     128
    129129        // First, check to see if both lines are points and if they are
    130130        // distinct tuples
    131        
     131
    132132        if (len1 == 0 && len2 == 0)
    133133        {
     
    137137            return 1;
    138138        }
    139        
     139
    140140        // Check to see if the first line is a point and is inside the
    141141        // second line
    142        
     142
    143143        if (len1 == 0)
    144144        {
     
    148148                return 0;
    149149        }
    150        
     150
    151151        // Check to see if the second line is a point and is inside the
    152152        // first line
    153        
     153
    154154        if (len2 == 0)
    155155        {
     
    159159                return 0;
    160160        }
    161        
     161
    162162        // Since both lines are coplanar and have length, search for
    163163        // overlap tuples
    164        
     164
    165165        w2x = first->end.x - second->begin.x;
    166166        w2y = first->end.y - second->begin.y;
    167        
     167
    168168        t0 = (dx2 != 0) ? wx  / dx2 : wy  / dy2;
    169169        t1 = (dx2 != 0) ? w2x / dx2 : w2y / dy2;
    170        
     170
    171171        if (t0 > t1) SwapDouble (&t0, &t1);
    172172        if ((inFirstSegment || inSecondSegment) && (t0 > 1 || t1 < 0))
     
    176176        t0 = (t0 < 0) ? 0 : t0;             // Clip to min 0
    177177        t1 = (t1 > 1) ? 1 : t1;             // Clip to max 1
    178        
     178
    179179        // Set the first tuple of intersection
    180        
     180
    181181        tuple1->x = second->begin.x + t0 * dx2;
    182182        tuple1->y = second->begin.y + t0 * dy2;
    183        
     183
    184184        // Check to see if the intersection is a single tuple
    185        
     185
    186186        if (t0 == t1) return 1;
    187        
     187
    188188        // Otherwise, set the second tuple of intersection as well
    189        
     189
    190190        tuple2->x = second->begin.x + t1 * dx2;
    191191        tuple2->y = second->begin.y + t1 * dy2;
    192192        return 2;
    193193    }
    194    
     194
    195195    // The segments are skew and may intersect in a tuple.
    196196    // Get the intersect parameter for the first line
    197    
     197
    198198    double i1 = (dx2 * wy - dy2 * wx) / dt;
    199199    if (inFirstSegment && (i1 < 0 || i1 > 1)) return 0;
    200    
     200
    201201    // Get the intersect parameter for the second line
    202202
     
    226226    vertices[3].x = 0;       vertices[3].y = numRows;
    227227
     228    clipLine.begin.x = 0;
     229    clipLine.begin.y = 0;
     230    clipLine.end.x = 0;
     231    clipLine.end.y = 0;
     232
    228233    for (i = 0; i < 4 && found < 2; ++i)
    229234    {
     
    237242                ++found;
    238243            }
    239             else if (tuple1.x != clipLine.begin.x || 
     244            else if (tuple1.x != clipLine.begin.x ||
    240245                     tuple1.y != clipLine.begin.y)
    241246            {
     
    245250        }
    246251    }
    247    
     252
    248253    // If two endpoints are found, clip the line
    249    
     254
    250255    if (found > 1)
    251256    {
     
    283288    vertices[3].x = minX; vertices[3].y = maxY;
    284289
     290    clipLine.begin.x = 0;
     291    clipLine.begin.y = 0;
     292    clipLine.end.x = 0;
     293    clipLine.end.y = 0;
     294
    285295    for (i = 0; i < 4 && found < 2; ++i)
    286296    {
     
    294304                ++found;
    295305            }
    296             else if (tuple1.x != clipLine.begin.x || 
     306            else if (tuple1.x != clipLine.begin.x ||
    297307                     tuple1.y != clipLine.begin.y)
    298308            {
     
    302312        }
    303313    }
    304    
     314
    305315    // If two endpoints are found, clip the line
    306    
     316
    307317    if (found > 1)
    308318    {
     
    360370    @param[out] pixels list of PixelPos pointers corresponding
    361371                       based on the line settings
    362     @param[in] line Line to map to pixels   
     372    @param[in] line Line to map to pixels
    363373    @param[in] numCols maximum X (columns) for the line
    364374    @param[in] numRows maximum Y (rows) for the line            */
     
    367377{
    368378    Line offsetLine;
    369     PixelPos *pixel;
    370379    double slope, xOffset, yOffset, xMid, yMid;
    371380    int x, y, xBegin = numCols, yBegin = numRows, xEnd = 0, yEnd = 0;
    372381
    373382    // Extract the endpoints
    374    
     383
    375384    double x1 = line->begin.x;
    376385    double y1 = line->begin.y;
    377386    double x2 = line->end.x;
    378387    double y2 = line->end.y;
    379    
     388
    380389    // Determine the width and height of the line
    381    
     390
    382391    double dx = x2 - x1;
    383392    double dy = y2 - y1;
     
    403412
    404413    // Step point by point based on the dominate axis
    405    
     414
    406415    if (fabs (dx) > fabs (dy))
    407416    {
     
    411420        // If line is back to front, reorder endpoints and recompute
    412421        // the line width and height
    413        
     422
    414423        if (x1 > x2)
    415424        {
     
    421430
    422431        // Compute the slope of the line
    423        
     432
    424433        slope = dy / dx;
    425        
     434
    426435        // Compute the x and y offsets for the line width extent
    427436
    428         if (xBegin > xEnd) 
     437        if (xBegin > xEnd)
    429438            SwapInt (&xBegin, &xEnd);
    430439        else
     
    451460    }
    452461    else
    453     {       
     462    {
    454463        // -------------------
    455464        // vertical(ish) lines
     
    457466        // If line is back to front, reorder endpoints and recompute
    458467        // the line width and height
    459        
     468
    460469        if (y1 > y2)
    461470        {
     
    465474            dy = y2 - y1;
    466475        }
    467        
     476
    468477        // Compute the slope of the line
    469        
     478
    470479        slope = dx / dy;
    471        
     480
    472481        // Compute the x and y offsets for the line width extent
    473482
     
    481490        xMid = x1 + slope * (yBegin - y1);
    482491        xOffset = fabs (halfWidth * dr / dy);
    483        
     492
    484493        for (y = yBegin; y != yEnd; ++y)
    485494        {
  • branches/czw_branch/cleanup/magic/remove/src/Makefile.simple

    r24951 r25158  
    3636
    3737STREAKSFLAGS=-DSTREAKS_COMPRESS_OUTPUT=1
    38 OPTFLAGS= -g -O2
     38OPTFLAGS= -g -O2 -Wall -Werror
    3939#OPTFLAGS= -g
    40 CFLAGS=`psmodules-config --cflags` -std=gnu99 ${OPTFLAGS} ${STREAKSFLAGS}
    41 #CFLAGS=`psmodules-config --cflags` -std=gnu99 ${OPTFLAGS}
    42 LDFLAGS=`psmodules-config --libs`
     40CFLAGS=`psmodules-config --cflags` `pslib-config --cflags` -std=gnu99 ${OPTFLAGS} ${STREAKSFLAGS}
     41#CFLAGS=`psmodules-config --cflags` `pslib-config --cflags` -std=gnu99 ${OPTFLAGS}
     42LDFLAGS=`psmodules-config --libs` `pslib-config --libs`
    4343
    4444PROGRAMS= streaksremove streaksreplace streakscompare streaksrelease isdestreaked
  • branches/czw_branch/cleanup/magic/remove/src/isdestreaked.c

    r24951 r25158  
    1818    psFits *fits = psFitsOpen(fileName, "r");
    1919    if (!fits) {
    20         psError(PS_ERR_UNKNOWN, false, "failed to open fits file: %s\n", fileName);
    21         psErrorStackPrint(stderr, "");
     20        psErrorStackPrint(stderr, "failed to open fits file: %s\n", fileName);
    2221        exit(PS_EXIT_DATA_ERROR);
    2322    }
     
    2524    psMetadata *header = psFitsReadHeader(NULL, fits);
    2625    if (!header) {
    27         psError(PS_ERR_IO, false, "failed to read header for: %s", fileName);
    28         psErrorStackPrint(stderr, "");
     26        psErrorStackPrint(stderr, "failed to read header for: %s", fileName);
    2927        exit(PS_EXIT_DATA_ERROR);
    3028    }
  • branches/czw_branch/cleanup/magic/remove/src/streaksastrom.c

    r24951 r25158  
    9393    // since the transform already accounts for the chip parity we just use the cell parity
    9494    astrom->xParity = (double) xParityCell;
    95     astrom->yParity = (double) yParityCell; 
     95    astrom->yParity = (double) yParityCell;
    9696
    9797    astrom->numCols = numCols;
     
    135135
    136136void
    137 cellToChipInt(int *xChip, int *yChip, strkAstrom *astrom, int xCell, int yCell)
     137cellToChipInt(unsigned int *xChip, unsigned int *yChip, strkAstrom *astrom, int xCell, int yCell)
    138138{
    139139    if (astrom->xParity > 0) {
     
    148148    }
    149149}
    150  
     150
    151151bool
    152152SkyToLocal(strkPt *outPt, strkAstrom *astrom, double ra, double dec)
     
    156156
    157157    pmFPA *fpa   = (pmFPA *) astrom->fpa;
    158     pmChip *chip = (pmChip *) astrom->chip;
    159158
    160159    // find the RA,DEC coords of the 0,0 pixel for this chip:
     
    183182
    184183    pmFPA *fpa   = (pmFPA *) astrom->fpa;
    185     pmChip *chip = (pmChip *) astrom->chip;
    186184
    187185    // find the RA,DEC coords of the 0,0 pixel for this chip:
     
    251249    pmChip *chip = (pmChip *) astrom->chip;
    252250    pmAstromObj *pt = (pmAstromObj *) astrom->pt;
    253    
     251
    254252    pt->sky->r = ra;
    255253    pt->sky->d = dec;
     
    276274    pmChip *chip = (pmChip *) astrom->chip;
    277275    pmAstromObj *pt = (pmAstromObj *) astrom->pt;
    278    
     276
    279277    cellToChip(&pt->chip->x, &pt->chip->y, astrom, x, y);
    280278
     
    294292}
    295293
    296  
     294
    297295static bool
    298296readAstrometry(streakFiles *sf)
     
    362360            break;
    363361        }
    364     } 
     362    }
    365363    if (!sf->chip) {
    366364        psError(PS_ERR_UNKNOWN, true, "Failed to find chip with data.");
  • branches/czw_branch/cleanup/magic/remove/src/streakscompare.c

    r21156 r25158  
    55int main(int argc, char *argv[])
    66{
    7     long i;
    87    bool status;
    98
     
    3534    int numErrors = 0;
    3635    for (int component = 0; component < ncomponents; component++) {
    37         if (component && !(psFitsMoveExtNum(file1->fits, 1, true) 
     36        if (component && !(psFitsMoveExtNum(file1->fits, 1, true)
    3837                           && psFitsMoveExtNum(file2->fits, 1, true))) {
    3938            streaksExit("failed to advance to next extesion\n", PS_EXIT_DATA_ERROR);
     
    4544        psImage *image2 = file2->image;
    4645
    47         // TODO: do more sanity checking. For example check that extname's  (if any) match 
     46        // TODO: do more sanity checking. For example check that extname's  (if any) match
    4847        // check for matching image cubes
    4948        if (image1 && image2) {
     
    6867                        error = ! isnan(value1) && isnan(value2);
    6968                    }
    70                    
     69
    7170                    if (error) {
    7271                        numErrors++;
  • branches/czw_branch/cleanup/magic/remove/src/streaksextern.h

    r25051 r25158  
    5454            pixels
    5555*/
    56    
     56
    5757extern StreakPixels *streak_on_component(Streaks *streaks, strkAstrom *astrom,
    5858                                         int numCols, int numRows);
  • branches/czw_branch/cleanup/magic/remove/src/streaksio.c

    r24951 r25158  
    1212// Assumptions about the file structure of non-raw files
    1313// The 'image' for each file (image, mask weight) is contained in the first
    14 // extension. 
     14// extension.
    1515
    1616
     
    625625        streaksExit("", PS_EXIT_DATA_ERROR);
    626626    }
    627  
     627
    628628    bool status;
    629629    in->extname = psMetadataLookupStr(&status, in->header, "EXTNAME");
     
    654654            streaksExit("", PS_EXIT_DATA_ERROR);
    655655        }
    656         psImage *image = (psImage *) (in->imagecube->data[0]);
    657656    }
    658657    setDataExtent(stage, in, (stage == IPP_STAGE_RAW) && !isMask);
     
    925924replicateOutputs(streakFiles *sfiles)
    926925{
    927     bool status = false;
    928 
    929926    if (!replicate(sfiles->outImage, sfiles->inImage)) {
    930927        psError(PM_ERR_SYS, false, "failed to replicate outImage.");
     
    973970
    974971        if (!nebSwap(server, in->name, out->name)) {
    975             psError(PM_ERR_SYS, true, "failed to swap files for: %s.",
     972            psError(PM_ERR_SYS, true, "failed to swap files for %s: %s.",
    976973                in->name, nebErr(server));
    977974            return false;
     
    10971094setMaskedToNAN(streakFiles *sfiles, psU32 maskMask, bool printCounts)
    10981095{
    1099         int maskedPixels = 0;
    1100         int nandPixels = 0;
    1101         int nandWeights = 0;
     1096        long maskedPixels = 0;
     1097        long nandPixels = 0;
     1098        long nandWeights = 0;
    11021099
    11031100        psImage *image = sfiles->outImage->image;
     
    11201117                psU32 maskVal;
    11211118                if (sfiles->stage == IPP_STAGE_RAW) {
    1122                     int xChip, yChip;
     1119                    unsigned int xChip, yChip;
    11231120                    cellToChipInt(&xChip, &yChip, sfiles->astrom, x, y);
    11241121                    maskVal = psImageGet(mask, xChip, yChip);
     
    11441141        if (printCounts) {
    11451142            psLogMsg(sfiles->program_name, PS_LOG_INFO, "time to NAN mask pixels: %f\n", psTimerClear("NAN_MASKED"));
    1146             int totalPixels = image->numRows * image->numCols;
     1143            long totalPixels = image->numRows * image->numCols;
    11471144            psLogMsg(sfiles->program_name, PS_LOG_INFO, "pixels:        %10ld\n", totalPixels);
    11481145            psLogMsg(sfiles->program_name, PS_LOG_INFO, "masked pixels: %10ld %4.2f%%\n", maskedPixels, 100. * maskedPixels / totalPixels);
  • branches/czw_branch/cleanup/magic/remove/src/streaksrelease.c

    r24951 r25158  
    33static pmConfig *parseArguments(int argc, char **argv);
    44static bool readAndCopyToOutput(streakFiles *sf, bool exciseAll);
    5 static StreakPixels * getStreakPixels(streakFiles *sfiles, Streaks *streaks);
    6 static void exciseNonWarpedPixels(streakFiles *sfiles, double newMaskValue);
    7 static bool warpedPixel(streakFiles *sfiles, PixelPos *cellCoord);
    8 static void excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue);
    95static void writeImages(streakFiles *sf, bool exciseImageCube);
    106
     
    128main(int argc, char *argv[])
    139{
    14     bool status;
    15 
    1610    psLibInit(NULL);
    1711    psTimerStart("STREAKSREMOVE");
     
    2519    // Values to set for masked pixels
    2620    psU32 maskStreak = 0;           // for the image and weight (usually NAN, MAXINT for integer images)
    27     psU32 maskMask = 0;             // value looked up for MASK.STREAK 
     21    psU32 maskMask = 0;             // value looked up for MASK.STREAK
    2822
    2923    // Does true work here?
     
    216210        // image data directly from psFits
    217211        readImage(sf->inImage, sf->extnum, sf->stage, false);
    218        
     212
    219213        // astrom struct is only needed for raw stage, and only the chip to cell parameters are used
    220214        sf->astrom = streakSetAstrometry(sf->astrom, sf->stage, NULL, NULL, false,
     
    304298            initValue = NAN;
    305299        } else {
    306             // otherwise write it to the output 
     300            // otherwise write it to the output
    307301            writeImageCube(sf->outImage, sf->inImage->imagecube, extname, sf->extnum);
    308302            initValue = 0;
  • branches/czw_branch/cleanup/magic/remove/src/streaksremove.c

    r25051 r25158  
    3535    // Values to set for masked pixels
    3636    psU32 maskStreak = 0;           // for the image and weight (usually NAN, MAXINT for integer images)
    37     psU32 maskMask = 0;             // value looked up for MASK.STREAK 
     37    psU32 maskMask = 0;             // value looked up for MASK.STREAK
    3838
    3939    psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS");
     
    4242    Streaks *streaks = readStreaksFile(streaksFileName);
    4343    if (!streaks) {
    44         psError(PS_ERR_UNKNOWN, "failed to read streaks file: %s", streaksFileName);
     44        psError(PS_ERR_UNKNOWN, false, "failed to read streaks file: %s", streaksFileName);
    4545        streaksExit("", PS_EXIT_PROG_ERROR);
    4646    }
     
    8383        psLogMsg("streaksremove", PS_LOG_INFO, "time to compute warped pixels: %f\n", cwp_t);
    8484    }
    85    
     85
    8686    if (sfiles->stage == IPP_STAGE_RAW) {
    8787        // Except for raw stage, all of our (GPC1) files have one image extension.
     
    9797    }
    9898
    99     int totalPixels = 0;
    100     int totalStreakPixels = 0;
     99    long totalPixels = 0;
     100    long totalStreakPixels = 0;
    101101
    102102    // Iterate through each component of the input (except for raw images there is only one)
     
    132132                                                        sfiles->inImage->numRows);
    133133            psLogMsg("streaksremove", PS_LOG_INFO, "time to get streak pixels: %f\n", psTimerClear("GET_STREAK_PIXELS"));
    134            
     134
    135135            // if this extension contained an image, excise the streaked pixels.
    136136            // otherwise it contained an image cube (video cell) which is handled in the if block
     
    172172                }
    173173
    174             } else { 
     174            } else {
    175175                // this component contains an image cube
    176176                // For now excise it completely
     
    215215
    216216    if (!replicateOutputs(sfiles)) {
    217         psError(PS_ERR_UNKNOWN, false, "failed to replicate output files");
     217        psErrorStackPrint(stderr, "failed to replicate output files");
    218218        deleteTemps(sfiles);
    219         psErrorStackPrint(stderr, "");
    220219        exit(PS_EXIT_UNKNOWN_ERROR);
    221220    }
     
    247246    pmConceptsDone();
    248247    pmModelClassCleanup();
    249     streaksNebulousCleanup(); 
     248    streaksNebulousCleanup();
    250249    pmConfigDone();
    251250    psLogMsg("streaksremove", PS_LOG_INFO, "time to run streaksremove: %f\n", psTimerClear("STREAKSREMOVE"));
     
    356355            true);
    357356    }
    358    
     357
    359358    if ((argnum = psArgumentGet(argc, argv, "-keepnonwarped"))) {
    360359        psArgumentRemove(argnum, &argc, argv);
     
    374373        psArgumentRemove(argnum, &argc, argv);
    375374    }
    376        
     375
    377376    // if skycells are not provided then we have to execise all pixels  unless -keepnonwarped
    378377    pmConfigFileSetsMD(config->arguments, &argc, argv, "SKYCELLS", "-skycell", "-skycelllist");
     
    628627            initValue = NAN;
    629628        } else {
    630             // otherwise write it to the output 
     629            // otherwise write it to the output
    631630            writeImageCube(sf->outImage, sf->inImage->imagecube, extname, sf->extnum);
    632631            initValue = 0;
     
    799798    sFile *out = sfiles->outSources;
    800799
    801     in->header = psFitsReadHeader(NULL, in->fits);
    802     if (!in->header) {
    803         psError(PS_ERR_IO, false, "failed to read header from %s", in->resolved_name);
     800
     801    // Primary header, should be "something.hdr"
     802    {
     803        psMetadata *header = psFitsReadHeader(NULL, in->fits);
     804        if (!header) {
     805            psError(PS_ERR_IO, false, "failed to read header from %s", in->resolved_name);
     806            streaksExit("", PS_EXIT_DATA_ERROR);
     807        }
     808
     809        bool status;
     810        psString extname = psMetadataLookupStr(&status, header, "EXTNAME");
     811        if (!extname) {
     812            psError(PS_ERR_IO, false, "failed to find extname in header of %s", in->resolved_name);
     813            streaksExit("", PS_EXIT_DATA_ERROR);
     814        }
     815        addDestreakKeyword(header);
     816
     817        if (!psFitsWriteBlank(out->fits, header, extname)) {
     818            psError(PS_ERR_IO, false, "failed to write blank in header of %s", in->resolved_name);
     819            streaksExit("", PS_EXIT_DATA_ERROR);
     820        }
     821        psFree(header);
     822    }
     823
     824    // Extension with PSF fits, should be "something.psf"
     825    {
     826        if (!psFitsMoveExtNum(in->fits, 1, true)) {
     827            psErrorStackPrint(stderr, "failed to read header from %s", in->resolved_name);
     828            streaksExit("", PS_EXIT_DATA_ERROR);
     829        }
     830
     831        psMetadata *header = psFitsReadHeader(NULL, in->fits);
     832        if (!header) {
     833            psErrorStackPrint(stderr, "failed to read header from %s", in->resolved_name);
     834            streaksExit("", PS_EXIT_DATA_ERROR);
     835        }
     836        psString extname = psMetadataLookupStr(NULL, header, "EXTNAME");
     837        if (!extname) {
     838            psError(PS_ERR_IO, false, "failed to find extname in header of %s", in->resolved_name);
     839            streaksExit("", PS_EXIT_DATA_ERROR);
     840        }
     841
     842        psArray *inTable = psFitsReadTable(in->fits);
     843        if (!inTable->n) {
     844            psErrorStackPrint(stderr, "table in %s is empty", in->resolved_name);
     845            streaksExit("", PS_EXIT_DATA_ERROR);
     846        }
     847
     848        psArray *outTable = psArrayAllocEmpty(inTable->n);
     849        int j = 0;
     850        int numCensored = 0;
     851        for (int i = 0 ; i < inTable->n; i++) {
     852            psMetadata *row = inTable->data[i];
     853
     854            psF32 x = psMetadataLookupF32(NULL, row, "X_PSF");
     855            psF32 y = psMetadataLookupF32(NULL, row, "Y_PSF");
     856
     857            psU32 mask = psImageGet(maskImage, x, y);
     858
     859            // Key the source if the center pixel is not masked with maskStreak
     860            if (!(mask & maskStreak) ) {
     861                psArraySet(outTable, j++, row);
     862            } else {
     863                numCensored++;
     864            }
     865        }
     866
     867        // get rid of unused elements (don't know if this is necessary)
     868        psArrayRealloc(outTable, j);
     869
     870        addDestreakKeyword(header);
     871        if (psArrayLength(outTable) > 0) {
     872            printf("Censored %d sources\n", numCensored);
     873            if (! psFitsWriteTable(out->fits, header, outTable, extname)) {
     874                psErrorStackPrint(stderr, "failed to write table to %s", out->resolved_name);
     875                streaksExit("", PS_EXIT_DATA_ERROR);
     876            }
     877        } else {
     878            printf("Censored ALL %d sources\n", numCensored);
     879            if (! psFitsWriteTableEmpty(out->fits, header, inTable->data[0], extname)) {
     880                psErrorStackPrint(stderr, "failed to write empty table to %s", out->resolved_name);
     881                streaksExit("", PS_EXIT_DATA_ERROR);
     882            }
     883        }
     884        psFree(header);
     885        psFree(outTable);
     886        psFree(inTable);
     887    }
     888
     889    // XXX Will need to update to handle extension with extended sources, etc.
     890
     891    if (!psFitsClose(out->fits)) {
     892        psErrorStackPrint(stderr, "failed to close table %s", out->resolved_name);
    804893        streaksExit("", PS_EXIT_DATA_ERROR);
    805894    }
    806 
    807     bool status;
    808     psString extname = psMetadataLookupStr(&status, in->header, "EXTNAME");
    809     if (!extname) {
    810         psError(PS_ERR_IO, false, "failed to find extname in header of %s", in->resolved_name);
    811         streaksExit("", PS_EXIT_DATA_ERROR);
    812     }
    813 
    814     psArray *inTable = psFitsReadTable(in->fits);
    815     if (!inTable->n) {
    816         psError(PS_ERR_IO, false, "table in %s is empty", in->resolved_name);
    817         streaksExit("", PS_EXIT_DATA_ERROR);
    818     }
    819 
    820     psArray *outTable = psArrayAllocEmpty(inTable->n);
    821     int j = 0;
    822     int numCensored = 0;
    823     for (int i = 0 ; i < inTable->n; i++) {
    824         psMetadata *row = inTable->data[i];
    825 
    826         psF32 x = psMetadataLookupF32 (&status, row, "X_PSF");
    827         psF32 y = psMetadataLookupF32 (&status, row, "Y_PSF");
    828        
    829         psU32 mask = psImageGet(maskImage, x, y);
    830 
    831         // Key the source if the center pixel is not masked with maskStreak
    832         if (! (mask & maskStreak) ) {
    833             psArraySet(outTable, j++, row);
    834         } else {
    835             numCensored++;
    836         }
    837     }
    838 
    839     // get rid of unused elements (don't know if this is necessary)
    840     psArrayRealloc(outTable, j);
    841 
    842     addDestreakKeyword(in->header);
    843     if (psArrayLength(outTable) > 0) {
    844         printf("Censored %d sources\n", numCensored);
    845         if (! psFitsWriteTable(out->fits, in->header, outTable, extname)) {
    846             psError(PS_ERR_IO, false, "failed to write table to %s", out->resolved_name);
    847             streaksExit("", PS_EXIT_DATA_ERROR);
    848         }
    849     } else {
    850         printf("Censored ALL %d sources\n", numCensored);
    851         if (! psFitsWriteTableEmpty(out->fits, in->header, inTable->data[0], extname)) {
    852             psError(PS_ERR_IO, false, "failed to write empty table to %s", out->resolved_name);
    853             streaksExit("", PS_EXIT_DATA_ERROR);
    854         }
    855     }
    856 
    857     if (!psFitsClose(out->fits)) {
    858         psError(PS_ERR_IO, false, "failed to close table %s", out->resolved_name);
    859         streaksExit("", PS_EXIT_DATA_ERROR);
    860     }
    861 }
     895}
  • branches/czw_branch/cleanup/magic/remove/src/streaksremove.h

    r24691 r25158  
    8484// can't declare this in streaksastrom due to header file ordering
    8585extern void cellToChip(double *xChip, double *yChip, strkAstrom *astrom, double xCell, double yCell);
    86 extern void cellToChipInt(int *xChip, int *yChip, strkAstrom *astrom, int xCell, int yCell);
     86extern void cellToChipInt(unsigned int *xChip, unsigned int *yChip, strkAstrom *astrom, int xCell, int yCell);
    8787
    8888extern bool computeWarpedPixels(streakFiles *sf);
  • branches/czw_branch/cleanup/magic/remove/src/streaksreplace.c

    r24556 r25158  
    88int main(int argc, char *argv[])
    99{
    10     long i;
    1110    bool status;
    12     StreakPixels *pixels;
    13     PixelPos *pixelPos;
    1411
    1512    psLibInit(NULL);
     
    9289
    9390    if (!replicateOutputs(sfiles)) {
    94         psError(PS_ERR_UNKNOWN, false, "failed to replicate output files");
    95         psErrorStackPrint(stderr, "");
     91        psErrorStackPrint(stderr, "failed to replicate output files");
    9692        exit(PS_EXIT_UNKNOWN_ERROR);
    9793    }
     
    172168            true);
    173169    }
    174    
     170
    175171    bool gotMask = false;
    176172    if ((argnum = psArgumentGet(argc, argv, "-mask"))) {
     
    353349        // we have an image cube
    354350        double initValue;
    355         // otherwise write it to the output 
     351        // otherwise write it to the output
    356352        writeImageCube(sf->outImage, sf->recImage->imagecube, extname, sf->extnum);
    357353
  • branches/czw_branch/cleanup/magic/remove/src/streaksutil.c

    r24556 r25158  
    4444// we just bail out
    4545void streaksExit(psString str, int exitCode) {
    46     psErrorStackPrint(stderr, str);
     46    psErrorStackPrint(stderr, "%s", str);
    4747    if (ourStreakFiles) {
    4848        deleteTemps(ourStreakFiles);
  • branches/czw_branch/cleanup/magic/remove/src/warpedpixels.c

    r21438 r25158  
    2323
    2424    psRegion     *bounds = pmChipPixels(sf->chip);
    25    
     25
    2626    int width  = bounds->x1 - bounds->x0;
    2727    int height = bounds->y1 - bounds->y0;
     
    8383
    8484    /* now set up our wrapper to the chip astrometry to apply to the whole chip */
    85     sf->astrom = streakSetAstrometry(sf->astrom, sf->stage, sf->inAstrom->fpa, sf->chip, false, NULL, 
     85    sf->astrom = streakSetAstrometry(sf->astrom, sf->stage, sf->inAstrom->fpa, sf->chip, false, NULL,
    8686        sf->warpedPixels->numCols, sf->warpedPixels->numRows);
    8787
     
    106106        // convert corner of skycell to sky coordinates
    107107        if (!pmAstromWCStoSky(&sky, wcs, &pt[i])) {
    108             psError(PS_ERR_IO, false, "failed to convert pt %d of %s to sky coords: %s", fileName);
     108            psErrorStackPrint(stderr, "failed to convert pt %d of %s to sky coords", i, fileName);
    109109            streaksExit("", PS_EXIT_DATA_ERROR);
    110110        }
     
    112112        // convert to chip coordinates
    113113        if (!skyToCell(&p, sf->astrom, sky.r, sky.d)) {
    114             psError(PS_ERR_IO, false, "failed to convert pt %d of %s to sky coords: %s", fileName);
     114            psErrorStackPrint(stderr, "failed to convert pt %d of %s to sky coords", i, fileName);
    115115            streaksExit("", PS_EXIT_DATA_ERROR);
    116116        }
     
    171171}
    172172
    173 // x as a function of y for the line between two points 
     173// x as a function of y for the line between two points
    174174// Note: the caller guarentees that the y's of the two points are different
    175175static double xOfY(psPlane *pI, psPlane *pJ, int y)
     
    212212 * To compute the overlap of a quadrilateral with a set of
    213213 * points we transform the 4 corners to image coordinates
    214  * and name the 4 points of the quad 
     214 * and name the 4 points of the quad
    215215            pt 0 is left most (bottom most corner)
    216216            pt 1 is bottom most (right most corner)
     
    238238
    239239                3
    240                  C       
     240                 C
    241241         ---------------2           left boundary:  line 0_1 y < pt0.y
    242242                 B                                  line 0_3 y >= pt0.y
     
    249249              C
    250250        0----------------
    251               B     
     251              B
    252252      ----------------2
    253253              A
     
    258258
    259259        3       2
    260            
     260
    261261            B
    262262
     
    265265(region A and C are empty in the case where the points form a rectangle)
    266266*/
    267            
     267
    268268/*
    269269    Name the corners
    270     The following algorithm works for points that form a quadrilateral 
     270    The following algorithm works for points that form a quadrilateral
    271271    I think it also works for the situation where 3 points are co-linear
    272272    and we have a triangle, but that isn't important for our purposes
     
    313313        pt[i] = pt[i+1];
    314314    }
    315            
     315
    316316    // now find the right most (top most) of the remaining 2 points
    317317    if ((pt[0].x > pt[1].x) ||
  • branches/czw_branch/cleanup/ppMops/src/ppMops.c

    r25154 r25158  
    66int main(int argc, char *argv[])
    77{
    8     if (argc != 7) {
     8    if (argc != 6) {
    99        fprintf(stderr, "Insufficient arguments.\n");
    10         fprintf(stderr, "Usage: %s DETECTIONS ZP EXP_ID EXP_NAME DIRECTION OUTPUT\n", argv[0]);
     10        fprintf(stderr, "Usage: %s DETECTIONS ZP EXP_ID EXP_NAME OUTPUT\n", argv[0]);
    1111        exit(PS_EXIT_CONFIG_ERROR);
    1212    }
     
    1717    data->exp_id = atoll(argv[3]);
    1818    data->exp_name = psStringCopy(argv[4]);
    19     data->direction = atoi(argv[5]);
    20     data->output = psStringCopy(argv[6]);
     19    data->output = psStringCopy(argv[5]);
    2120
    2221    if (!isfinite(data->zp)) {
     
    129128                                        psMetadataLookupF32(NULL, header, "FWHM_MIN"));
    130129
     130
    131131        psMetadataAddStr(outHeader, PS_LIST_TAIL, "RA", 0, "Right ascension of boresight", ra);
    132132        psMetadataAddStr(outHeader, PS_LIST_TAIL, "DEC", 0, "Declination of boresight", dec);
     
    141141        psMetadataAddStr(outHeader, PS_LIST_TAIL, "FPA_ID", 0, "Exposure name", data->exp_name);
    142142        psMetadataAddS64(outHeader, PS_LIST_TAIL, "EXP_ID", 0, "Exposure identifier", data->exp_id);
    143         psMetadataAddBool(outHeader, PS_LIST_TAIL, "POSITIVE", 0, "Positive subtraction?", data->direction);
    144143        psMetadataAddStr(outHeader, PS_LIST_TAIL, "OBSCODE", 0, "IAU Observatory code", OBSERVATORY_CODE);
    145144        psMetadataAddF32(outHeader, PS_LIST_TAIL, "STARPSF", 0, "Stellar PSF (arcsec)", psf);
    146145
    147146        // These are completely fake
    148         psMetadataAddF32(outHeader, PS_LIST_TAIL, "LIMITMAG", 0, "Limiting magnitude (FAKE)", 99.0);
     147        psMetadataAddF32(outHeader, PS_LIST_TAIL, "LIMITMAG", 0, "Limiting magnitude (FAKE)", 25.0);
    149148        psMetadataAddF32(outHeader, PS_LIST_TAIL, "DE1", 0, "Detection efficiency (FAKE)", 0.0);
    150149        psMetadataAddF32(outHeader, PS_LIST_TAIL, "DE2", 0, "Detection efficiency (FAKE)", 0.0);
  • branches/czw_branch/cleanup/ppMops/src/ppMops.h

    r25154 r25158  
    1616    psString detections;                // Detections filename
    1717    float zp;                           // Magnitude zero point
    18     bool direction;                     // Direction of subtraction, 1=positive, 0=negative
     18    psS64 exp_id;                       // Exposure identifier
     19    psString exp_name;                  // Exposure name
    1920    psString output;                    // Output filename
    2021} ppMopsData;
  • branches/czw_branch/cleanup/ppMops/src/ppMopsData.c

    r24242 r25158  
    1111{
    1212    psFree(data->detections);
     13    psFree(data->exp_name);
    1314    psFree(data->output);
    1415    return;
     
    2223    data->detections = NULL;
    2324    data->zp = NAN;
     25    data->exp_id = 0;
     26    data->exp_name = NULL;
    2427    data->output = NULL;
    2528
  • branches/czw_branch/cleanup/ppStack/src/ppStackCombineFinal.c

    r25152 r25158  
    5656        }
    5757        psKernel *covar = options->covariances->data[i]; // Covariance matrix
     58        if (!covar) {
     59            continue;
     60        }
    5861        float weight = options->weightings->data.F32[i]; // Weight to apply
    5962        psBinaryOp(covar->image, covar->image, "*", psScalarAlloc(weight, PS_TYPE_F32));
  • branches/czw_branch/cleanup/psLib/src/fits/psFitsHeader.c

    r25051 r25158  
    5050
    5151// List of the start of FITS header keys not to write (handled by cfitsio); NULL-terminated
    52 static const char *noWriteFitsKeyStarts[] = { "NAXIS", "TTYPE", "TFORM", NULL };
     52static const char *noWriteFitsKeyStarts[] = { "NAXIS", "TTYPE", "TFORM", "TZERO", "TSCAL", NULL };
    5353
    5454// List of compressed FITS header keys not to write (handled by cfitsio); NULL-terminated
     
    305305                keyType = 'C';
    306306            }
     307            psTrace("psLib.fits", 3, "Reading keyword %s, type %c\n", keyName, keyType);
    307308            if (status != 0) {
    308309                break;
     
    327328                                               -INFINITY);
    328329                } else {
    329                     success = psMetadataAddS32(header, PS_LIST_TAIL, keyNameTrans, dupFlag, keyComment,
    330                                                atoi(keyValue));
     330                    long long value = atoll(keyValue); // Value
     331                    if (value > PS_MIN_S32 && value < PS_MAX_S32) {
     332                        success = psMetadataAddS32(header, PS_LIST_TAIL, keyNameTrans, dupFlag, keyComment,
     333                                                   value);
     334                    } else {
     335                        success = psMetadataAddS64(header, PS_LIST_TAIL, keyNameTrans, dupFlag, keyComment,
     336                                                   value);
     337                    }
    331338                }
    332339                break;
     
    509516        psMetadataItem *simpleItem = psMetadataLookup(output, "SIMPLE"); // SIMPLE in the header
    510517        if (simpleItem) {
    511             if (simpleItem->type != PS_DATA_BOOL) {
    512                 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "SIMPLE in a FITS header must be of boolean type: "
    513                         "not %x --- assuming FALSE.\n", simpleItem->type);
     518            if (simpleItem->type != PS_DATA_BOOL || !simpleItem->data.B) {
    514519                int value = false;          // Temporary holder for boolean
     520                psWarning("Writing SIMPLE=F to FITS header by request");
    515521                fits_update_key(fits->fd, TLOGICAL, "SIMPLE", &value,
    516522                                "File does not conform to FITS standard", &status);
    517523                simple = false;
    518             } else if (!simpleItem->data.B) {
    519                 simple = false;
    520                 int value = false;      // Temporary holder for boolean
    521                 fits_update_key(fits->fd, TLOGICAL, "SIMPLE", &value,
    522                                 "File does not conform to FITS standard", &status);
    523524            }
    524525            // Uncompressed SIMPLE = T is taken care of by cfitsio.
     
    546547            char comment[FLEN_CARD];    // Comment for ZIMAGE; unused
    547548            int value;                  // Value for ZIMAGE; unused
     549            psTrace("psLib.fits", 3, "Writing header ZSIMPLE to preserve PHU");
    548550            fits_read_key(fits->fd, TLOGICAL, "ZIMAGE", &value, comment, &status);
    549551            fits_insert_key_log(fits->fd, "ZSIMPLE", simple, "Uncompressed file's conforms to FITS", &status);
     
    575577                if (keywordInList(name, noWriteCompressedKeys) ||
    576578                    (keyStarts && keywordStartsWith(name, noWriteCompressedKeyStarts))) {
     579                    psTrace("psLib.fits", 3, "Not writing FITS keyword %s", name);
    577580                    continue;
    578581                }
    579582            } else if (keywordInList(name, noWriteCompressedKeys) ||
    580583                       (keyStarts && keywordStartsWith(name, noWriteCompressedKeyStarts))) {
     584                psTrace("psLib.fits", 3, "Not writing FITS keyword %s", name);
    581585                continue;
    582586            }
     
    584588            if (keywordInList(name, noWriteFitsKeys) ||
    585589                (keyStarts && keywordStartsWith(name, noWriteFitsKeyStarts))) {
     590                psTrace("psLib.fits", 3, "Not writing FITS keyword %s", name);
    586591                continue;
    587592            }
     
    592597                psWarning("COMMENT header is not of type STRING (%x) --- ignored.", item->type);
    593598            } else {
     599                psTrace("psLib.fits", 5, "Writing header COMMENT: %s", item->data.str);
    594600                fits_write_comment(fits->fd, item->data.str, &status);
    595601            }
     
    598604                psWarning("COMMENT header is not of type STRING (%x) --- ignored.", item->type);
    599605            } else {
     606                psTrace("psLib.fits", 5, "Writing header HISTORY: %s", item->data.str);
    600607                fits_write_history(fits->fd, item->data.str, &status);
    601608            }
     
    605612              case PS_DATA_BOOL: {
    606613                  int value = item->data.B;
     614                  psTrace("psLib.fits", 5, "Writing BOOL header %s: %d", name, value);
    607615                  fits_update_key(fits->fd, TLOGICAL, name, &value, item->comment, &status);
    608616                  break;
    609617              }
    610618              case PS_DATA_S8:
     619                psTrace("psLib.fits", 5, "Writing S8 header %s: %d", name, (int)item->data.S8);
    611620                fits_update_key(fits->fd, TBYTE, name, &item->data.S8, item->comment, &status);
    612621                break;
    613622              case PS_DATA_S16:
     623                psTrace("psLib.fits", 5, "Writing S16 header %s: %d", name, (int)item->data.S16);
    614624                fits_update_key(fits->fd, TSHORT, name, &item->data.S16, item->comment, &status);
    615625                break;
    616626              case PS_DATA_S32:
     627                psTrace("psLib.fits", 5, "Writing S32 header %s: %d", name, (int)item->data.S32);
    617628                fits_update_key(fits->fd, TINT, name, &item->data.S32, item->comment, &status);
    618629                break;
    619630              case PS_DATA_S64:
     631                psTrace("psLib.fits", 5, "Writing S64 header %s: %" PRId64, name, item->data.S64);
    620632                fits_update_key(fits->fd, TLONGLONG, name, &item->data.S64, item->comment, &status);
    621633                break;
    622634              case PS_DATA_U8: {
    623635                  unsigned short int temp = item->data.U8;
     636                psTrace("psLib.fits", 5, "Writing U8 header %s: %d", name, (int)item->data.U8);
    624637                  fits_update_key(fits->fd, TUSHORT, name, &temp, item->comment, &status);
    625638                  break;
    626639              }
    627640              case PS_DATA_U16:
     641                psTrace("psLib.fits", 5, "Writing U16 header %s: %d", name, (int)item->data.U16);
    628642                fits_update_key(fits->fd, TUSHORT, name, &item->data.U16, item->comment, &status);
    629643                break;
    630644              case PS_DATA_U32:
     645                psTrace("psLib.fits", 5, "Writing U32 header %s: %d", name, (unsigned int)item->data.U32);
    631646                fits_update_key(fits->fd, TUINT, name, &item->data.U32, item->comment, &status);
    632647                break;
     
    639654                }
    640655                psS64 temp = item->data.U64; // Signed version
     656                psTrace("psLib.fits", 5, "Writing U64 header %s: %" PRIu64, name, item->data.U64);
    641657                fits_update_key(fits->fd, TLONGLONG, name, &temp, item->comment, &status);
    642658                break;
    643659              case PS_DATA_F32: {
    644660                  int infCheck = 0;         // Result of isinf()
     661                  psTrace("psLib.fits", 5, "Writing F32 header %s: %f", name, item->data.F32);
    645662                  if (isnan(item->data.F32)) {
    646663                      fits_update_key(fits->fd, TSTRING, name, "NaN", item->comment, &status);
     
    659676              case PS_DATA_F64: {
    660677                  int infCheck = 0;         // Result of isinf()
     678                  psTrace("psLib.fits", 5, "Writing F32 header %s: %lf", name, item->data.F64);
    661679                  if (isnan(item->data.F64)) {
    662680                      fits_update_key(fits->fd, TSTRING, name, "NaN", item->comment, &status);
     
    674692              }
    675693              case PS_DATA_STRING:
     694                psTrace("psLib.fits", 5, "Writing STR header %s: %s", name, item->data.str);
    676695                fits_update_key(fits->fd, TSTRING, name, item->data.V, item->comment, &status);
    677696                break;
  • branches/czw_branch/cleanup/psModules/src/imcombine/pmSubtractionAnalysis.c

    r25148 r25158  
    4242        psFree(subRegion);
    4343
    44         psMetadataAddStr(header, PS_LIST_TAIL, PM_SUBTRACTION_ANALYSIS_REGION, PS_META_DUPLICATE_OK,
     44        psMetadataAddPtr(header, PS_LIST_TAIL, PM_SUBTRACTION_ANALYSIS_REGION,
     45                         PS_DATA_REGION | PS_META_DUPLICATE_OK,
    4546                         "Region over which subtraction was performed", string);
    4647        psFree(string);
  • branches/czw_branch/cleanup/psModules/src/imcombine/pmSubtractionAnalysis.h

    r21149 r25158  
    2727bool pmSubtractionAnalysis(
    2828    psMetadata *analysis,               ///< Metadata container for QA information
     29    psMetadata *header,                 ///< Metadata container for QA information to put in header
    2930    pmSubtractionKernels *kernels,      ///< Kernels
    3031    psRegion *region,                   ///< Region for subtraction
  • branches/czw_branch/cleanup/psModules/src/imcombine/pmSubtractionMatch.c

    r25148 r25158  
    1010#include "pmHDU.h"
    1111#include "pmFPA.h"
     12#include "pmHDUUtils.h"
    1213#include "pmSubtractionParams.h"
    1314#include "pmSubtractionKernels.h"
     
    5859
    5960
    60 static bool getStamps(pmSubtractionStampList **stamps, // Stamps to read
    61                       const pmReadout *ro1, // Readout 1
    62                       const pmReadout *ro2, // Readout 2
    63                       const psImage *subMask, // Mask for subtraction, or NULL
    64                       psImage *variance,  // Variance map
    65                       const psRegion *region, // Region of interest, or NULL
    66                       float thresh1,  // Threshold for stamp finding on readout 1
    67                       float thresh2,  // Threshold for stamp finding on readout 2
    68                       float stampSpacing, // Spacing between stamps
    69                       int size,         // Kernel half-size
    70                       int footprint,     // Convolution footprint for stamps
    71                       pmSubtractionMode mode // Mode for subtraction
     61static bool subtractionGetStamps(pmSubtractionStampList **stamps, // Stamps to read
     62                                 const pmReadout *ro1, // Readout 1
     63                                 const pmReadout *ro2, // Readout 2
     64                                 const psImage *subMask, // Mask for subtraction, or NULL
     65                                 psImage *variance,  // Variance map
     66                                 const psRegion *region, // Region of interest, or NULL
     67                                 float thresh1,  // Threshold for stamp finding on readout 1
     68                                 float thresh2,  // Threshold for stamp finding on readout 2
     69                                 float stampSpacing, // Spacing between stamps
     70                                 int size,         // Kernel half-size
     71                                 int footprint,     // Convolution footprint for stamps
     72                                 pmSubtractionMode mode // Mode for subtraction
    7273    )
    7374{
     
    163164}
    164165
     166static void subtractionAnalysisUpdate(pmReadout *conv1, pmReadout *conv2, // Convolved images
     167                                      const psMetadata *analysis, // Analysis metadata
     168                                      const psMetadata *header // Header metadata
     169    )
     170{
     171    if (conv1) {
     172        conv1->analysis = psMetadataCopy(conv1->analysis, analysis);
     173    }
     174    if (conv2) {
     175        conv2->analysis = psMetadataCopy(conv2->analysis, analysis);
     176    }
     177
     178    if (conv1 && conv1->parent) {
     179        pmHDU *hdu = pmHDUFromCell(conv1->parent);
     180        if (hdu) {
     181            hdu->header = psMetadataCopy(hdu->header, header);
     182        }
     183    }
     184    if (conv2 && conv2->parent) {
     185        pmHDU *hdu = pmHDUFromCell(conv2->parent);
     186        if (hdu) {
     187            hdu->header = psMetadataCopy(hdu->header, header);
     188        }
     189    }
     190
     191    return;
     192}
    165193
    166194
     
    253281
    254282    psMetadata *outAnalysis = psMetadataAlloc(); // Output analysis values
     283    psMetadata *outHeader = psMetadataAlloc(); // Output header values
    255284
    256285    psTrace("psModules.imcombine", 2, "Convolving...\n");
     
    259288        psRegion *region = regions->data[i]; // Region of interest
    260289
    261         if (!pmSubtractionAnalysis(outAnalysis, kernel, region, ro1->image->numCols, ro1->image->numRows)) {
     290        if (!pmSubtractionAnalysis(outAnalysis, outHeader, kernel, region,
     291                                   ro1->image->numCols, ro1->image->numRows)) {
    262292            psError(PS_ERR_UNKNOWN, false, "Unable to generate QA data");
    263293            psFree(outAnalysis);
     294            psFree(outHeader);
    264295            psFree(subMask);
    265296            psFree(kernels);
     
    272303            psError(PS_ERR_UNKNOWN, false, "Unable to convolve image.");
    273304            psFree(outAnalysis);
     305            psFree(outHeader);
    274306            psFree(subMask);
    275307            psFree(kernels);
     
    283315    psFree(regions);
    284316
    285     if (conv1) {
    286         psMetadataCopy(conv1->analysis, outAnalysis);
    287     }
    288     if (conv2) {
    289         psMetadataCopy(conv2->analysis, outAnalysis);
    290     }
     317    subtractionAnalysisUpdate(conv1, conv2, outAnalysis, outHeader);
    291318    psFree(outAnalysis);
     319    psFree(outHeader);
    292320
    293321    return true;
     
    369397    pmSubtractionKernels *kernels = NULL; // Kernel basis functions
    370398    psMetadata *analysis = psMetadataAlloc(); // QA data
     399    psMetadata *header = psMetadataAlloc(); // QA data for header
    371400
    372401    int numCols = ro1->image->numCols, numRows = ro1->image->numRows; // Image dimensions
     
    442471            // We get the stamps here; we will also attempt to get stamps at the first iteration, but it
    443472            // doesn't matter.
    444             if (!getStamps(&stamps, ro1, ro2, subMask, variance, NULL, stampThresh1, stampThresh2,
     473            if (!subtractionGetStamps(&stamps, ro1, ro2, subMask, variance, NULL, stampThresh1, stampThresh2,
    445474                           stampSpacing, size, footprint, subMode)) {
    446475                goto MATCH_ERROR;
     
    508537                psLogMsg("psModules.imcombine", PS_LOG_INFO, "Iteration %d.", k);
    509538
    510                 if (!getStamps(&stamps, ro1, ro2, subMask, variance, region, stampThresh1, stampThresh2,
    511                                stampSpacing, size, footprint, subMode)) {
     539                if (!subtractionGetStamps(&stamps, ro1, ro2, subMask, variance, region,
     540                                          stampThresh1, stampThresh2, stampSpacing,
     541                                          size, footprint, subMode)) {
    512542                    goto MATCH_ERROR;
    513543                }
     
    569599            memCheck("solution");
    570600
    571             if (!pmSubtractionAnalysis(analysis, kernels, region, numCols, numRows)) {
     601            if (!pmSubtractionAnalysis(analysis, header, kernels, region, numCols, numRows)) {
    572602                psError(PS_ERR_UNKNOWN, false, "Unable to generate QA data");
    573603                goto MATCH_ERROR;
     
    605635    memCheck("convolution");
    606636
    607     if (conv1) {
    608         psMetadataCopy(conv1->analysis, analysis);
    609     }
    610     if (conv2) {
    611         psMetadataCopy(conv2->analysis, analysis);
    612     }
     637    subtractionAnalysisUpdate(conv1, conv2, analysis, header);
    613638    psFree(analysis);
     639    psFree(header);
    614640
    615641#ifdef TESTING
     
    633659MATCH_ERROR:
    634660    psFree(analysis);
     661    psFree(header);
    635662    psFree(region);
    636663    psFree(regionString);
  • branches/czw_branch/cleanup/pstamp/scripts/pstamp_finish.pl

    r25143 r25158  
    9494        if (!mkdir $out_dir) {
    9595            print STDERR "cannot create output directory $out_dir";
    96             stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);
     96            stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
    9797        }
    9898
     
    102102        # request
    103103        print STDERR "output directory $out_dir exists but is not a directory";
    104         stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);
     104        stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
    105105    }
    106106
    107107    if (! -e $req_file ) {
    108108        print STDERR "request file $req_file is missing\n";
    109         stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
     109        stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
    110110    }
    111111
     
    117117        # point
    118118        print STDERR "failed to read request_file $req_file" ;
    119         stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
     119        stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
    120120    }
    121121
     
    154154                print STDERR "Request $req_id produced no jobs.\n"
    155155            }
    156             # This should not happen. A fake job should be queued
    157             stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);
     156            # No Jobs.
     157            # XXXX Ouch. We need results for each rownum (each request specification) in the request file
     158            # including those that produced no jobs.
     159            # for now add an entry for rownum 1 and a phony error code.
     160            # we've included parse_error.txt to the fileset if it exists
     161            #
     162            my $rownum = 0;
     163            my $fault = 42; # get a real error code
     164            print $tdf "$rownum|$fault|0|0|";
     165            print $tdf "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|\n";
    158166        } else {
    159167            my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");
     
    174182        my $exp_id = $job->{exp_id};
    175183
    176         if ($fault eq $PSTAMP_DUP_REQUEST) {
    177             # this request had a duplicate request name. We can't put the results
    178             # on the data store since the product name is already used
    179             # maybe we could be more clever about this and choose a fileset name
    180             stop_request_and_exit($req_id, $fault);
    181         }
    182 
    183184        my ($row, $req_info, $project) = get_request_info($rows, $rownum);
    184185
     
    188189            carp("failed to find imagedb for project: $project");
    189190            if (!$fault) {
    190                 stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
     191                stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
    191192            }
    192193        }
     
    279280}
    280281
    281 sub stop_request_and_exit {
     282sub stop_request {
    282283    my $req_id = shift;
    283284    my $fault  = shift;
  • branches/czw_branch/cleanup/pstamp/scripts/pstamp_job_run.pl

    r25143 r25158  
    1111use Sys::Hostname;
    1212use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     13use Carp;
    1314use File::Basename;
    1415use Digest::MD5::File qw( file_md5_hex );
     
    137138    }
    138139} elsif ($jobType eq "get_image") {
    139     my_die( "get_image jobs not working right now", $job_id, $PS_EXIT_CONFIG_ERROR);
     140    my_die( "get_image jobs not working right now", $job_id, $PS_EXIT_PROG_ERROR);
    140141
    141142    my $uri = "";
  • branches/czw_branch/cleanup/pstamp/scripts/pstamp_parser_run.pl

    r25051 r25158  
    200200    unlink $error_file_name if (-e $error_file_name);
    201201
     202    # Run the parser
     203
    202204    my $command = "$parse_cmd";
    203205    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
  • branches/czw_branch/cleanup/pstamp/scripts/pstampparse.pl

    r25143 r25158  
    1414use PS::IPP::PStamp::Job qw( :standard );
    1515use File::Temp qw(tempfile);
    16 use Carp;
    1716
    1817my $verbose;
     
    9796my_die("wrong EXTVER $extver found in $request_file_name", $PS_EXIT_PROG_ERROR) if ($extver ne "1");
    9897
    99 # check for duplicate request name
    100 if (!$no_update) {
     98{
    10199    my $command = "$pstamptool -listreq  -name $req_name";
    102100    $command .= " -dbname $dbname" if $dbname;
    103101    $command .= " -dbserver $dbserver" if $dbserver;
    104     # no verbose so that error message about request not found doesn't appear in parse_error.txt
    105102    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    106         run(command => $command, verbose => 0);
     103        run(command => $command, verbose => $verbose);
    107104    my $exitStatus = $error_code >> 8;
    108105    if ($success) {
     
    186183
    187184    my $option_mask= $row->{OPTION_MASK};
    188     my $inverse = ($option_mask & $PSTAMP_SELECT_INVERSE) ? 1 : 0;
    189     $row->{inverse} = $inverse;
    190185
    191186    my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS);
     
    252247        next;
    253248    } else {
    254         # Call PS::IPP::PStamp::Job locate_images subroutine to get the images for this
     249        # Call PS::IPP::PStamp::Job's locate_images subroutine to get the parameters for this
    255250        # request specification. An array reference is returned.
    256251        my ($x, $y);
    257 
    258252        $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $search_component,
    259                 $inverse, $skycenter, $x, $y, $mjd_min, $mjd_max, $filter, $verbose);
    260 
     253                $skycenter, $x, $y, $mjd_min, $mjd_max, $filter, $verbose);
    261254        if (!$imageList or !@$imageList) {
    262255            print STDERR "no matching images found for row $rownum\n" if $verbose;
     
    289282    my $have_skycells = shift;
    290283    my $need_magic = shift;
    291     my $num_jobs = 0;
    292284
    293285    my $rownum = $row->{ROWNUM};
    294286
    295287    my $components = $row->{components};
     288    my $numComponents = scalar keys %$components;
     289    if ( $numComponents == 0 ) {
     290        print STDERR "no jobs for row $rownum\n" if $verbose;
     291        insertFakeJobForRow($row, 1, $PSTAMP_NO_JOBS_QUEUED);
     292        return 1;
     293    }
    296294
    297295    my $roi_string;
     
    374372        my $fault = 0;
    375373
    376         if (($stage ne 'stack') and ($stage ne 'raw')) {
    377             if (($image->{state} eq 'goto_purged') or ($image->{data_state} eq 'purged')) {
    378                 $newState = 'stop';
    379                 $fault = $PSTAMP_GONE;
    380             } elsif (($image->{data_state} ne 'full') or ($image->{state} ne 'full' )) {
    381                 # XXX here is where we need to queue an update job
    382                 # for now just say that the image is not available
    383                 $newState = 'stop';
    384                 $fault = $PSTAMP_NOT_AVAILABLE;
    385             }
    386         }
     374if (0) {
     375        # XXX this doesn't work because not all ippTools outputs include data_state
     376        # fix chipTool also need to not make this test for raw stage
     377        if ((($stage ne 'stack') and ($image->{data_state} ne 'full')) or $image->{state} ne 'full' ){
     378            # XXX here is where we need to queue an update job
     379            # for now just say that the image is not available
     380            $newState = 'stop';
     381            $fault = 49;
     382        }
     383}
    387384
    388385        $num_jobs++;
     
    412409            print "skipping command: $command\n";
    413410        }
    414     }
    415     if ( $num_jobs == 0 ) {
    416         print STDERR "no jobs for row $rownum\n" if $verbose;
    417         insertFakeJobForRow($row, 1, $PSTAMP_NO_OVERLAP);
    418         $num_jobs = 1;
    419411    }
    420412    return $num_jobs;
     
    624616    return 0 if ($r1->{IMG_TYPE} ne $r2->{IMG_TYPE});
    625617    return 0 if ($r1->{ID} ne $r2->{ID});
    626     return 0 if ($r1->{inverse} ne $r2->{inverse});
    627618
    628619    if (defined($r1->{COMPONENT})) {
  • branches/czw_branch/cleanup/pstamp/src/pstamp.h

    r18243 r25158  
    88#include "pslib.h"
    99#include "psmodules.h"
    10 // #include "psphot.h"
    11 // #include "psastro.h"
    12 // #include "ppStats.h"
    1310#include "pstampErrorCodes.h"
    1411
     
    3128} pspMode;
    3229
     30// error codes returned to users in results flie
     31// These must match the values in  PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
     32typedef enum {
     33        PSTAMP_SUCCESS          = 0,
     34        PSTAMP_SYSTEM_ERROR     = 10,
     35        PSTAMP_NOT_IMPLEMENTED  = 11,
     36        PSTAMP_UNKNOWN_ERROR    = 12,
     37        PSTAMP_DUP_REQUEST      = 20,
     38        PSTAMP_INVALID_REQUEST  = 21,
     39        PSTAMP_UNKNOWN_PRODUCT  = 22,
     40        PSTAMP_NO_IMAGE_MATCH   = 23,
     41        PSTAMP_NOT_DESTREAKED   = 24,
     42        PSTAMP_NOT_AVAILABLE    = 25,
     43        PSTAMP_GONE             = 26,
     44        PSTAMP_NO_JOBS_QUEUED   = 27
     45} pstampJobErrors;
     46
     47
    3348#define PSTAMP_SELECT_IMAGE  1
    3449#define PSTAMP_SELECT_MASK   2
     
    4459#define STAMP_RESULTS_VERSION "1"
    4560
     61
     62
    4663#endif
  • branches/czw_branch/cleanup/pstamp/src/pstampdump.c

    r21404 r25158  
    1 // pstampdump  - read a fits table describing a postage stamp request or response file and
     1// pstampdump  - read a fits file  containing a postage stamp request or response table and
    22//               print the contents to stdout
    33//
    4 //              Actually should work for any kind of fits table, but I'm not sure what will
    5 //              happen for binary data.
     4//              Actually this should work fine for dumping the rows of any of any kind of fits table
     5//              The -header option is pstamp table specific
    66
    77#include <pslib.h>
     
    99#include <string.h>
    1010
    11 static psArray *readRequestTable(psString fileName)
     11static bool readFitsFile(psString fileName, psMetadata **pHeader, psArray **pTable)
    1212{
    13     psFits *fitsFile = psFitsOpen(fileName, "r");
    14     if (fitsFile == NULL) {
     13    psFits *fits = psFitsOpen(fileName, "r");
     14    if (fits == NULL) {
    1515        psError(PS_ERR_IO, false, "failed to open %s for output", fileName);
    16         return NULL;
     16        return false;
     17    }
     18    if (!psFitsMoveExtNum(fits, 1, true)) {
     19        psError(PS_ERR_IO, false, "failed to move to first extension from %s", fileName);
     20        return false;
    1721    }
    1822
    19     psArray *array = psFitsReadTable(fitsFile);
     23    if (pHeader) {
     24        *pHeader = psFitsReadHeader(NULL, fits);
     25        if (!*pHeader) {
     26            psError(PS_ERR_IO, false, "failed to header from %s", fileName);
     27            return false;
     28        }
     29    }
    2030
    21     psFitsClose(fitsFile);
     31    if (pTable) {
     32        *pTable = psFitsReadTable(fits);
     33        if (*pTable == NULL) {
     34            psError(PS_ERR_IO, false, "psFitsReadTable failed for %s", fileName);
     35            return false;
     36        }
     37    }
    2238
    23     if (array == NULL) {
    24         psError(PS_ERR_IO, false, "psFitsReadTable failed for %s", fileName);
    25         return NULL;
    26     }
     39    psFitsClose(fits);
    2740
    28     return array;
     41    return true;
    2942}
    3043
     
    3245usage(char *program_name)
    3346{
    34     fprintf(stderr, "usage: %s filename\n", program_name);
     47    fprintf(stderr, "usage: %s [-header] [-simple] filename\n", program_name);
    3548    exit(1);
    3649}
     50
    3751int main(int argc, char *argv[])
    3852{
     53    bool dumpHeader = false;
     54    bool simple = false;
     55    bool dumpTable = true;
     56    int argnum;
     57    if ((argnum = psArgumentGet(argc, argv, "-header"))) {
     58        dumpHeader = true;
     59        psArgumentRemove(argnum, &argc, argv);
     60    }
     61    if ((argnum = psArgumentGet(argc, argv, "-simple"))) {
     62        simple = true;
     63        psArgumentRemove(argnum, &argc, argv);
     64    }
     65    if ((argnum = psArgumentGet(argc, argv, "-headeronly"))) {
     66        dumpTable = false;
     67        dumpHeader = true;
     68        psArgumentRemove(argnum, &argc, argv);
     69    }
     70
    3971    if (argc != 2) {
    4072        usage(argv[0]);
     
    4375    psString fileName = argv[1];
    4476
    45     psArray *array = readRequestTable(fileName);
    46     if (array == NULL) {
    47         psErrorStackPrint(stderr, "failed to read fits table: %s\n", fileName);
     77    psMetadata *header;
     78    psArray *array;
     79    if (!readFitsFile(fileName, dumpHeader ? &header : NULL, dumpTable ? &array : NULL)) {
     80        psErrorStackPrint(stderr, "failed to process fits table from: %s\n", fileName);
     81        return 1;
     82    }
     83    if (dumpHeader) {
     84        psString extname = psMetadataLookupStr(NULL, header, "EXTNAME");
     85        if (!extname) {
     86            psErrorStackPrint(stderr, "failed to find EXTNAME in fits header of: %s\n", fileName);
     87            return 1;
     88        }
     89        psString req_name = psMetadataLookupStr(NULL, header, "REQ_NAME");
     90        if (!req_name) {
     91            psErrorStackPrint(stderr, "failed to find REQ_NAME in fits header of: %s\n", fileName);
     92            return 1;
     93        }
     94        if (!strcmp(extname, "PS1_PS_REQUEST")) {
     95            psString extver = psMetadataLookupStr(NULL, header, "EXTVER");
     96            if (!extver) {
     97                psErrorStackPrint(stderr, "failed to find EXTVER in fits header of: %s\n", fileName);
     98                return 1;
     99            }
     100            printf("%s %s %s\n", extname, extver, req_name);
     101        } else if (!strcmp(extname, "PS1_PS_RESULTS")) {
     102            psS64 req_id = psMetadataLookupS64(NULL, header, "REQ_ID");
     103            printf("%s %s %" PRId64 "\n", extname, req_name, req_id);
     104        } else {
     105            psErrorStackPrint(stderr, "do not recognize extname: %s in %s\n", extname, fileName);
     106            return 1;
     107        }
     108    }
     109    if (!dumpTable) {
     110        // done
     111        return 0;
     112    }
     113
     114    if (!psArrayLength(array)) {
     115        fprintf(stderr, "%s contains an empty table\n", fileName);
    48116        return 1;
    49117    }
    50118
    51     if (!psArrayLength(array)) {
    52         fprintf(stderr, "%s is an empty table\n", fileName);
    53         exit(1);
    54     }
    55 
    56 //    printf("FITS_TABLE METADATA\n");
    57119    for (int i=0; i<psArrayLength(array); i++) {
    58         printf("ROW_%d METADATA\n", i);
    59         // psMetadataPrint(stderr, array->data[i], 0);
    60         // psMetadataConfigWrite(array->data[i], "-");
    61120        psString str = psMetadataConfigFormat(array->data[i]);
    62121        if (!str) {
    63             psErrorStackPrint(stderr, "Can't write to STDOUT\n");
    64             exit(PS_EXIT_SYS_ERROR);
     122            psErrorStackPrint(stderr, "failed to format metadata item\n");
     123            return (PS_EXIT_SYS_ERROR);
    65124        }
    66         printf("%s", str);
    67         printf("END\n");
     125        if (!simple) {
     126            printf("ROW_%d METADATA\n", i);
     127            printf("%s", str);
     128            printf("END\n");
     129        } else {
     130            // simple output format space separated values one line per row
     131            char *p = str;
     132            char *pnl;
     133            while ((pnl = strchr(p, '\n'))) {
     134                // terminate the string for this line
     135                *pnl = 0;
     136                bool blank = (p == pnl);
     137                if (blank) {
     138                    p = pnl + 1;
     139                    continue;
     140                }
     141                // split line into space separated tokens
     142                char *name = strtok(p, " ");
     143                char *type = strtok(NULL, " ");
     144                char *val = strtok(NULL, " ");
     145
     146                // avoid unused variables warning/error
     147                (void) name; (void) type;
     148
     149                if (val) {
     150                    printf("%s ", val);
     151                }
     152                // next line
     153                p = pnl + 1;
     154            }
     155            printf("\n");
     156        }
    68157    }
    69 //   printf("END\n");
    70158
    71159    return 0;
  • branches/czw_branch/cleanup/tools/diff_outputs.pl

    r24224 r25158  
    1616                                          'SOURCES', 'JPEG1', 'JPEG2',
    1717                                          'KERNEL' ],
    18                            'ALL' => [ 'IMAGE', 'MASK', 'VARIANCE',
    19                                       'SOURCES', 'JPEG1', 'JPEG2',
    20                                       'KERNEL', 'INVERSE.IMAGE',
    21                                       'INVERSE.MASK', 'INVERSE.VARIANCE',
    22                                       'INVERSE.SOURCES' ],
     18                           'ALL' => [ 'IMAGE', 'MASK', 'VARIANCE', 'SOURCES', 'JPEG1', 'JPEG2', 'KERNEL',
     19                                      'INVERSE.IMAGE', 'INVERSE.MASK', 'INVERSE.VARIANCE', 'INVERSE.SOURCES',
     20                                      'INCONV.IMAGE', 'INCONV.MASK', 'INCONV.VARIANCE',
     21                                      'REFCONV.IMAGE', 'REFCONV.MASK', 'REFCONV.VARIANCE',
     22                               ],
    2323                           'INVERSE' => [ 'INVERSE.IMAGE', 'INVERSE.MASK',
    2424                                          'INVERSE.VARIANCE',
     
    3838                             'INVERSE.VARIANCE' => '.inv.wt.fits', # Variance
    3939                             'INVERSE.SOURCES' => '.inv.cmf', # Sources
     40                             'INCONV.IMAGE' => '.inConv.fits', # Convolved input image
     41                             'INCONV.MASK' => '.inConv.mk.fits', # Convolved input mask
     42                             'INCONV.VARIANCE' => '.inConv.wt.fits', # Convolved input variance
     43                             'REFCONV.IMAGE' => '.refConv.fits', # Convolved reference image
     44                             'REFCONV.MASK' => '.refConv.mk.fits', # Convolved reference mask
     45                             'REFCONV.VARIANCE' => '.refConv.wt.fits', # Convolved reference variance
    4046                         };
    4147
Note: See TracChangeset for help on using the changeset viewer.