IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2013, 4:45:57 PM (13 years ago)
Author:
eugene
Message:

carry over changes from eam_branch/20130307

Location:
branches/eam_branches/ipp-20130419
Files:
1 deleted
67 edited
6 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130419

  • branches/eam_branches/ipp-20130419/ippconfig

  • branches/eam_branches/ipp-20130419/ippconfig/dvo.photcodes

    r35209 r35421  
    165165  3004  SYNTH.z              ref   0.000  0.000 0.000     -     - 0.0000     0     4     nan 0.000 2.000  0.600   0x0000 0x0000  0x0000 0x0000
    166166  3005  SYNTH.y              ref   0.000  0.000 0.000     -     - 0.0000     0     5     nan 0.000 2.000  0.600   0x0000 0x0000  0x0000 0x0000
     167  3006  SYNTH.w              ref   0.000  0.000 0.000     -     - 0.0000     0     9     nan 0.000 2.000  0.600   0x0000 0x0000  0x0000 0x0000
    167168
    168169  100   MEGACAM.u.00         dep  25.280 -0.350 0.000     -     - 0.0000     0     -   0.000 0.000 1.000  0.000   0x0000 0x3888  0x0000 0x0000
     
    836837  10475 GPC1.y.XY75          dep  23.320 -0.073 0.000     -     - 0.0000     0     5   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    837838  10476 GPC1.y.XY76          dep  23.320 -0.073 0.000     -     - 0.0000     0     5   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    838   10501 GPC1.w.XY01          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    839   10502 GPC1.w.XY02          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    840   10503 GPC1.w.XY03          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    841   10504 GPC1.w.XY04          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    842   10505 GPC1.w.XY05          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    843   10506 GPC1.w.XY06          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    844   10510 GPC1.w.XY10          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    845   10511 GPC1.w.XY11          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    846   10512 GPC1.w.XY12          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    847   10513 GPC1.w.XY13          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    848   10514 GPC1.w.XY14          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    849   10515 GPC1.w.XY15          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    850   10516 GPC1.w.XY16          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    851   10517 GPC1.w.XY17          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    852   10520 GPC1.w.XY20          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    853   10521 GPC1.w.XY21          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    854   10522 GPC1.w.XY22          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    855   10523 GPC1.w.XY23          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    856   10524 GPC1.w.XY24          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    857   10525 GPC1.w.XY25          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    858   10526 GPC1.w.XY26          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    859   10527 GPC1.w.XY27          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    860   10530 GPC1.w.XY30          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    861   10531 GPC1.w.XY31          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    862   10532 GPC1.w.XY32          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    863   10533 GPC1.w.XY33          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    864   10534 GPC1.w.XY34          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    865   10535 GPC1.w.XY35          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    866   10536 GPC1.w.XY36          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    867   10537 GPC1.w.XY37          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    868   10540 GPC1.w.XY40          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    869   10541 GPC1.w.XY41          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    870   10542 GPC1.w.XY42          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    871   10543 GPC1.w.XY43          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    872   10544 GPC1.w.XY44          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    873   10545 GPC1.w.XY45          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    874   10546 GPC1.w.XY46          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    875   10547 GPC1.w.XY47          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    876   10550 GPC1.w.XY50          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    877   10551 GPC1.w.XY51          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    878   10552 GPC1.w.XY52          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    879   10553 GPC1.w.XY53          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    880   10554 GPC1.w.XY54          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    881   10555 GPC1.w.XY55          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    882   10556 GPC1.w.XY56          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    883   10557 GPC1.w.XY57          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    884   10560 GPC1.w.XY60          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    885   10561 GPC1.w.XY61          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    886   10562 GPC1.w.XY62          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    887   10563 GPC1.w.XY63          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    888   10564 GPC1.w.XY64          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    889   10565 GPC1.w.XY65          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    890   10566 GPC1.w.XY66          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    891   10567 GPC1.w.XY67          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    892   10571 GPC1.w.XY71          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    893   10572 GPC1.w.XY72          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    894   10573 GPC1.w.XY73          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    895   10574 GPC1.w.XY74          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    896   10575 GPC1.w.XY75          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    897   10576 GPC1.w.XY76          dep  25.000  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     839  10501 GPC1.w.XY01          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     840  10502 GPC1.w.XY02          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     841  10503 GPC1.w.XY03          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     842  10504 GPC1.w.XY04          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     843  10505 GPC1.w.XY05          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     844  10506 GPC1.w.XY06          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     845  10510 GPC1.w.XY10          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     846  10511 GPC1.w.XY11          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     847  10512 GPC1.w.XY12          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     848  10513 GPC1.w.XY13          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     849  10514 GPC1.w.XY14          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     850  10515 GPC1.w.XY15          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     851  10516 GPC1.w.XY16          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     852  10517 GPC1.w.XY17          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     853  10520 GPC1.w.XY20          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     854  10521 GPC1.w.XY21          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     855  10522 GPC1.w.XY22          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     856  10523 GPC1.w.XY23          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     857  10524 GPC1.w.XY24          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     858  10525 GPC1.w.XY25          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     859  10526 GPC1.w.XY26          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     860  10527 GPC1.w.XY27          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     861  10530 GPC1.w.XY30          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     862  10531 GPC1.w.XY31          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     863  10532 GPC1.w.XY32          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     864  10533 GPC1.w.XY33          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     865  10534 GPC1.w.XY34          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     866  10535 GPC1.w.XY35          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     867  10536 GPC1.w.XY36          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     868  10537 GPC1.w.XY37          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     869  10540 GPC1.w.XY40          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     870  10541 GPC1.w.XY41          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     871  10542 GPC1.w.XY42          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     872  10543 GPC1.w.XY43          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     873  10544 GPC1.w.XY44          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     874  10545 GPC1.w.XY45          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     875  10546 GPC1.w.XY46          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     876  10547 GPC1.w.XY47          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     877  10550 GPC1.w.XY50          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     878  10551 GPC1.w.XY51          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     879  10552 GPC1.w.XY52          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     880  10553 GPC1.w.XY53          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     881  10554 GPC1.w.XY54          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     882  10555 GPC1.w.XY55          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     883  10556 GPC1.w.XY56          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     884  10557 GPC1.w.XY57          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     885  10560 GPC1.w.XY60          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     886  10561 GPC1.w.XY61          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     887  10562 GPC1.w.XY62          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     888  10563 GPC1.w.XY63          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     889  10564 GPC1.w.XY64          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     890  10565 GPC1.w.XY65          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     891  10566 GPC1.w.XY66          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     892  10567 GPC1.w.XY67          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     893  10571 GPC1.w.XY71          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     894  10572 GPC1.w.XY72          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     895  10573 GPC1.w.XY73          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     896  10574 GPC1.w.XY74          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     897  10575 GPC1.w.XY75          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
     898  10576 GPC1.w.XY76          dep  26.060  0.000 0.000     -     - 0.0000     0     9   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88
    898899  11000 GPC1.g.SkyChip       dep  25.000  0.000 0.000     -     - 0.0000     0     1   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
    899900  11100 GPC1.r.SkyChip       dep  25.000  0.000 0.000     -     - 0.0000     0     2   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
  • branches/eam_branches/ipp-20130419/ippconfig/gpc1/psphot.config

  • branches/eam_branches/ipp-20130419/ippconfig/recipes/filerules-mef.mdc

    r35081 r35421  
    118118PSWARP.VARIANCE         INPUT    @FILES        CHIP       VARIANCE
    119119PSWARP.MASK             INPUT    @FILES        CHIP       MASK
    120 PSWARP.SKYCELL          INPUT    @FILES        CHIP       IMAGE
    121 PSWARP.ASTROM           INPUT    @FILES        CHIP       CMF
    122 PSWARP.BKGMODEL           INPUT    @FILES        CHIP       IMAGE
     120PSWARP.SKYCELL          INPUT    @FILES        CHIP       WCS
     121PSWARP.ASTROM           INPUT    @FILES        CHIP       WCS
     122PSWARP.BKGMODEL         INPUT    @FILES        CHIP       IMAGE
    123123
    124124## files used by ppsub
  • branches/eam_branches/ipp-20130419/ippconfig/recipes/filerules-simple.mdc

    r35081 r35421  
    8888PSWARP.VARIANCE           INPUT    @FILES        FPA        VARIANCE
    8989PSWARP.MASK               INPUT    @FILES        FPA        MASK
    90 PSWARP.SKYCELL            INPUT    @FILES        FPA        IMAGE     
    91 PSWARP.ASTROM             INPUT    @FILES        FPA        CMF
     90PSWARP.SKYCELL            INPUT    @FILES        FPA        WCS
     91PSWARP.ASTROM             INPUT    @FILES        FPA        WCS
    9292PSWARP.BKGMODEL           INPUT    @FILES        CHIP       IMAGE
    9393
  • branches/eam_branches/ipp-20130419/ippconfig/recipes/filerules-split.mdc

    r35116 r35421  
    106106PSWARP.VARIANCE           INPUT    @FILES        CHIP       VARIANCE
    107107PSWARP.MASK               INPUT    @FILES        CHIP       MASK
    108 PSWARP.SKYCELL            INPUT    @FILES        FPA        IMAGE
    109 PSWARP.ASTROM             INPUT    @FILES        CHIP       CMF
     108PSWARP.SKYCELL            INPUT    @FILES        CHIP       WCS
     109PSWARP.ASTROM             INPUT    @FILES        CHIP       WCS
     110#PSWARP.SKYCELL            INPUT    @FILES        CHIP       CMF
     111#PSWARP.ASTROM             INPUT    @FILES        CHIP       CMF
    110112PSWARP.BKGMODEL           INPUT    @FILES        CHIP       IMAGE
    111113                         
  • branches/eam_branches/ipp-20130419/ippconfig/recipes/ppSub.config

  • branches/eam_branches/ipp-20130419/ippconfig/recipes/psphot.config

    r35239 r35421  
    317317TEST_FIT_X                          F32   NAN
    318318TEST_FIT_Y                          F32   NAN
     319TEST_FIT_CONVOLVED                  BOOL  FALSE
    319320
    320321TEST_FIT_PAR0                       F32   NAN
  • branches/eam_branches/ipp-20130419/ippconfig/recipes/reductionClasses.mdc

  • branches/eam_branches/ipp-20130419/ppImage/src

  • branches/eam_branches/ipp-20130419/ppImage/src/ppImageParseCamera.c

    r35081 r35421  
    2222    ppImageOptions *options = ppImageOptionsParse(config);
    2323
    24     // parse the header to extract out whether this OTA has video cells.
    25     // CZW: 2012-05-01 I'm somewhat ashamed of what needs to be done to get to the header. There has to be a simpler way, right?
    26 /*     pmFPAview *view = pmFPAviewAlloc(0);// View for level of interest */
    27 /*     pmChip *chip;                       // Chip from FPA */
    28 /*     while ((chip = pmFPAviewNextChip(view, input->fpa, 1)) != NULL) { */
    29 /*       if (!chip->process || !chip->file_exists) { */
    30 /*      continue; */
    31 /*       } */
    32 /* /\*       if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { *\/ */
    33 /* /\*  continue; *\/ */
    34 /* /\*       } *\/ */
    35 /*       psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
    36 /*       if (psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE")) { */
    37 /*      psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
    38 /*      char *Vptr = strchr(psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE"),'V'); */
    39 /*      if (Vptr) { */
    40 /*        options->hasVideo = true; */
    41 /*        psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
    42 /*      } */
    43 /*       } */
    44 /*     } */
    45 /*     pmFPAviewReset(view); */
    46 /*     psFree(view); */
    47    
    4824    // the following are defined from the argument list, if given,
    4925    // otherwise they revert to the config information
  • branches/eam_branches/ipp-20130419/ppStack/src/ppStackCamera.c

    r35167 r35421  
    4747    }
    4848    bool convolve = psMetadataLookupBool(NULL, recipe, "CONVOLVE"); // Convolve images before stack?
    49     bool doBackground = psMetadataLookupBool(NULL, recipe, "BACKGROUND.MODEL");
    50     //    fprintf(stderr,"ppSC: %d\n",doBackground);   
     49
    5150    psArray *runImages = pmFPAfileDefineMultipleFromRun(&status, NULL, config,
    5251                                                        "PPSTACK.INPUT"); // Input images from previous run
     
    218217
    219218            // Grab bkgmodel information here
    220            
    221             //      if (doBackground) {
    222               if ((!bkgmodel) || (strlen(bkgmodel) == 0)) {
    223                 // We have no background models.
    224                 //              fprintf(stderr,"No backgrounds specified, resettting recipe value.\n");
    225                 doBackground = false;
    226                 psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE,
    227                                   "Do photometry on stacked image?", false);
    228 
     219            if ((!bkgmodel) || (strlen(bkgmodel) == 0)) {
     220              // We have no background models.
     221              psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Do photometry on stacked image?", false);
     222            } else {
     223              pmFPAfile *inputBKG = defineFile(config,NULL,"PPSTACK.INPUT.BKGMODEL",bkgmodel, PM_FPA_FILE_IMAGE);
     224              if (!inputBKG) {
     225                psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Do photometry on stacked image?", false);
     226
     227#if (0)
     228                psError(psErrorCodeLast(), false,
     229                        "Unable to define file from bkgmodel %d (%s)",i,bkgmodel);
     230                return(false);
     231#endif
    229232              }
    230               else {
    231                 pmFPAfile *inputBKG = defineFile(config,NULL,"PPSTACK.INPUT.BKGMODEL",bkgmodel,
    232                                                  PM_FPA_FILE_IMAGE);
    233                 if (!inputBKG) {
    234                   // We failed to generate an pmFPAfile, so disable the background construction and continue.
    235                   //              fprintf(stderr,"No backgrounds specified, resettting recipe value.\n");
    236                   doBackground = false;
    237                   psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE,
    238                                     "Do photometry on stacked image?", false);
    239 
    240 #if (0)
    241                   psError(psErrorCodeLast(), false,
    242                           "Unable to define file from bkgmodel %d (%s)",i,bkgmodel);
    243                   return(false);
    244 #endif
    245                 }
    246               }// End bkgmodel
    247               //            }
    248 
    249 
    250            
    251            
     233            } // End bkgmodel
    252234            i++;
    253235        }
  • branches/eam_branches/ipp-20130419/psLib/src/math/psEllipse.c

    r34257 r35421  
    155155
    156156// ellipse rotation (major, minor, theta) -> (sx, sy, sxy)
     157// theta is postive rotation of major axis away from x-axis
    157158psEllipseShape psEllipseAxesToShape(psEllipseAxes axes)
    158159{
  • branches/eam_branches/ipp-20130419/psModules

  • branches/eam_branches/ipp-20130419/psModules/src/astrom/pmAstrometryUtils.c

    r24096 r35421  
    2323#include "pmAstrometryUtils.h"
    2424
     25// this is used by the test output block
     26static int Nout = 0;
     27
    2528// given a 2D transformation -- L(x,y),M(x,y) -- find the coordinates x,y
    2629// for which L,M = 0,0. tol is the allowed error on x,y.
     
    3336    double Xo = (trans->y->coeff[0][0]*trans->x->coeff[0][1] - trans->x->coeff[0][0]*trans->y->coeff[0][1])/R;
    3437    double Yo = (trans->x->coeff[0][0]*trans->y->coeff[1][0] - trans->y->coeff[0][0]*trans->x->coeff[1][0])/R;
     38
     39    if (0) {
     40      // this is a test output block, not used in normal operations
     41      char filename[64];
     42      snprintf (filename, 64, "trans.%03d.md", Nout);
     43      FILE *f = fopen (filename, "w");
     44
     45      psMetadata *md = psMetadataAlloc();
     46
     47      psPolynomial2DtoMetadata (md, trans->x, "X");
     48      psPolynomial2DtoMetadata (md, trans->y, "Y");
     49      psMetadataConfigPrint (f, md);
     50      psFree (md);
     51      fclose (f);
     52      Nout ++;
     53    }
    3554
    3655    // iterate to actual solution: requires small non-linear terms
     
    5271        for (int i = 0; (dPos > tol) && (i < 20); i++) {
    5372            // NOTE: order for Alpha is: [y][x]
     73            // original Alpha->data.F32[1][0] = psPolynomial2DEval (XdY, Xo, Yo);
     74            // original Alpha->data.F32[0][1] = psPolynomial2DEval (YdX, Xo, Yo);
    5475            Alpha->data.F32[0][0] = psPolynomial2DEval (XdX, Xo, Yo);
    55             Alpha->data.F32[1][0] = psPolynomial2DEval (XdY, Xo, Yo);
    56             Alpha->data.F32[0][1] = psPolynomial2DEval (YdX, Xo, Yo);
     76            Alpha->data.F32[0][1] = psPolynomial2DEval (XdY, Xo, Yo);
     77            Alpha->data.F32[1][0] = psPolynomial2DEval (YdX, Xo, Yo);
    5778            Alpha->data.F32[1][1] = psPolynomial2DEval (YdY, Xo, Yo);
    5879
    59             Beta->data.F32[0] = psPolynomial2DEval (trans->x, Xo, Yo);
    60             Beta->data.F32[1] = psPolynomial2DEval (trans->y, Xo, Yo);
     80            Beta->data.F32[0] = -1.0 * psPolynomial2DEval (trans->x, Xo, Yo);
     81            Beta->data.F32[1] = -1.0 * psPolynomial2DEval (trans->y, Xo, Yo);
    6182
    6283            if (!psMatrixGJSolve (Alpha, Beta)) {
     
    7192            }
    7293
    73             Xo -= Beta->data.F32[0];
    74             Yo -= Beta->data.F32[1];
     94            Xo += Beta->data.F32[0];
     95            Yo += Beta->data.F32[1];
    7596            dPos = hypot(Beta->data.F32[0], Beta->data.F32[1]);
    76 
     97            psTrace ("psastro", 5, "i: %d, Xo,Yo : %f %f  dX, dY: %f %f dPos: %f\n", i, Xo, Yo, Beta->data.F32[0], Beta->data.F32[1], dPos);
    7798        }
    7899        psFree (Alpha);
  • branches/eam_branches/ipp-20130419/psModules/src/camera/pmFPAMaskWeight.c

    r35038 r35421  
    301301    psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section
    302302    if (!mdok || psRegionIsNaN(*trimsec)) {
    303         psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set --- unable to set variance.\n");
    304         return false;
     303      // if trimsec is not defined, use the full image
     304      trimsec = psRegionAlloc(0,0,0,0);
     305      // psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set --- unable to set variance.\n");
     306      // return false;
    305307    }
    306308
  • branches/eam_branches/ipp-20130419/psModules/src/camera/pmFPAfileDefine.c

    r34085 r35421  
    446446}
    447447
     448// given a filename, convert to UNIX namespace and read the PHU
     449psMetadata *readPHUfromFilename (char *filename, pmConfig *config) {
     450
     451    // Need to generate an FPA
     452    psString realName = pmConfigConvertFilename(filename, config, false, false);
     453    if (!realName) {
     454        psError(psErrorCodeLast(), false, "Failed to convert file name %s", filename);
     455        return NULL;
     456    }
     457
     458    // load the header of the first image
     459    // EXTWORD (fits->extword) is not relevant to the PHU
     460    psFits *fits = psFitsOpen(realName, "r"); // FITS file
     461    if (!fits) {
     462        psError(psErrorCodeLast(), false, "Failed to open file %s", realName);
     463        psFree(realName);
     464        return NULL;
     465    }
     466
     467    psMetadata *phu = psFitsReadHeader (NULL, fits); // Primary header
     468    if (!phu) {
     469        psError(psErrorCodeLast(), false, "Failed to read file header %s", realName);
     470        psFree(realName);
     471        return NULL;
     472    }
     473
     474    if (!psFitsClose(fits)) {
     475        psError(psErrorCodeLast(), false, "Failed to close file %s", realName);
     476        psFree(realName);
     477        psFree(phu);
     478        return NULL;
     479    }
     480
     481    return phu;
     482}
     483
     484// this this function wants to return:
     485// pmFPA, PHU, fileLevel, outConfig
     486// camera, cameraName, formatName
     487typedef struct {
     488    pmFPA *fpa;
     489    psMetadata *phu;
     490    psMetadata *format;
     491    pmFPALevel fileLevel;
     492    psString cameraName;
     493    psString formatName;
     494} pmFPAfromFilenameOutput;
     495
     496// for the given filename, read PHU and determine camera format; build an FPA for the file
     497bool pmFPAfromFilename (pmFPAfromFilenameOutput *output, pmConfig **outConfig, pmConfig *sysConfig, char *filename){
     498
     499    // Need to generate an FPA
     500    psMetadata *phu = readPHUfromFilename (filename, sysConfig);
     501    if (!phu) {
     502        psError(psErrorCodeLast(), false, "Failed to read PHU for %s", filename);
     503        return false;
     504    }
     505
     506    // if we expect the loaded FPA to differ in configuration from the current system configuration
     507    // generate an output config for this FPA
     508    pmConfig *config = NULL;
     509    if (outConfig) {
     510        config = pmConfigAlloc();
     511        config->user = psMemIncrRefCounter(sysConfig->user);
     512        config->system = psMemIncrRefCounter(sysConfig->system);
     513
     514        psFree (config->files);
     515        config->files = psMemIncrRefCounter(sysConfig->files);
     516        psFree (config->arguments);
     517        config->arguments = psMemIncrRefCounter(sysConfig->arguments);
     518
     519        *outConfig = config;
     520    } else {
     521        config = sysConfig;
     522    }
     523
     524    // values which are returned to calling function
     525    psString formatName = NULL; // Name of camera format
     526    psString cameraName = NULL; // Name of camera
     527    psMetadata *camera = NULL;  // Camera configuration
     528
     529    // Determine the current format from the header; determine camera if not specified already.
     530    psMetadata *format = pmConfigCameraFormatFromHeader(&camera, &cameraName, &formatName, config, phu, true);
     531    if (!format) {
     532        psError(psErrorCodeLast(), false, "Failed to determine camera format for %s", filename);
     533        psFree(camera);
     534        psFree(formatName);
     535        psFree(phu);
     536        return false;
     537    }
     538
     539    pmFPALevel fileLevel = pmFPAPHULevel(format);
     540    if (fileLevel == PM_FPA_LEVEL_NONE) {
     541        psError(PM_ERR_CONFIG, true, "Unable to determine file level for %s", filename);
     542        psFree(camera);
     543        psFree(formatName);
     544        psFree(phu);
     545        return false;
     546    }
     547
     548    // build the template fpa, set up the basic view
     549    // we supply the metaCamera name (if NULL, baseCamera name is used)
     550    pmFPA *fpa = pmFPAConstruct(camera, cameraName);
     551    psFree(camera);
     552
     553    if (!fpa) {
     554        psError(psErrorCodeLast(), false, "Failed to construct FPA from %s", filename);
     555        psFree(formatName);
     556        psFree(format);
     557        psFree(phu);
     558        return NULL;
     559    }
     560
     561    output->fpa = fpa;
     562    output->phu = phu;
     563    output->format = format;
     564    output->fileLevel = fileLevel;
     565    output->cameraName = cameraName;
     566    output->formatName = formatName;
     567
     568    return true;
     569
     570}
    448571
    449572/// Define a file from an array of filenames
    450 static pmFPAfile *fpaFileDefineFromArray(pmConfig *config, // Configuration
     573static pmFPAfile *fpaFileDefineFromArray(pmConfig **outConfig, // output configuration
     574                                         pmConfig *sysConfig, // global configuration
    451575                                         pmFPAfile *bind, // File to bind to, or NULL
    452576                                         const char *name, // Name of file
     
    454578    )
    455579{
    456     PS_ASSERT_PTR_NON_NULL(config, NULL);
     580    PS_ASSERT_PTR_NON_NULL(sysConfig, NULL);
    457581    PS_ASSERT_STRING_NON_EMPTY(name, NULL);
    458582
     
    463587    pmFPALevel fileLevel = PM_FPA_LEVEL_NONE; // Level for files
    464588    psMetadata *phu = NULL;             // Primary header
     589
    465590    if (bind) {
    466591        // Use the FPA we're binding to
     
    468593        fileLevel = bind->fileLevel;
    469594    } else {
    470         // Need to generate an FPA
    471         psString realName = pmConfigConvertFilename(filenames->data[0], config, false, false);
    472         if (!realName) {
    473             psError(psErrorCodeLast(), false, "Failed to convert file name %s", (char *)filenames->data[0]);
    474             return NULL;
    475         }
    476 
    477         // load the header of the first image
    478         // EXTWORD (fits->extword) is not relevant to the PHU
    479         psFits *fits = psFitsOpen(realName, "r"); // FITS file
    480         if (!fits) {
    481             psError(psErrorCodeLast(), false, "Failed to open file %s", realName);
    482             psFree(realName);
    483             return NULL;
    484         }
    485         phu = psFitsReadHeader (NULL, fits); // Primary header
    486         if (!phu) {
    487             psError(psErrorCodeLast(), false, "Failed to read file header %s", realName);
    488             psFree(realName);
    489             return NULL;
    490         }
    491         if (!psFitsClose(fits)) {
    492             psError(psErrorCodeLast(), false, "Failed to close file %s", realName);
    493             psFree(realName);
    494             return NULL;
    495         }
    496 
    497         // Determine the current format from the header; determine camera if not specified already.
    498         psMetadata *camera = NULL;      // Camera configuration
    499         format = pmConfigCameraFormatFromHeader(&camera, &cameraName, &formatName, config, phu, true);
    500         if (!format) {
    501             psError(psErrorCodeLast(), false, "Failed to determine camera format for %s", realName);
    502             psFree(camera);
    503             psFree(formatName);
    504             psFree(realName);
    505             psFree(phu);
    506             return NULL;
    507         }
    508 
    509         fileLevel = pmFPAPHULevel(format);
    510         if (fileLevel == PM_FPA_LEVEL_NONE) {
    511             psError(PM_ERR_CONFIG, true, "Unable to determine file level for %s", realName);
    512             psFree(camera);
    513             psFree(formatName);
    514             psFree(realName);
    515             psFree(phu);
    516             return NULL;
    517         }
    518 
    519         // build the template fpa, set up the basic view
    520         // XXX do we want this to be the baseCamera name or the metaCamera name?
    521         fpa = pmFPAConstruct(camera, cameraName);
    522         psFree(camera);
    523         if (!fpa) {
    524             psError(psErrorCodeLast(), false, "Failed to construct FPA from %s", realName);
    525             psFree(formatName);
    526             psFree(realName);
    527             psFree(format);
    528             psFree(phu);
    529             return NULL;
    530         }
    531         psFree(realName);
    532     }
     595        pmFPAfromFilenameOutput output;
     596        if (!pmFPAfromFilename (&output, outConfig, sysConfig, filenames->data[0])) {
     597            return NULL;
     598        }
     599        fpa = output.fpa;
     600        phu = output.phu;
     601        format = output.format;
     602        fileLevel = output.fileLevel;
     603        cameraName = output.cameraName;
     604        formatName = output.formatName;
     605    }
     606
     607    pmConfig *config = outConfig ? *outConfig : sysConfig;
    533608
    534609    // load the given filerule (from config->camera) and bind it to the fpa
     
    561636        // Check that the file corresponds to the same camera and format
    562637        if (!phu) {
    563             psString realName = pmConfigConvertFilename(filenames->data[i], config, false, false);
    564             if (!realName) {
    565                 psError(psErrorCodeLast(), false, "Failed to convert file name %s", (char*)filenames->data[i]);
     638            phu = readPHUfromFilename (filenames->data[i], config);
     639            if (!phu) {
     640                psError(psErrorCodeLast(), false, "Failed to read PHU for %s", (char *)filenames->data[i]);
    566641                return NULL;
    567642            }
    568             psFits *fits = psFitsOpen(realName, "r"); // FITS file
    569             if (!fits) {
    570                 psError(psErrorCodeLast(), false, "Failed to open file %s", realName);
    571                 psFree(realName);
    572                 return NULL;
    573             }
    574             phu = psFitsReadHeader(NULL, fits);
    575             if (!psFitsClose(fits)) {
    576                 psError(psErrorCodeLast(), false, "Failed to close file %s", realName);
    577                 psFree(realName);
    578                 return NULL;
    579             }
    580             if (!phu) {
    581                 psError(psErrorCodeLast(), false, "Failed to read file header %s", realName);
    582                 psFree(realName);
    583                 return NULL;
    584             }
    585             psFree(realName);
    586643        }
    587644
     
    651708}
    652709
    653 
    654 pmFPAfile *pmFPAfileDefineFromArgs(bool *success, pmConfig *config,
    655                                    const char *filename, const char *argname)
     710// find the file associated with the argname & generate a pmFPAfile for it based on the filerule
     711pmFPAfile *pmFPAfileDefineFromArgs(bool *success, pmConfig *config, const char *filename, const char *argname)
    656712{
    657713    PS_ASSERT_PTR_NON_NULL(config, NULL);
     
    676732    }
    677733
    678     pmFPAfile *file = fpaFileDefineFromArray(config, NULL, filename, filenames); // File of interest
     734    pmFPAfile *file = fpaFileDefineFromArray(NULL, config, NULL, filename, filenames); // File of interest
    679735
    680736    if (success) {
     
    685741}
    686742
    687 pmFPAfile *pmFPAfileBindFromArgs(bool *success, pmFPAfile *input, pmConfig *config,
    688                                 const char *filename, const char *argname)
     743// find the file associated with the argname & bind it to the given pmFPAfile for it based on the filerule
     744pmFPAfile *pmFPAfileBindFromArgs(bool *success, pmFPAfile *input, pmConfig *config, const char *filename, const char *argname)
    689745{
    690746    PS_ASSERT_PTR_NON_NULL(input, NULL);
     
    710766    }
    711767
    712     pmFPAfile *file = fpaFileDefineFromArray(config, input, filename, filenames); // File of interest
     768    pmFPAfile *file = fpaFileDefineFromArray(NULL, config, input, filename, filenames); // File of interest
    713769
    714770    if (success) {
     
    719775}
    720776
    721 pmFPAfile *pmFPAfileDefineSingleFromArgs(bool *success, pmConfig *config, const char *filename,
    722                                         const char *argname, int entry)
     777// find the specific file associated with the argname & generate a pmFPAfile for it based on the filerule
     778pmFPAfile *pmFPAfileDefineSingleFromArgs(bool *success, pmConfig *config, const char *filename, const char *argname, int entry)
    723779{
    724780    PS_ASSERT_PTR_NON_NULL(config, NULL);
     
    746802    psArray *single = psArrayAlloc(1);  // Array of single filename of interest
    747803    single->data[0] = psMemIncrRefCounter(filenames->data[entry]);
    748     pmFPAfile *file = fpaFileDefineFromArray(config, NULL, filename, single); // File of interest
     804    pmFPAfile *file = fpaFileDefineFromArray(NULL, config, NULL, filename, single); // File of interest
    749805    psFree(single);
    750806
     
    756812}
    757813
     814// find the file in the config list & generate a pmFPAfile for it based on the filerule
    758815pmFPAfile *pmFPAfileDefineFromRun(bool *success, pmFPAfile *bind, pmConfig *config, const char *filename)
    759816{
     
    769826    }
    770827
    771     pmFPAfile *file = fpaFileDefineFromArray(config, bind, filename, filenames); // File of interest
     828    pmFPAfile *file = fpaFileDefineFromArray(NULL, config, bind, filename, filenames); // File of interest
    772829    psFree(filenames);
    773830
     
    779836}
    780837
     838// find the files in the config list & generate an array of pmFPAfiles for them based on the filerule
    781839psArray *pmFPAfileDefineMultipleFromRun(bool *success, psArray *bind, pmConfig *config, const char *filename)
    782840{
     
    808866        dummy->data[0] = files->data[i];
    809867        pmFPAfile *bindFile = bind ? bind->data[i] : NULL; // File to which to bind
    810         files->data[i] = psMemIncrRefCounter(fpaFileDefineFromArray(config, bindFile, filename, dummy));
     868        files->data[i] = psMemIncrRefCounter(fpaFileDefineFromArray(NULL, config, bindFile, filename, dummy));
    811869        if (!files->data[i]) {
    812870            psError(psErrorCodeLast(), false, "Unable to define file %s %d", filename, i);
     
    823881
    824882    return files;
     883}
     884
     885// find the file associated with the argname & generate a pmFPAfile for it based on the filerule
     886pmFPAfile *pmFPAfileDefineNewConfig(bool *success, pmConfig **outConfig, pmConfig *sysConfig, const char *filename, const char *argname)
     887{
     888    PS_ASSERT_PTR_NON_NULL(outConfig, NULL);
     889    PS_ASSERT_PTR_NON_NULL(sysConfig, NULL);
     890    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     891    PS_ASSERT_STRING_NON_EMPTY(argname, NULL);
     892
     893    // Search the argument data for the named fileset (argname)
     894    bool status;                        // Status of MD lookup
     895    psArray *filenames = psMetadataLookupPtr(&status, sysConfig->arguments, argname); // Filenames for file
     896    if (!status) {
     897        if (success) {
     898            *success = true;
     899        }
     900        return NULL;
     901    }
     902    if (filenames->n == 0) {
     903        psError(PM_ERR_CONFIG, true, "No files in array in %s in arguments", argname);
     904        if (success) {
     905            *success = false;
     906        }
     907        return NULL;
     908    }
     909
     910    pmFPAfile *file = fpaFileDefineFromArray(outConfig, sysConfig, NULL, filename, filenames); // File of interest
     911
     912    if (success) {
     913        *success = file ? true : false;
     914    }
     915
     916    return file;
    825917}
    826918
  • branches/eam_branches/ipp-20130419/psModules/src/camera/pmFPAfileDefine.h

    r27657 r35421  
    8181    const char *filename                ///< Name of file
    8282    );
     83
     84// find the file associated with the argname & generate a pmFPAfile for it based on the filerule
     85pmFPAfile *pmFPAfileDefineNewConfig(
     86    bool *success,                      ///< Found files?
     87    pmConfig **outConfig,               ///< output configuration for this file
     88    pmConfig *sysConfig,                ///< existing system config info
     89    const char *filename,               ///< name of filerule
     90    const char *argname                 ///< argument entry
     91    );
     92
    8393
    8494// look for the given argname on the argument list.  find the give filename from the file rules
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_DEV.c

    r34403 r35421  
    295295// make an initial guess for parameters
    296296// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    297 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     297bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    298298{
    299299    psF32 *PAR  = model->params->data.F32;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_DEV.h

    r29004 r35421  
    55psF32 pmModelFunc_DEV(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_DEV(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_DEV(pmModel *model, pmSource *source);
     7bool pmModelGuess_DEV(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_DEV(const psVector *params);
    99psF64 pmModelRadius_DEV(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_EXP.c

    r34403 r35421  
    287287// make an initial guess for parameters
    288288// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    289 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     289bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    290290{
    291291    psF32 *PAR  = model->params->data.F32;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_EXP.h

    r29004 r35421  
    55psF32 pmModelFunc_EXP(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_EXP(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_EXP(pmModel *model, pmSource *source);
     7bool pmModelGuess_EXP(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_EXP(const psVector *params);
    99psF64 pmModelRadius_EXP(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_GAUSS.c

    r34403 r35421  
    192192// make an initial guess for parameters
    193193// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    194 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     194bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    195195{
    196196    psF32 *PAR  = model->params->data.F32;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_GAUSS.h

    r25738 r35421  
    55psF32 pmModelFunc_GAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_GAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_GAUSS(pmModel *model, pmSource *source);
     7bool pmModelGuess_GAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_GAUSS(const psVector *params);
    99psF64 pmModelRadius_GAUSS(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_PGAUSS.c

    r34403 r35421  
    193193// make an initial guess for parameters
    194194// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    195 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     195bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    196196{
    197197    psF32 *PAR  = model->params->data.F32;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_PGAUSS.h

    r25738 r35421  
    55psF32 pmModelFunc_PGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_PGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source);
     7bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_PGAUSS(const psVector *params);
    99psF64 pmModelRadius_PGAUSS(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_PS1_V1.c

    r34403 r35421  
    212212// make an initial guess for parameters
    213213// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    214 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     214bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    215215{
    216216    psF32 *PAR  = model->params->data.F32;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_PS1_V1.h

    r25738 r35421  
    55psF32 pmModelFunc_PS1_V1(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_PS1_V1(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source);
     7bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_PS1_V1(const psVector *params);
    99psF64 pmModelRadius_PS1_V1(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_QGAUSS.c

    r34403 r35421  
    213213// make an initial guess for parameters
    214214// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    215 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     215bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    216216{
    217217    psF32 *PAR  = model->params->data.F32;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_QGAUSS.h

    r25738 r35421  
    55psF32 pmModelFunc_QGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_QGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source);
     7bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_QGAUSS(const psVector *params);
    99psF64 pmModelRadius_QGAUSS(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_RGAUSS.c

    r34403 r35421  
    202202// make an initial guess for parameters
    203203// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    204 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     204bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    205205{
    206206    psF32 *PAR  = model->params->data.F32;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_RGAUSS.h

    r25738 r35421  
    55psF32 pmModelFunc_RGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_RGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source);
     7bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_RGAUSS(const psVector *params);
    99psF64 pmModelRadius_RGAUSS(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_SERSIC.c

    r34403 r35421  
    307307// make an initial guess for parameters
    308308// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    309 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     309bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    310310{
    311311    pmMoments *moments = source->moments;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_SERSIC.h

    r25738 r35421  
    55psF32 pmModelFunc_SERSIC(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_SERSIC(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_SERSIC(pmModel *model, pmSource *source);
     7bool pmModelGuess_SERSIC(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_SERSIC(const psVector *params);
    99psF64 pmModelRadius_SERSIC(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_TRAIL.c

    r35215 r35421  
    168168        dPAR[PM_PAR_THETA]  = PAR[PM_PAR_I0] * dPdT;
    169169        dPAR[PM_PAR_SIGMA]  = 0;        // we don't actually allow this to vary, so we do not need to calculate it
     170
     171        for (int i = 0; i < 7; i++) {
     172          if (isnan(dPAR[i])) {
     173            fprintf (stderr, "*");
     174          }
     175        }
     176    }
     177    if (isnan(f)) {
     178      fprintf (stderr, "!");
    170179    }
    171180    return(f);
     
    228237}
    229238
     239# define NA 21
     240# define NR 21
     241static float flux[NA][NR];
     242static float npix[NA][NR];
     243
     244bool pmTrailGetAngle (float *To, float *Io, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal, float sigma) {
     245
     246  float Xo, Yo;
     247  if (!pmModelSetPosition(&Xo, &Yo, source)) return false;
     248
     249  psImage *image = source->pixels;
     250  psImage *mask = source->maskObj;
     251  psF32 **imData = image->data.F32;
     252  psImageMaskType **mkData = mask->data.PS_TYPE_IMAGE_MASK_DATA;
     253
     254  // do a loop over the pixels, generating (dX,dY) dot (cos(theta),sin(theta))
     255  int dP;
     256  int dX = Xo - mask->col0;
     257  dP = mask->numCols - dX;
     258  int DX = PS_MAX(dP, dX);
     259  int NX = mask->numCols;
     260
     261  int dY = Yo - mask->row0;
     262  dP = mask->numRows - dY;
     263  int DY = PS_MAX(dP, dY);
     264  int NY = mask->numRows;
     265
     266  // just hard wire this for now...
     267  float radius = 10.0;
     268  float radius2 = PS_SQR(radius);
     269
     270  // we have an array of Angles x Radii
     271  float dT = M_PI / NA;
     272  for (int na = 0; na < NA; na++) {
     273    memset (flux[na], 0, NR*sizeof(float));
     274    memset (npix[na], 0, NR*sizeof(float));
     275  }
     276
     277  // we skip any pixels [real or virtual] outside of the specified radius (nominally the aperture radius)
     278  // ix and iy track pixels relative to the centroid
     279  for (int ix = -DX; ix < DX + 1; ix++) {
     280    if (ix > radius) continue;
     281    int mx = ix + dX;
     282    for (int iy = -DY; iy < DY + 1; iy++) {
     283      if (iy > radius) continue;
     284      if (ix*ix + iy*iy > radius2) continue;
     285      int my = iy + dY;
     286     
     287      // include count only the unmasked pixels within the image area
     288      if (mx < 0) continue;
     289      if (my < 0) continue;
     290      if (mx >= NX) continue;
     291      if (my >= NY) continue;
     292     
     293      // count pixels which are masked only with bad pixels
     294      if (mkData[my][mx] & maskVal)continue;
     295
     296      // we have defined NA to be 21
     297      int na = 0;
     298      for (float angle = 0.0; na < NA; angle += dT, na ++) {
     299
     300        // XXX optimization : pre-compute the angle sines and cosines
     301        float Rad = (ix * cos(angle)) + (iy * sin(angle));
     302        int nr = PS_MAX (PS_MIN (NR, Rad + 0.5*NR), 0);
     303
     304        flux[na][nr] += imData[my][mx];
     305        npix[na][nr] ++;
     306      }
     307    }
     308  }
     309
     310  // generate a psf model (with integral of 1.0)
     311  float Ao = 1.0 / sqrt(2*M_PI) / sigma;
     312  float psf[NR];
     313  for (int nr = 0; nr < NR; nr++) {
     314    psf[nr] = Ao*exp(-0.5*PS_SQR((nr - 0.5*NR)/sigma));
     315  }
     316
     317  float fangle[NA];
     318  for (int na = 0; na < NA; na++) {
     319    float fpsf = 0.0;
     320    for (int nr = 0; nr < NR; nr++) {
     321      fpsf += psf[nr]*flux[na][nr];
     322    }
     323    fangle[na] = fpsf;
     324    // fprintf (stderr, "fpsf: %f, theta = %f\n", fpsf, PS_DEG_RAD*dT*na);
     325  }
     326
     327  float peak = fangle[0];
     328  int pbin = 0;
     329  for (int na = 0; na < NA; na++) {
     330    if (fangle[na] > peak) {
     331      peak = fangle[na];
     332      pbin = na;
     333    }
     334  }
     335
     336  // result is peak, pbin -> angle
     337  *To = dT * pbin;
     338  *Io = peak * Ao;
     339 
     340  return true;
     341}
     342
    230343// make an initial guess for parameters
    231344// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    232 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     345bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    233346{
    234347    psF32 *PAR  = model->params->data.F32;
     
    260373    //else { size = psfAxes.major; }
    261374
     375    float theta, peak;
     376    pmTrailGetAngle (&theta, &peak, source, maskVal, markVal, psfAxes.major);
     377
    262378    // axes.major is a sigma in the major direction; scale to
    263379    PAR[PM_PAR_LENGTH] = 1.5*2.35*size; // a tophat of length L has L = 1.5 * 2.35 * sigma
     
    266382
    267383    // set the model normalization
    268     if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
    269       return false;
    270     }
     384    // if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
     385    //   return false;
     386    // }
     387    PAR[PM_PAR_I0] = peak;
    271388
    272389    // set the model position
  • branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_TRAIL.h

    r34259 r35421  
    55psF32 pmModelFunc_TRAIL(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_TRAIL(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_TRAIL(pmModel *model, pmSource *source);
     7bool pmModelGuess_TRAIL(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_TRAIL(const psVector *params);
    99psF64 pmModelRadius_TRAIL(const psVector *params, psF64 flux);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmModelFuncs.h

    r34259 r35421  
    107107//  This function provides the model guess parameters based on the details of
    108108//  the given source.
    109 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);
     109typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    110110
    111111//  This function constructs the PSF model for the given source based on the
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmPSF.c

    r34403 r35421  
    350350        shape.sx  = modelPar[PM_PAR_SXX];
    351351        shape.sy  = modelPar[PM_PAR_SYY];
    352         shape.sxy = modelPar[PM_PAR_SXY];
     352        shape.sxy = modelPar[PM_PAR_SXY] / 2.0;
     353        // XXX I *think* dividing by 2.0 is the right direction, but this
     354        // needs to be checked with a real test
    353355    } else {
    354356        shape.sx  = modelPar[PM_PAR_SXX] / M_SQRT2;
     
    392394        modelPar[PM_PAR_SXX] = shape.sx;
    393395        modelPar[PM_PAR_SYY] = shape.sy;
    394         modelPar[PM_PAR_SXY] = shape.sxy;
     396        modelPar[PM_PAR_SXY] = shape.sxy; // XXX NEED factor of 2 here for correct angle conversion
    395397    } else {
    396398        modelPar[PM_PAR_SXX] = shape.sx * M_SQRT2;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmPSFtryFitEXT.c

    r34403 r35421  
    8383        }
    8484
    85         source->modelEXT = pmSourceModelGuess (source, options->type);
     85        source->modelEXT = pmSourceModelGuess (source, options->type, maskVal, markVal);
    8686        if (source->modelEXT == NULL) {
    8787            psTrace ("psModules.objects", 4, "masking %d (%d,%d) : failed to generate model guess\n", i, source->peak->x, source->peak->y);
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceFitModel.c

    r34403 r35421  
    7575    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
    7676    PS_ASSERT_PTR_NON_NULL(source->maskObj, false);
    77     PS_ASSERT_PTR_NON_NULL(source->variance, false);
     77
     78    // XXX if variance is NULL, use pixels instead (wrong, but not badly wrong)
     79    // PS_ASSERT_PTR_NON_NULL(source->variance, false);
    7880
    7981    psBool fitStatus = true;
     
    9395    float Xo = model->params->data.F32[PM_PAR_XPOS];
    9496    float Yo = model->params->data.F32[PM_PAR_YPOS];
     97
     98    // if variance is NULL, we pretend pixels == variance
     99    float **vWgt = source->variance ? source->variance->data.F32 : source->pixels->data.F32;
    95100
    96101    // fill in the coordinate and value entries
     
    103108            }
    104109            // skip zero-variance points
    105             if (source->variance->data.F32[i][j] == 0) {
     110            if (vWgt[i][j] == 0) {
    106111                continue;
    107112            }
    108113            // skip nan values in image
    109114            if (!isfinite(source->pixels->data.F32[i][j])) {
     115                fprintf (stderr, "WARNING: unmasked nan in image : %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);
    110116                continue;
    111117            }
    112118
    113119            // skip nan values in image
    114             if (!isfinite(source->variance->data.F32[i][j])) {
    115                 fprintf (stderr, "impossible! %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);
     120            if (!isfinite(vWgt[i][j])) {
     121                fprintf (stderr, "WARNING: unmasked nan in variance : %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);
    116122                continue;
    117123            }
     
    140146            // source sky variance
    141147            if (options->poissonErrors) {
    142                 yErr->data.F32[nPix] = 1.0 / source->variance->data.F32[i][j];
     148                yErr->data.F32[nPix] = 1.0 / vWgt[i][j];
    143149            } else {
    144150                yErr->data.F32[nPix] = 1.0 / options->weight;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceFitPCM.c

    r34403 r35421  
    145145bool pmSourceModelGuessPCM (pmPCMdata *pcm, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) {
    146146
    147     if (!pcm->modelConv->modelGuess(pcm->modelConv, source)) {
     147  if (!pcm->modelConv->modelGuess(pcm->modelConv, source, maskVal, markVal)) {
    148148        return false;
    149149    }
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceIO.c

    r34720 r35421  
    980980            return false;
    981981        }
     982
    982983        // if this is not TRUE, the output files only contain the psf measurements.
    983984        bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "EXTENDED_SOURCE_ANALYSIS");
     
    10051006            hdu->header = psFitsReadHeader (NULL, file->fits);
    10061007        }
     1008
     1009        // "WCS" is CMF without detected objects
     1010        if (file->type == PM_FPA_FILE_WCS) {
     1011          psTrace("psModules.objects", 6, "read CMF table from %s : %s : %s", file->filename, headname, dataname);
     1012          psFree (headname);
     1013          psFree (dataname);
     1014          psFree (deteffname);
     1015          break;
     1016        }
     1017
     1018        // EXTDATA is the PSF data associated with this image header
    10071019
    10081020        // we need to find the corresponding table EXTNAME.
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceMoments.c

    r34403 r35421  
    151151
    152152        float *vPix = source->pixels->data.F32[row];
    153         float *vWgt = source->variance->data.F32[row];
     153        float *vWgt = source->variance ? source->variance->data.F32[row] : source->pixels->data.F32[row];
    154154
    155155        psImageMaskType  *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row];
     
    266266
    267267    float **vPix = source->pixels->data.F32;
    268     float **vWgt = source->variance->data.F32;
    269     psImageMaskType  **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;
     268    float **vWgt = source->variance ? source->variance->data.F32 : source->pixels->data.F32;
     269    psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;
    270270
    271271    float RF = 0.0;
     
    467467
    468468        float *vPix = source->pixels->data.F32[row];
    469         float *vWgt = source->variance->data.F32[row];
     469        float *vWgt = source->variance ? source->variance->data.F32[row] : source->pixels->data.F32[row];
    470470
    471471        psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row];
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceSky.c

    r34403 r35421  
    122122    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    123123    PS_ASSERT_PTR_NON_NULL(source, false);
    124     PS_ASSERT_IMAGE_NON_NULL(source->variance, false);
    125124    PS_ASSERT_IMAGE_NON_NULL(source->maskObj, false);
    126125    PS_ASSERT_PTR_NON_NULL(source->peak, false);
    127126    PS_ASSERT_INT_POSITIVE(Radius, false);
     127
     128    if (source->variance == NULL) {
     129      // XXX this is needed so psphotCheckRadiusPSF has a real value
     130      source->moments->dSky = 1.0;
     131      return true;
     132    }
    128133
    129134    // maskVal is used to test for rejected pixels, and must include markVal
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceUtils.c

    r34403 r35421  
    4646
    4747/******************************************************************************
    48     pmSourceModelGuess(source, model): This function allocates a new
    49     pmModel structure based on the given modelType specified in the argument list.
    50     The corresponding pmModelGuess function is returned, and used to
    51     supply the values of the params array in the pmModel structure.
     48    pmSourceModelGuess(source, model, maskVal, markVal): This function allocates a new
     49    pmModel structure based on the given modelType specified in the argument list.  The
     50    corresponding pmModelGuess function is returned, and used to supply the values of the
     51    params array in the pmModel structure.
    5252 
    5353    XXX: Many parameters are based on the src->moments structure, which is in
     
    5555    functions will be in image, not subImage coords.  Remember this.
    5656*****************************************************************************/
    57 pmModel *pmSourceModelGuess(pmSource *source,
    58                             pmModelType modelType)
     57pmModel *pmSourceModelGuess(pmSource *source, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal)
    5958{
    6059    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
     
    6564    pmModel *model = pmModelAlloc(modelType);
    6665
    67     if (!model->modelGuess(model, source)) {
     66    if (!model->modelGuess(model, source, maskVal, markVal)) {
    6867        psFree (model);
    6968        return NULL;
  • branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceUtils.h

    r31451 r35421  
    2727pmModel *pmSourceModelGuess(
    2828    pmSource *source,   ///< The input pmSource
    29     pmModelType model   ///< The type of model to be created.
     29    pmModelType model,   ///< The type of model to be created.
     30    psImageMaskType maskVal,
     31    psImageMaskType markVal
    3032);
    3133
  • branches/eam_branches/ipp-20130419/psphot

  • branches/eam_branches/ipp-20130419/psphot/src

  • branches/eam_branches/ipp-20130419/psphot/src/models/pmModel_STRAIL.c

    r31154 r35421  
    475475
    476476//fixed I think...no good way of guessing as far as I can tell
    477 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     477bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    478478{
    479479    pmMoments *Smoments = source->moments;
  • branches/eam_branches/ipp-20130419/psphot/src/models/pmModel_TEST1.c

    r31154 r35421  
    123123
    124124// make an initial guess for parameters
    125 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     125bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    126126{
    127127    pmMoments *moments = source->moments;
  • branches/eam_branches/ipp-20130419/psphot/src/psphotExtendedSourceFits.c

    r34404 r35421  
    9090    assert (markVal);
    9191
     92    // source fitting parameters for extended source fits
     93    int fitIter = psMetadataLookupS32(&status, recipe, "EXT_FIT_ITER"); // Max number of fit iterations
     94    assert (status && fitIter > 0);
     95
     96    float fitMinTol = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MIN_TOL"); // Fit tolerance
     97    if (!status || !isfinite(fitMinTol) || fitMinTol <= 0) {
     98        fitMinTol = psMetadataLookupF32 (&status, recipe, "PSF_FIT_TOL"); // Fit tolerance
     99        if (!status || !isfinite(fitMinTol) || fitMinTol <= 0) {
     100            psAbort("PSF_FIT_MIN_TOL (and PSF_FIT_TOL) not defined or positive");
     101        }
     102    }
     103
     104    float fitMaxTol = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MAX_TOL"); // Fit tolerance
     105    if (!status || !isfinite(fitMaxTol) || fitMaxTol <= 0) {
     106        fitMaxTol = 1.0;
     107    }
     108
    92109    // maskVal is used to test for rejected pixels, and must include markVal
    93110    maskVal |= markVal;
     
    181198
    182199            PS_ARRAY_ADD_SCALAR(job->args, psfSize, PS_TYPE_S32);
     200            PS_ARRAY_ADD_SCALAR(job->args, fitIter, PS_TYPE_S32);
     201            PS_ARRAY_ADD_SCALAR(job->args, fitMinTol, PS_TYPE_F32);
     202            PS_ARRAY_ADD_SCALAR(job->args, fitMaxTol, PS_TYPE_F32);
     203
    183204            PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK);
    184205            PS_ARRAY_ADD_SCALAR(job->args, markVal, PS_TYPE_IMAGE_MASK);
     
    293314    psRegion *region        = job->args->data[4];
    294315    int psfSize             = PS_SCALAR_VALUE(job->args->data[5],S32);
    295     psImageMaskType maskVal = PS_SCALAR_VALUE(job->args->data[6],PS_TYPE_IMAGE_MASK_DATA);
    296     psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[7],PS_TYPE_IMAGE_MASK_DATA);
     316    int fitIter             = PS_SCALAR_VALUE(job->args->data[6],S32);
     317    float fitMinTol         = PS_SCALAR_VALUE(job->args->data[7],F32);
     318    float fitMaxTol         = PS_SCALAR_VALUE(job->args->data[8],F32);
     319    psImageMaskType maskVal = PS_SCALAR_VALUE(job->args->data[9],PS_TYPE_IMAGE_MASK_DATA);
     320    psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[10],PS_TYPE_IMAGE_MASK_DATA);
    297321
    298322    // Define source fitting parameters for extended source fits
     
    301325    fitOptions->saveCovariance = true;  // XXX make this a user option?
    302326    fitOptions->covarFactor    = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
    303 
    304     // XXX for now, use the defaults for the rest:
    305     // fitOptions->nIter         = fitIter;
    306     // fitOptions->tol           = fitTol;
    307     // fitOptions->poissonErrors = poisson;
    308     // fitOptions->weight        = PS_SQR(skySig);
     327    fitOptions->nIter          = fitIter;
     328    fitOptions->minTol         = fitMinTol;
     329    fitOptions->maxTol         = fitMaxTol;
    309330
    310331    // choose the sources of interest
     
    335356        // set the fit radius based on the first radial moment (also sets the mask pixels)
    336357        psphotSetRadiusMomentsExact(&fitRadius, &windowRadius, readout, source, markVal); // NOTE : 6 allocs
     358
     359        // XXX WATCH OUT HERE!!
     360        // fitRadius = 30;
    337361
    338362        // UPDATE : we have changed the moments calculation.  There is now an iteration within
     
    498522
    499523    // change the value of a scalar on the array (wrap this and put it in psArray.h)
    500     scalar = job->args->data[8];
     524    scalar = job->args->data[11];
    501525    scalar->data.S32 = Next;
    502526
    503     scalar = job->args->data[9];
     527    scalar = job->args->data[12];
    504528    scalar->data.S32 = Nconvolve;
    505529
    506     scalar = job->args->data[10];
     530    scalar = job->args->data[13];
    507531    scalar->data.S32 = NconvolvePass;
    508532
    509     scalar = job->args->data[11];
     533    scalar = job->args->data[14];
    510534    scalar->data.S32 = Nplain;
    511535
    512     scalar = job->args->data[12];
     536    scalar = job->args->data[15];
    513537    scalar->data.S32 = NplainPass;
    514538
    515     scalar = job->args->data[13];
     539    scalar = job->args->data[16];
    516540    scalar->data.S32 = Nfaint;
    517541
    518     scalar = job->args->data[14];
     542    scalar = job->args->data[17];
    519543    scalar->data.S32 = Nfail;
    520544
  • branches/eam_branches/ipp-20130419/psphot/src/psphotFakeSources.c

    r19881 r35421  
    2424
    2525        pmModelType modelType = pmModelClassGetType ("PS_MODEL_QGAUSS");
    26         source->modelPSF = pmSourceModelGuess (source, modelType);
     26        source->modelPSF = pmSourceModelGuess (source, modelType, 0, 0);
    2727        sources->data[i] = source;
    2828    }
  • branches/eam_branches/ipp-20130419/psphot/src/psphotMakeResiduals.c

    r34086 r35421  
    105105        if (model == NULL) continue;  // model must be defined
    106106
    107         psImage *image  = psImageCopy (NULL, source->pixels,   PS_TYPE_F32);
    108         psImage *variance = psImageCopy (NULL, source->variance,   PS_TYPE_F32);
    109         psImage *mask   = psImageCopy (NULL, source->maskView, PS_TYPE_IMAGE_MASK);
     107        psImage *image    = psImageCopy (NULL, source->pixels,     PS_TYPE_F32);
     108        psImage *mask     = psImageCopy (NULL, source->maskView ? source->maskView : source->maskObj,  PS_TYPE_IMAGE_MASK);
     109        psImage *variance = psImageCopy (NULL, source->variance ? source->variance : source->pixels,   PS_TYPE_F32);
    110110        pmModelSub (image, mask, model, PM_MODEL_OP_FUNC, maskVal);
    111111
  • branches/eam_branches/ipp-20130419/psphot/src/psphotModelTestArguments.c

    r32348 r35421  
    151151    }
    152152
     153    // chip selection is used to limit chips to be processed
     154    if ((N = psArgumentGet (argc, argv, "-moments-radius"))) {
     155        psArgumentRemove (N, &argc, argv);
     156        psMetadataAddBool (config->arguments, PS_LIST_TAIL, "TEST_MOMENTS_RADIUS", PS_DATA_BOOL, "", true);
     157    }
     158
    153159    // if these command-line options are supplied, load the file name lists into config->arguments
    154160    // override any configuration-specified source for these files
     
    160166    pmConfigFileSetsMD (config->arguments, &argc, argv, "SRC", "-src", "-srclist");
    161167    pmConfigFileSetsMD (config->arguments, &argc, argv, "SRCTEXT", "-srctext", "-srctextlist");
     168
     169    pmConfigFileSetsMD (config->arguments, &argc, argv, "PSPHOT.PSF", "-psf",      "-psflist");
    162170
    163171    if (argc == 1) {
  • branches/eam_branches/ipp-20130419/psphot/src/psphotModelTestReadout.c

    r32348 r35421  
    55
    66    bool status;
     7
     8    psTimerStart ("modelTest");
    79
    810    pmModelClassSetLimits(PM_MODEL_LIMITS_LAX);
     
    4143    }
    4244
     45    // load the psf model, if suppled.  FWHM_MAJ,FWHM_MIN,etc are determined and saved on
     46    // readout->analysis. NOTE: this function currently only loads from PSPHOT.PSF.LOAD
     47    if (!psphotLoadPSF (config, view, filerule)) { // ??? need to supply 2 ?
     48        psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model");
     49        return psphotReadoutCleanup (config, view, filerule);
     50    }
     51
    4352    float MIN_KRON_RADIUS = 5.0;
    4453
     
    5362    // maskVal is used to test for rejected pixels, and must include markVal
    5463    maskVal |= markVal;
     64
     65    // what fraction of the PSF is used? (radius in pixels : 2 -> 5x5 box)
     66    int psfSize = psMetadataLookupS32 (&status, recipe, "PCM_BOX_SIZE");
     67    assert (status);
    5568
    5669    // find the currently selected readout
     
    8497
    8598    // define the source of interest
    86    float xObj     = psMetadataLookupF32 (&status, recipe, "TEST_FIT_X");
     99    float xObj     = psMetadataLookupF32 (&status, recipe, "TEST_FIT_X");
    87100    float yObj     = psMetadataLookupF32 (&status, recipe, "TEST_FIT_Y");
    88101    if (!isfinite(xObj) || !isfinite(yObj)) psAbort ("object position is not defined");
     
    99112    source->type = PM_SOURCE_TYPE_EXTENDED;
    100113
     114    bool TEST_FIT_CONVOLVED = psMetadataLookupBool (&status, recipe, "TEST_FIT_CONVOLVED");
     115
    101116    // find the local sky
    102117    status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal);
    103118    if (!status) psAbort("pmSourceLocalSky error");
    104119
    105     {
     120    bool testMomentsRadius = psMetadataLookupBool (&status, config->arguments, "TEST_MOMENTS_RADIUS");
     121    if (testMomentsRadius) {
    106122        // XXX I want to test an iterative aperture for brighter sources
    107123        float radius = mRADIUS;
     
    109125
    110126            // get the source moments
    111             status = pmSourceMoments (source, radius, 0.0, 0.0, MIN_KRON_RADIUS, maskVal);
     127            status = pmSourceMoments (source, radius, 0.25*radius, 0.0, MIN_KRON_RADIUS, maskVal);
    112128            if (!status) psAbort("psSourceMoments error");
    113129
     
    121137
    122138    // get the source moments
    123     status = pmSourceMoments (source, mRADIUS, 0.0, 0.0, MIN_KRON_RADIUS, maskVal);
     139    status = pmSourceMoments (source, mRADIUS, 0.25*mRADIUS, 0.0, MIN_KRON_RADIUS, maskVal);
    124140    if (!status) psAbort("psSourceMoments error");
    125141
     
    135151    fprintf (stderr, "axes: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor);
    136152
     153    pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
     154    if (psf) {
     155      // set PSF parameters for this model (apply 2D shape model to coordinates Xo, Yo)
     156      source->peak->rawFlux = source->moments->Peak;
     157      float Io = source->moments->Peak;
     158      source->modelPSF = pmModelFromPSFforXY(psf, xObj, yObj, Io);
     159    }
     160
    137161    // get the initial model parameter guess
    138     pmModel *model = pmSourceModelGuess (source, modelType);
     162    pmModel *model = pmSourceModelGuess (source, modelType, maskVal, markVal);
    139163    source->modelEXT = model;
    140164
     
    159183    fprintf (stderr, "peak: %f @ (%f, %f)\n", source->moments->Sum*area, (double)source->peak->x, (double)source->peak->y);
    160184
    161     // list model input shape
    162     psEllipseShape shape;
    163     shape.sx  = 1.4 / model->params->data.F32[4];
    164     shape.sy  = 1.4 / model->params->data.F32[5];
    165     shape.sxy = model->params->data.F32[6];
    166     axes = psEllipseShapeToAxes (shape, 20.0);
    167 
    168     fprintf (stderr, "guess: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor);
     185    if (modelType == pmModelClassGetType("PS_MODEL_TRAIL")) {
     186        fprintf (stderr, "guess: %f @ (%f, %f)\n", params[6]*180/M_PI, params[4], params[5]);
     187    } else {
     188        // list model input shape
     189        psEllipseShape shape;
     190        shape.sx  = 1.4 / model->params->data.F32[4];
     191        shape.sy  = 1.4 / model->params->data.F32[5];
     192        shape.sxy = model->params->data.F32[6];
     193        axes = psEllipseShapeToAxes (shape, 20.0);
     194        fprintf (stderr, "guess: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor);
     195    }
    169196
    170197    fprintf (stderr, "input parameters: \n");
     
    190217    fitOptions->covarFactor   = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
    191218
    192     status = pmSourceFitModel (source, model, fitOptions, maskVal);
     219    if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) {
     220        fitOptions->mode = PM_SOURCE_FIT_NO_INDEX;
     221    }
     222    if (modelType == pmModelClassGetType("PS_MODEL_TRAIL")) {
     223        fitOptions->mode = PM_SOURCE_FIT_TRAIL;
     224    }
     225
     226    if (TEST_FIT_CONVOLVED) {
     227      pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize);
     228      if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) {
     229        psphotSersicModelClassGuessPCM (pcm, source);
     230      } else {
     231        pmSourceModelGuessPCM (pcm, source, maskVal, markVal);
     232      }
     233      pmPCMupdate(pcm, source, fitOptions, model);
     234      pmSourceFitPCM (pcm, source, fitOptions, maskVal, markVal, psfSize);
     235      psFree (pcm);
     236    } else {
     237      status = pmSourceFitModel (source, model, fitOptions, maskVal);
     238    }
    193239
    194240    // measure the source mags
  • branches/eam_branches/ipp-20130419/psphot/src/psphotSetThreads.c

    r34559 r35421  
    4040    psFree(task);
    4141
    42     task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 15);
     42    task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 18);
    4343    task->function = &psphotExtendedSourceFits_Threaded;
    4444    psThreadTaskAdd(task);
  • branches/eam_branches/ipp-20130419/psphot/src/psphotSourceFits.c

    r34258 r35421  
    457457
    458458    // use the source moments, etc to guess basic model parameters
    459     pmModel *model = pmSourceModelGuess (source, modelType);
     459    pmModel *model = pmSourceModelGuess (source, modelType, maskVal, markVal);
    460460    if (!model) {
    461461        psTrace ("psphot", 5, "failed to generate a model for source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy);
     
    625625        model->params->data.F32[PM_PAR_7] = 0.5/indexGuess[i];
    626626
    627         if (!model->modelGuess(model, source)) {
     627        if (!model->modelGuess(model, source, maskVal, markVal)) {
    628628            model->flags |= PM_MODEL_STATUS_BADARGS;
    629629            return false;
     
    648648    model->flags = PM_MODEL_STATUS_NONE; // do not attempt to handle failures here, let the next iteration deal with it
    649649    model->params->data.F32[PM_PAR_7] = 0.5/indexGuess[iMin];
    650     model->modelGuess(model, source);
     650    model->modelGuess(model, source, maskVal, markVal);
    651651
    652652    return true;
     
    677677        model->params->data.F32[PM_PAR_7] = indexGuess[i];
    678678       
    679         if (!model->modelGuess(model, source)) {
     679        if (!model->modelGuess(model, source, maskVal, markVal)) {
    680680            model->flags |= PM_MODEL_STATUS_BADARGS;
    681681            return false;
  • branches/eam_branches/ipp-20130419/psphot/src/psphotStackImageLoop.c

  • branches/eam_branches/ipp-20130419/pswarp/src/Makefile.am

    r28043 r35421  
    2828        pswarp.c                        \
    2929        pswarpArguments.c               \
    30         pswarpExit.c                    \
     30        pswarpExitCode.c                \
    3131        pswarpLoop.c                    \
     32        pswarpLoopBackground.c          \
     33        pswarpCleanup.c                 \
     34        pswarpStatsFile.c               \
    3235        pswarpDefine.c                  \
    33         pswarpDefineSkycell.c           \
     36        pswarpDefineBackground.c        \
     37        pswarpDefineSkycell.c   \
    3438        pswarpErrorCodes.c              \
    3539        pswarpMapGrid.c                 \
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarp.c

    r34800 r35421  
    1212
    1313#include "pswarp.h"
    14 #include "pswarpFileNames.h"
    1514
    1615int main (int argc, char **argv)
     
    2221    psphotInit();
    2322
    24     const char *statsName = NULL;       // Filename for statistics
    25     psMetadata *stats = NULL;           // Container for statistics
    26     FILE *statsFile = NULL;             // File stream for statistics
    27 
    2823    pmConfig *config = pswarpArguments(argc, argv);
    2924    if (!config) {
    30         goto DIE;
     25        pswarpCleanup(config, NULL);
    3126    }
     27
     28    pswarpStatsFile *statsFile = pswarpStatsFileOpen (config);
    3229
    3330    pswarpVersionPrint();
     
    3532    // load identify the data sources
    3633    if (!pswarpParseCamera(config)) {
    37         goto DIE;
     34        pswarpCleanup(config, statsFile);
    3835    }
    3936
    4037    if (!pswarpOptions(config)) {
    41         goto DIE;
     38        pswarpCleanup(config, statsFile);
    4239    }
    4340
    44     // load the skycell layout information
     41    // load the skycell layout information:
     42    //   read the output astrometry description
     43    //   generate the output pixels
     44    //   convert header astrometry to pmFPA astrometry structures
    4545    if (!pswarpDefine(config)) {
    46         goto DIE;
     46        pswarpCleanup(config, statsFile);
    4747    }
    48     if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND.MODEL")) {
    49       if (!pswarpDefineBackground(config)) {
    50         goto DIE;
    51       }
    52     }
    53 
    54     // Open the statistics file
    55     bool mdok;                          ///< Status of MD lookup
    56     statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); ///< Filename for statistics
    57     if (mdok && statsName && strlen(statsName) > 0) {
    58         psString resolved = pmConfigConvertFilename(statsName, config, true, true);
    59         statsFile = fopen(resolved, "w");
    60         if (!statsFile) {
    61             psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.\n", resolved);
    62             psFree(resolved);
    63             goto DIE;
    64         }
    65         psFree(resolved);
    66         stats = psMetadataAlloc();
    67         psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
     48    if (!pswarpDefineBackground(config)) {
     49        pswarpCleanup(config, statsFile);
    6850    }
    6951
    7052    // load and warp
    71     if (!pswarpLoop(config, stats)) {
    72         goto DIE;
     53    if (!pswarpLoop(config, statsFile->md)) {
     54        pswarpCleanup(config, statsFile);
    7355    }
    74     if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND.MODEL")) {
    75       if (!pswarpLoopBackground(config, stats)) {
     56    if (!pswarpLoopBackground(config, statsFile->md)) {
    7657        fprintf(stderr,"Dying!\n");
    77         goto DIE;
    78       }
     58        pswarpCleanup(config, statsFile);
    7959    }
    8060
    8161    psLogMsg("pswarp", PS_LOG_INFO, "complete pswarp run: %f sec\n", psTimerMark("pswarp"));
     62    pswarpCleanup(config, statsFile);
     63}
    8264
    83 DIE:
    84     {
    85         psExit exitValue = pswarpExitCode(PS_EXIT_SUCCESS); // Exit code
    86 
    87         // Ensure everything is written out, at every level
    88         pswarpFileActivation(config, detectorFiles, true);
    89         pswarpFileActivation(config, skycellFiles, true);
    90         pswarpFileActivation(config, photFiles, true);
    91         pswarpFileActivation(config, independentFiles, true);
    92         if (!pswarpIOChecksAfter(config)) {
    93             psError(psErrorCodeLast(), false, "Unable to write files.");
    94             exitValue = pswarpExitCode(exitValue);
    95             pmFPAfileFreeSetStrict(false);
    96         }
    97 
    98         // Write out summary statistics
    99         if (stats && statsFile) {
    100             psMetadataAddF32(stats, PS_LIST_TAIL, "DT_WARP", 0, "Time for warp completion",
    101                              psTimerMark("pswarp"));
    102 
    103             const char *statsMDC = psMetadataConfigFormat(stats);
    104             if (!statsMDC) {
    105                 psError(psErrorCodeLast(), false, "Unable to get statistics file.");
    106                 exitValue = pswarpExitCode(exitValue);
    107             }
    108             psFree(stats);
    109             if (fprintf(statsFile, "%s", statsMDC) != strlen(statsMDC)) {
    110                 psError(PSWARP_ERR_IO, true, "Unable to write statistics file.");
    111                 exitValue = pswarpExitCode(exitValue);
    112             }
    113             psFree(statsMDC);
    114             if (fclose(statsFile) == EOF) {
    115                 psError(PSWARP_ERR_IO, true, "Unable to close statistics file.");
    116                 exitValue = pswarpExitCode(exitValue);
    117             }
    118             pmConfigRunFilenameAddWrite(config, "STATS", statsName);
    119         }
    120 
    121         // Dump configuration
    122         psString dump_file = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG");
    123         if (dump_file) {
    124             if (!pmConfigDump(config, dump_file)) {
    125                 psError(psErrorCodeLast(), false, "Unable to dump configuration");
    126                 exitValue = pswarpExitCode(exitValue);
    127             }
    128         }
    129 
    130         psThreadPoolFinalize();
    131         psMemCheckCorruption(stderr, true);
    132 
    133         psFree(config);
    134 
    135         psTimerStop();
    136         pmVisualClose();
    137         pmModelClassCleanup();
    138         pmConceptsDone();
    139         pmConfigDone();
    140         psLibFinalize();
    141 
    142         exitValue = pswarpExitCode(exitValue);
    143         return exitValue;
    144     }
    145 }
     65// NOTE: pswarpCleanup calls exit
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarp.h

    r34800 r35421  
    7777    double jacobian;                    ///< (Square root of) local Jacobian
    7878} pswarpTransformTileArgs;
     79
     80typedef struct {
     81    FILE *f;                            // File stream for statistics
     82    char *name;                         // Filename for statistics
     83    psMetadata *md;                     // Container for statistics
     84} pswarpStatsFile;
    7985
    8086pswarpTransformTileArgs *pswarpTransformTileArgsAlloc(void);
     
    160166    );
    161167
     168pswarpStatsFile *pswarpStatsFileAlloc ();
     169pswarpStatsFile *pswarpStatsFileOpen (pmConfig *config);
     170bool pswarpStatsFileSave (pmConfig *config, pswarpStatsFile *statsFile);
     171
     172// cleanup memory and exit
     173void pswarpCleanup (pmConfig *config, pswarpStatsFile *statsFile) PS_ATTR_NORETURN;
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarpArguments.c

    r34800 r35421  
    183183   
    184184    // Set recipe values in the recipe (since we've possibly altered some)
    185     psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE,
    186                      "Iso-astrom grid spacing in x", nGridX);
    187     psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NY", PS_META_REPLACE,
    188                      "Iso-astrom grid spacing in y", nGridY);
    189     psMetadataAddStr(recipe, PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE,
    190                      "Interpolation mode", name);
    191     psMetadataAddS32(recipe, PS_LIST_TAIL, "INTERPOLATION.NUM", PS_META_REPLACE,
    192                      "Interpolation pre-calculated kernels", numKernels);
    193     psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE,
    194                      "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
     185    psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE, "Iso-astrom grid spacing in x", nGridX);
     186    psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NY", PS_META_REPLACE, "Iso-astrom grid spacing in y", nGridY);
     187    psMetadataAddStr(recipe, PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, "Interpolation mode", name);
     188    psMetadataAddS32(recipe, PS_LIST_TAIL, "INTERPOLATION.NUM", PS_META_REPLACE, "Interpolation pre-calculated kernels", numKernels);
     189    psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE, "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
    195190    psMetadataAddBool(recipe, PS_LIST_TAIL, "PSF", PS_META_REPLACE, "Generate a PSF Model?", PSF);
    196191    psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Generate the warped background model?", doBKG);
     
    198193    psMetadataAddS32(recipe, PS_LIST_TAIL, "BKG.YGRID", PS_META_REPLACE, "Ysize of background model", bkgYgrid);
    199194   
    200    
    201195    // Set recipe values in the arguments
    202     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0,
    203                      "Iso-astrom grid spacing in x", nGridX);
    204     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NY", 0,
    205                      "Iso-astrom grid spacing in y", nGridY);
    206     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.MODE", 0,
    207                      "Interpolation mode", interpolationMode);
    208     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.NUM", 0,
    209                      "Interpolation pre-calculated kernels", numKernels);
    210     psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0,
    211                      "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
     196    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0, "Iso-astrom grid spacing in x", nGridX);
     197    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NY", 0, "Iso-astrom grid spacing in y", nGridY);
     198    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.MODE", 0, "Interpolation mode", interpolationMode);
     199    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.NUM", 0, "Interpolation pre-calculated kernels", numKernels);
     200    psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0, "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
    212201    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSF", PS_META_REPLACE, "Generate a PSF Model?", PSF);
    213202    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Generate the warped background model?", doBKG);
     
    215204    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "BKG.YGRID", PS_META_REPLACE, "Ysize of background model", bkgYgrid);
    216205
    217     psTrace("pswarp", 1, "Done with pswarpArguments...\n");
     206    psTrace("pswarp", 1, "Done with pswarpOptions...\n");
    218207
    219208    return (config);
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarpDefine.c

    r34800 r35421  
    11/** @file pswarpDefine.c
    22 *
    3  *  @brief
    4  *
     3 *  @brief generates the output images
    54 *  @ingroup pswarp
    65 *
     
    1312# include "pswarp.h"
    1413
    15 /**
    16  * loads the skycell metadata
    17  */
    1814bool pswarpDefine (pmConfig *config) {
    1915
     
    4238    }
    4339   
    44     // open the full skycell file; no need to defer different depths. only load the header data
    45     pmFPAview *view = pmFPAviewAlloc (0);
    46     pmFPAfileOpen (skycell, view, config);
     40    // Read the output astrometry
     41    // XXX this section loops over the input skycell to load the header info
     42    {
     43        pmFPAview *view = pmFPAviewAlloc(0);
    4744
    48     // Read header and create target
    49     {
    50         if (!pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config)) {
    51             psError(psErrorCodeLast(), false, "Unable to read headers for skycell.");
    52             psFree(view);
    53             return false;
    54         }
    55         view->chip = 0;
    56         view->cell = 0;
    57         view->readout = 0;
    58         pmCell *source = pmFPAfileThisCell(config->files, view, "PSWARP.SKYCELL"); ///< Source cell
    59         pmHDU *hdu = pmHDUFromCell(source); ///< HDU for source
    60         if (!hdu || !hdu->header) {
    61             psError(PM_ERR_PROG, false, "Unable to find header for sky cell.");
    62             psFree(view);
    63             return false;
    64         }
    65         int numCols = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); ///< Number of columns
    66         int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); ///< Number of rows
    67         if ((numCols == 0) || (numRows == 0)) {
    68             psError(PSWARP_ERR_DATA, false, "skycell has invalid dimensions %d x %d", numCols, numRows);
    69             psFree(view);
    70             return false;
    71         }
     45        pmChip *chip;
     46        if (!pmFPAfileRead (skycell, view, config)) {
     47            psError(PS_ERR_IO, false, "failed READ at FPA %s", skycell->name);
     48            psFree(view);
     49            return false;
     50        }
     51        while ((chip = pmFPAviewNextChip (view, skycell->fpa, 1)) != NULL) {
     52            psTrace ("pswarp", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     53            if (!chip->process || !chip->file_exists) { continue; }
     54            if (!pmFPAfileRead (skycell, view, config)) {
     55                psError(psErrorCodeLast(), false, "failed READ at CHIP %s", skycell->name);
     56                psFree(view);
     57                return false;
     58            }
     59            pmCell *cell;
     60            while ((cell = pmFPAviewNextCell (view, skycell->fpa, 1)) != NULL) {
     61                psTrace ("pswarp", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     62                if (!cell->process || !cell->file_exists) { continue; }
     63                if (!pmFPAfileRead (skycell, view, config)) {
     64                    psError(psErrorCodeLast(), false, "failed READ at CELL %s", skycell->name);
     65                    psFree(view);
     66                    return false;
     67                }
     68                if (!pmFPAfileClose(skycell, view)) {
     69                    psError(psErrorCodeLast(), false, "failed CLOSE at CELL %s", skycell->name);
     70                    psFree (view);
     71                    return false;
     72                }
    7273
    73         pmCell *target = pmFPAviewThisCell(view, output->fpa); ///< Target cell
    74         pmReadout *readout = pmReadoutAlloc(target); ///< Target readout
    75         readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    76         psImageInit(readout->image, NAN);
    77         psFree(readout);                // Drop reference
    78 
    79         bool status = false;
    80         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XBIN");
    81         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YBIN");
    82         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XSIZE");
    83         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YSIZE");
    84         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XPARITY");
    85         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YPARITY");
    86         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.X0");
    87         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.Y0");
    88 
    89        
     74                // we've got the output astrom header
     75                pmHDU *hdu = pmHDUFromCell(cell); ///< HDU for source
     76                if (!hdu || !hdu->header) {
     77                    psError(PM_ERR_PROG, false, "Unable to find header for sky cell.");
     78                    psFree(view);
     79                    return false;
     80                }
     81                int numCols = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); ///< Number of columns
     82                int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); ///< Number of rows
     83                if ((numCols == 0) || (numRows == 0)) {
     84                    psError(PSWARP_ERR_DATA, false, "skycell has invalid dimensions %d x %d", numCols, numRows);
     85                    psFree(view);
     86                    return false;
     87                }
     88               
     89                // XXX generate the output pixels
     90                pmCell *target = pmFPAviewThisCell(view, output->fpa); ///< Target cell
     91                pmReadout *readout = pmReadoutAlloc(target); ///< Target readout
     92                readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     93                psImageInit(readout->image, NAN);
     94                psFree(readout);                // Drop reference
     95               
     96                bool status = false;
     97                psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.XBIN");
     98                psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.YBIN");
     99                psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.XSIZE");
     100                psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.YSIZE");
     101                psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.XPARITY");
     102                psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.YPARITY");
     103                psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.X0");
     104                psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.Y0");
     105            }
     106            if (!pmFPAfileClose(skycell, view)) {
     107                psError(psErrorCodeLast(), false, "failed CLOSE at CHIP %s", skycell->name);
     108                psFree (view);
     109                return false;
     110            }
     111        }
     112        if (!pmFPAfileClose(skycell, view)) {
     113            psError(psErrorCodeLast(), false, "failed CLOSE at FPA %s", skycell->name);
     114            psFree (view);
     115            return false;
     116        }
     117        psFree(view);
    90118    }
    91119
    92     // XXX this is not a sufficient test
     120    // the section below converts the header astrometry info (in skycell) to the pmFPA
     121    // astrometry structures, saving them on the output fpa structure.
     122
     123    // XXX this block should be modified to loop over all chips
     124
     125    pmFPAview *view = pmFPAviewAlloc (0);
    93126    view->chip = 0;
    94127    view->cell = 0;
     
    134167}
    135168
    136 bool pswarpDefineBackground (pmConfig *config) {
    137 
    138     // load the PSWARP recipe
    139     psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);
    140     if (!recipe) {
    141         psError(PSWARP_ERR_CONFIG, true, "Can't find PSWARP recipe!\n");
    142         return false;
    143     }
    144 
    145     // select the input data sources
    146     pmFPAfile *skycell = psMetadataLookupPtr (NULL, config->files, "PSWARP.SKYCELL");
    147     if (!skycell) {
    148         psError(PSWARP_ERR_CONFIG, false, "Can't find skycell data!\n");
    149         return false;
    150     }
    151     pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PSWARP.OUTPUT.BKGMODEL");
    152     if (!output) {
    153         psError(PSWARP_ERR_CONFIG, false, "Can't find output data!\n");
    154         return false;
    155     }
    156     pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT");
    157     if (!input) {
    158         psError(PSWARP_ERR_CONFIG, false, "Can't find input data!\n");
    159         return false;
    160     }
    161    
    162     // open the full skycell file; no need to defer different depths. only load the header data
    163     pmFPAview *view = pmFPAviewAlloc (0);
    164     pmFPAfileOpen (skycell, view, config);
    165 
    166     // Read header and create target
    167     {
    168         if (!pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config)) {
    169             psError(psErrorCodeLast(), false, "Unable to read headers for skycell.");
    170             psFree(view);
    171             return false;
    172         }
    173         view->chip = 0;
    174         view->cell = 0;
    175         view->readout = 0;
    176         pmCell *source = pmFPAfileThisCell(config->files, view, "PSWARP.SKYCELL"); ///< Source cell
    177         pmHDU *hdu = pmHDUFromCell(source); ///< HDU for source
    178         if (!hdu || !hdu->header) {
    179             psError(PM_ERR_PROG, false, "Unable to find header for sky cell.");
    180             psFree(view);
    181             return false;
    182         }
    183         int numCols = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); ///< Number of columns
    184         int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); ///< Number of rows
    185         if ((numCols == 0) || (numRows == 0)) {
    186             psError(PSWARP_ERR_DATA, false, "skycell has invalid dimensions %d x %d", numCols, numRows);
    187             psFree(view);
    188             return false;
    189         }
    190 
    191         pmCell *target = pmFPAviewThisCell(view, output->fpa); ///< Target cell
    192         pmReadout *readout = pmReadoutAlloc(target); ///< Target readout
    193         readout->image = psImageAlloc(numCols / output->xBin, numRows / output->yBin, PS_TYPE_F32);
    194         psImageInit(readout->image, NAN);
    195         psFree(readout);                // Drop reference
    196 
    197         bool status = false;
    198         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XBIN");
    199         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YBIN");
    200 /*      psMetadataAddS32(target->concepts,PS_LIST_TAIL,"CELL.XBIN",PS_META_REPLACE,"",output->xBin); */
    201 /*      psMetadataAddS32(target->concepts,PS_LIST_TAIL,"CELL.YBIN",PS_META_REPLACE,"",output->yBin); */
    202         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XSIZE");
    203         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YSIZE");
    204 /*      psMetadataAddS32(target->concepts,PS_LIST_TAIL,"CELL.XSIZE",PS_META_REPLACE,"",numCols / output->xBin); */
    205 /*      psMetadataAddS32(target->concepts,PS_LIST_TAIL,"CELL.YSIZE",PS_META_REPLACE,"",numRows / output->yBin); */
    206         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XPARITY");
    207         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YPARITY");
    208         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.X0");
    209         psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.Y0");
    210 
    211        
    212     }
    213 
    214     // XXX this is not a sufficient test
    215     view->chip = 0;
    216     view->cell = 0;
    217     view->readout = -1;
    218     pmHDU *phu = pmFPAviewThisPHU(view, skycell->fpa); ///< Skycell PHU
    219     pmHDU *hdu = pmFPAviewThisHDU(view, skycell->fpa); ///< Skycell header
    220 
    221     pmAstromWCS *WCS = pmAstromWCSfromHeader(hdu->header);
    222 
    223     double cd1f = 1.0 * output->xBin;
    224     double cd2f = 1.0 * output->yBin;
    225    
    226     WCS->crpix1 = WCS->crpix1 / cd1f;
    227     WCS->crpix2 = WCS->crpix2 / cd2f;
    228    
    229     WCS->cdelt1 *= cd1f;
    230     WCS->cdelt2 *= cd2f;
    231 
    232     WCS->trans->x->coeff[1][0] *= cd1f;
    233     WCS->trans->x->coeff[0][1] *= cd2f;
    234     WCS->trans->y->coeff[1][0] *= cd1f;
    235     WCS->trans->y->coeff[0][1] *= cd2f;
    236    
    237    
    238     pmAstromWCStoHeader (hdu->header,WCS);
    239 
    240     bool bilevelAstrometry = false;
    241     if (phu) {
    242         char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1");
    243         if (ctype) {
    244             bilevelAstrometry = !strcmp(&ctype[4], "-DIS");
    245         }
    246     }
    247 
    248     // We read from the skycell into the output.  i.e., the output receives the desired astrometry.
    249     pmChip *outputChip = pmFPAviewThisChip(view, output->fpa); ///< Chip in the output
    250     if (bilevelAstrometry) {
    251         if (!pmAstromReadBilevelMosaic(output->fpa, phu->header)) {
    252             psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for skycell.");
    253             psFree(view);
    254             return false;
    255         }
    256         if (!pmAstromReadBilevelChip(outputChip, hdu->header)) {
    257             psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for skycell.");
    258             psFree(view);
    259             return false;
    260         }
    261     } else {
    262         // we use a default FPA pixel scale of 1.0
    263       if (!pmAstromReadWCS(output->fpa, outputChip, hdu->header, 1.0)) {
    264             psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for skycell.");
    265             psFree(view);
    266             return false;
    267         }
    268     }
    269 
    270    
    271     view->chip = view->cell = view->readout = -1;
    272     pmFPAAddSourceFromView(output->fpa, view, output->format);
    273 
    274 
    275     psFree (view);
    276     return true;
    277 }
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarpDefineSkycell.c

    r27096 r35421  
    7373    psFitsClose(fits);
    7474
    75     // We need to force the format for the skycell to be equivalent to SIMPLE.  Determine
    76     // the current format from the header; Determine camera if not specified already
    77     // XXX EAM : this operation should be defined as a pmConfig function (pmConfigCopy?)
    78     skyConfig = pmConfigAlloc();
    79     skyConfig->user = psMemIncrRefCounter(config->user);
    80     skyConfig->system = psMemIncrRefCounter(config->system);
     75    { // this bit is unique to pswarpDefineSkycell:
    8176
    82     psFree (skyConfig->files);
    83     skyConfig->files = psMemIncrRefCounter(config->files);
    84     psFree (skyConfig->arguments);
    85     skyConfig->arguments = psMemIncrRefCounter(config->arguments);
     77      // We need to force the format for the skycell to be equivalent to SIMPLE.  Determine
     78      // the current format from the header; Determine camera if not specified already
     79      // XXX EAM : this operation should be defined as a pmConfig function (pmConfigCopy?)
     80      skyConfig = pmConfigAlloc();
     81      skyConfig->user = psMemIncrRefCounter(config->user);
     82      skyConfig->system = psMemIncrRefCounter(config->system);
     83
     84      psFree (skyConfig->files);
     85      skyConfig->files = psMemIncrRefCounter(config->files);
     86      psFree (skyConfig->arguments);
     87      skyConfig->arguments = psMemIncrRefCounter(config->arguments);
     88    }
    8689
    8790    format = pmConfigCameraFormatFromHeader (NULL, NULL, NULL, skyConfig, phu, false);
     
    9497
    9598    // Record the camera name of the skycell, so we can save its configuration
    96     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL.CAMERA", 0, "Name of camera for skycell",
    97                     skyConfig->cameraName);
     99    // XXX this can be put outside of the f
     100    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL.CAMERA", 0, "Name of camera for skycell", skyConfig->cameraName);
    98101
    99102    // build the template fpa, set up the basic view
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoop.c

    r34800 r35421  
    11/** @file pswarpLoop.c
    22 *
    3  *  @brief
    4  *
     3 *  @brief mail processing loop for pswarp
    54 *  @ingroup pswarp
    65 *
     
    1716#define WCS_NONLIN_TOL 0.001            // Non-linear tolerance for header WCS
    1817#define TESTING 0                       // Testing output?
    19 
    20 
    2118
    2219// Loop over the inputs, warp them to the output skycell and then write out the output.
     
    8077    // Turn all skycell files on to generate them, and then turn them off for the loop over the input images
    8178    // the input, which is in a different format.
    82     {
    83         pswarpFileActivation(config, detectorFiles, false);
    84         pswarpFileActivation(config, photFiles, false);
    85         pswarpFileActivation(config, independentFiles, false);
    86         pswarpFileActivation(config, skycellFiles, true);
    87         if (!pswarpIOChecksBefore(config)) {
    88             psError(psErrorCodeLast(), false, "Unable to read files.");
    89             goto DONE;
    90         }
    91         pswarpFileActivation(config, skycellFiles, false);
    92     }
     79    // XXX why is this being done here, doesn't it duplicate the work in pswarpDefine.c??
     80    pswarpFileActivation(config, detectorFiles, false);
     81    pswarpFileActivation(config, photFiles, false);
     82    pswarpFileActivation(config, independentFiles, false);
     83    pswarpFileActivation(config, skycellFiles, false);
     84   
     85    // pswarpFileActivation(config, skycellFiles, true);
     86    // if (0) {
     87    //   if (!pswarpIOChecksBefore(config)) {
     88    //     psError(psErrorCodeLast(), false, "Unable to read files.");
     89    //     goto DONE;
     90    //   }
     91    // }
     92   
    9393
    9494    // Read the input astrometry
     
    155155            psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for input FPA.");
    156156            psFree(view);
    157             psFree(stats);
    158157            goto DONE;
    159158        }
     
    168167    }
    169168
     169    // *** main transformation block
    170170    pmChip *chip;
    171171    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
     
    185185                psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for input FPA.");
    186186                psFree(view);
    187                 psFree(stats);
    188187                goto DONE;
    189188            }
     
    193192                psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for input FPA.");
    194193                psFree(view);
    195                 psFree(stats);
    196194                goto DONE;
    197195            }
     
    301299    if (!pmConceptsAverageCells(outCell, cells, NULL, NULL, false)) {
    302300        psError(psErrorCodeLast(), false, "Unable to average cell concepts.");
    303         psFree(stats);
    304301        psFree(cells);
    305302        psFree(view);
     
    313310    if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) {
    314311        psError(psErrorCodeLast(), false, "Unable to copy FPA concepts from input to output.");
    315         psFree(stats);
    316312        psFree(view);
    317313        goto DONE;
     
    345341    if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) {
    346342        psError(psErrorCodeLast(), false, "Unable to generate WCS header.");
    347         psFree(stats);
    348343        goto DONE;
    349344    }
     
    452447    return true;
    453448}
    454 
    455 // Loop over the inputs, warp them to the output skycell and then write out the output.
    456 bool pswarpLoopBackground(pmConfig *config, psMetadata *stats)
    457 {
    458     bool status;
    459     bool mdok;                          // Status of MD lookup
    460     const char *skyCamera = psMetadataLookupStr(NULL, config->arguments,
    461                                                 "SKYCELL.CAMERA");  // Name of camera for skycell
    462     pmConfigCamerasCull(config, skyCamera);
    463     pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,PSASTRO,MASKS,JPEG");
    464 
    465     // load the recipe
    466     psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE);
    467     if (!recipe) {
    468         psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
    469         return false;
    470     }
    471 
    472     if (!pswarpSetMaskBits(config)) {
    473         psError(psErrorCodeLast(), false, "failed to set mask bits");
    474         return NULL;
    475     }
    476 
    477     // select the input data sources
    478     pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.BKGMODEL");
    479     if (!input) {
    480         psError(PSWARP_ERR_CONFIG, true, "Can't find input data!\n");
    481         return false;
    482     }
    483 
    484     // use the external astrometry source if supplied
    485     pmFPAfile *astrom = psMetadataLookupPtr(NULL, config->files, "PSWARP.ASTROM");
    486     if (!astrom) {
    487         astrom = input;
    488     }
    489 
    490     if (astrom->camera != input->camera) {
    491         psError(PSWARP_ERR_DATA, true, "Input camera and astrometry camera do not match.");
    492         return false;
    493     }
    494 
    495     // select the output readout
    496     pmFPAview *view = pmFPAviewAlloc(0);
    497     view->chip = 0;
    498     view->cell = 0;
    499     view->readout = 0;
    500     pmReadout *output = pmFPAfileThisReadout(config->files, view, "PSWARP.OUTPUT.BKGMODEL");
    501     if (!output) {
    502         psError(PSWARP_ERR_CONFIG, true, "Can't find output background data!\n");
    503         return false;
    504     }
    505     psFree (view);
    506     // Turn all skycell files on to generate them, and then turn them off for the loop over the input images
    507     // the input, which is in a different format.
    508     {
    509         pswarpFileActivation(config, detectorFiles, false);
    510         pswarpFileActivation(config, photFiles, false);
    511         pswarpFileActivation(config, independentFiles, false);
    512         pswarpFileActivation(config, skycellFiles, true);
    513         if (!pswarpIOChecksBefore(config)) {
    514             psError(psErrorCodeLast(), false, "Unable to read files.");
    515             goto DONE;
    516         }
    517         pswarpFileActivation(config, skycellFiles, false);
    518     }
    519     // Read the input astrometry
    520     // XXX rather than use the activations here, this should just explicitly loop over the desired filerule
    521     {
    522 
    523       pmFPAfileActivate(config->files, true, "PSWARP.ASTROM");
    524 
    525         pmChip *chip;
    526         pmFPAview *view = pmFPAviewAlloc(0);
    527         if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    528             psError(psErrorCodeLast(), false, "Unable to read files.");
    529             goto DONE;
    530         }
    531 
    532         while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    533 #if 0
    534           // This needs to be removed because otherwise it throws an error of duplicate PSPHOT.DETECTIONS.
    535             if (!chip->process || !chip->file_exists) { continue; }
    536             if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    537                 psError(psErrorCodeLast(), false, "Unable to read files.");
    538                 goto DONE;
    539             }
    540 #endif
    541             pmCell *cell;
    542             while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    543               psTrace ("pswarp", 4, "ACell %d: %x %x %d\n", view->cell, cell->file_exists, cell->process,psErrorCodeLast());
    544                 if (!cell->process || !cell->file_exists) { continue; }
    545                 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE) ||
    546                     !pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
    547                     psError(psErrorCodeLast(), false, "Unable to read files.");
    548                     goto DONE;
    549                 }
    550             }
    551             if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
    552                 psError(psErrorCodeLast(), false, "Unable to write files.");
    553                 goto DONE;
    554             }
    555         }
    556         if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
    557             psError(psErrorCodeLast(), false, "Unable to write files.");
    558             goto DONE;
    559         }
    560         psFree(view);
    561         pswarpFileActivation(config, detectorFiles, true);
    562         pmFPAfileActivate(config->files, false, "PSWARP.ASTROM");
    563     }
    564 
    565     // Don't care about the skycell anymore --- we've read it, and that's all we need to do.
    566     pmFPAfileActivate(config->files, false, "PSWARP.SKYCELL");
    567     view = pmFPAviewAlloc(0);
    568 
    569     // find the FPA phu
    570     bool bilevelAstrometry = false;
    571     pmHDU *phu = pmFPAviewThisPHU(view, astrom->fpa);
    572 
    573     //    pmAstromWCS *WCSF = pmAstromWCSfromHeader(phu->header);
    574    
    575     if (phu) {
    576         char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1");
    577         if (ctype) {
    578             bilevelAstrometry = !strcmp (&ctype[4], "-DIS");
    579         }
    580     }
    581     if (bilevelAstrometry) {
    582         if (!pmAstromReadBilevelMosaic(input->fpa, phu->header)) {
    583             psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for input FPA.");
    584             psFree(view);
    585             psFree(stats);
    586             goto DONE;
    587         }
    588     }
    589 
    590     psList *cells = psListAlloc(NULL);  // List of cells, for concepts averaging
    591 
    592     // files associated with the science image
    593     if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
    594         psError(psErrorCodeLast(), false, "Unable to read files.");
    595         goto DONE;
    596     }
    597     pmChip *chip;
    598     while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    599         psTrace ("pswarp", 4, "DChip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    600         if (!chip->process || !chip->file_exists) { continue; }
    601         if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
    602             psError(psErrorCodeLast(), false, "Unable to read files.");
    603             goto DONE;
    604         }
    605 
    606         // Pull information from the header of the background files so we can use it to set values.
    607         pmHDU *hdu = pmFPAviewThisHDU(view,input->fpa);
    608         psMetadata *header = hdu->header;
    609        
    610         int IMAXIS1 = psMetadataLookupS32(NULL,header,"IMNAXIS1");
    611         int IMAXIS2 = psMetadataLookupS32(NULL,header,"IMNAXIS2");
    612         int NAXIS1 = psMetadataLookupS32(NULL,header,"NAXIS1");
    613         int NAXIS2 = psMetadataLookupS32(NULL,header,"NAXIS2");
    614         char *CCDSUM = psMetadataLookupStr(NULL,header,"CCDSUM");
    615         int CCDSUM1 = atoi(strtok(CCDSUM," "));
    616         int CCDSUM2 = atoi(strtok(NULL," "));
    617        
    618         psMetadataAddF32(config->arguments,PS_LIST_TAIL,"BKG_WARP_XOFFSET", PS_META_REPLACE,
    619                          "xoffset for background model data", (NAXIS1 * CCDSUM1 - IMAXIS1) / (2.0 * CCDSUM1));
    620         psMetadataAddF32(config->arguments,PS_LIST_TAIL,"BKG_WARP_YOFFSET", PS_META_REPLACE,
    621                          "yoffset for background model data", (NAXIS2 * CCDSUM2 - IMAXIS2) / (2.0 * CCDSUM2));
    622         psTrace("pswarp",5,"%d %d %d %d %d %d %g %g %d %d",
    623                 psMetadataLookupS32(NULL,header,"IMNAXIS1"),
    624                 psMetadataLookupS32(NULL,header,"IMNAXIS2"),
    625                 psMetadataLookupS32(NULL,header,"NAXIS1"),
    626                 psMetadataLookupS32(NULL,header,"NAXIS2"),
    627                 CCDSUM1,CCDSUM2,
    628                 psMetadataLookupF32(NULL,config->arguments,"BKG_WARP_XOFFSET"),
    629                 psMetadataLookupF32(NULL,config->arguments,"BKG_WARP_YOFFSET"),
    630                 psMetadataLookupS32(NULL,config->arguments,"BKG.XGRID"),
    631                 psMetadataLookupS32(NULL,config->arguments,"BKG.YGRID"));
    632        
    633        
    634         // read WCS data from the corresponding header
    635         hdu = pmFPAviewThisHDU (view, astrom->fpa);
    636 
    637         pmAstromWCS *WCS = pmAstromWCSfromHeader(hdu->header);
    638 
    639         double cd1f = (1.0 * CCDSUM1);// * (1.0 * psMetadataLookupS32(NULL,config->arguments,"BKG.XGRID"));
    640         double cd2f = (1.0 * CCDSUM2);// * (1.0 * psMetadataLookupS32(NULL,config->arguments,"BKG.YGRID"));
    641 
    642         WCS->cdelt1 *= cd1f;
    643         WCS->cdelt2 *= cd2f;
    644         WCS->crpix1 = WCS->crpix1 / cd1f;
    645         WCS->crpix2 = WCS->crpix2 / cd2f;
    646 
    647         // WCS->trans->x->nX/nY
    648         for (int q = 0; q <= WCS->trans->x->nX; q++) {
    649           for (int r = 0; r <= WCS->trans->x->nY; r++) {
    650             WCS->trans->x->coeff[q][r] *= pow(cd1f,q) * pow(cd2f,r);
    651           }
    652         }
    653         for (int q = 0; q <= WCS->trans->y->nX; q++) {
    654           for (int r = 0; r <= WCS->trans->y->nY; r++) {
    655             WCS->trans->y->coeff[q][r] *= pow(cd1f,q) * pow(cd2f,r);
    656           }
    657         }
    658         pmAstromWCStoHeader (hdu->header,WCS);
    659        
    660         if (bilevelAstrometry) {
    661             if (!pmAstromReadBilevelChip (chip, hdu->header)) {
    662                 psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for input FPA.");
    663                 psFree(view);
    664                 psFree(stats);
    665                 goto DONE;
    666             }
    667         } else {
    668             // we use a default FPA pixel scale of 1.0
    669             if (!pmAstromReadWCS (astrom->fpa, chip, hdu->header, 1.0)) {
    670                 psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for input FPA.");
    671                 psFree(view);
    672                 psFree(stats);
    673                 goto DONE;
    674             }
    675         }
    676         // Modify structure here.
    677 
    678        
    679         pmCell *cell;
    680         while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    681             psTrace ("pswarp", 4, "DCell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    682             if (!cell->process || !cell->file_exists) { continue; }
    683             if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
    684                 psError(psErrorCodeLast(), false, "Unable to read files.");
    685                 goto DONE;
    686             }
    687 
    688             psListAdd(cells, PS_LIST_TAIL, cell);
    689 
    690             // process each of the readouts
    691             pmReadout *readout;
    692             while ((readout = pmFPAviewNextReadout(view, input->fpa, 1)) != NULL) {
    693                 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    694                     psError(psErrorCodeLast(), false, "Unable to read files.");
    695                     goto DONE;
    696                 }
    697                 if (!readout->data_exists) {
    698                     continue;
    699                 }
    700 
    701                 for (int x = 0; x < readout->image->numCols; x++) {
    702                   for (int y = 0; y < readout->image->numRows; y++) {
    703                     readout->image->data.F32[y][x] = readout->image->data.F32[y][x] * (cd1f * cd2f) /
    704                       (psMetadataLookupS32(&mdok,config->arguments,"BKG.XGRID") *
    705                        psMetadataLookupS32(&mdok,config->arguments,"BKG.YGRID"));
    706                   }
    707                 }
    708                
    709                 psMetadataAddS32(config->arguments,PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, "", 8);
    710 
    711                 psMetadataAddBool(config->arguments,PS_LIST_TAIL, "BACKGROUND_WARPING", PS_META_REPLACE, "", true);
    712                 pswarpTransformReadout(output, readout, config);
    713                 psMetadataAddBool(config->arguments,PS_LIST_TAIL, "BACKGROUND_WARPING", PS_META_REPLACE, "", false);
    714 
    715                 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    716                     psError(psErrorCodeLast(), false, "Unable to write files.");
    717                     goto DONE;
    718                 }
    719             }
    720             if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    721                 psError(psErrorCodeLast(), false, "Unable to write files.");
    722                 goto DONE;
    723             }
    724         }
    725         if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    726             psError(psErrorCodeLast(), false, "Unable to write files.");
    727             goto DONE;
    728         }
    729     }
    730     if (!output->data_exists) {
    731         psWarning("No overlap between input and skycell.");
    732         psphotFilesActivate(config, false);
    733         psFree(cells);
    734         psFree(view);
    735         goto DONE;
    736     }
    737     pmCell *outCell = output->parent;   ///< Output cell
    738     pmChip *outChip = outCell->parent;  ///< Output chip
    739     pmFPA *outFPA = outChip->parent;    ///< Output FP
    740 
    741 /*     if (!pswarpPixelsLit(output, stats, config)) { */
    742 /*         psError(psErrorCodeLast(), false, "Unable to calculate pixel regions."); */
    743 /*         psFree(cells); */
    744 /*         psFree(view); */
    745 /*         goto DONE; */
    746 /*     } */
    747     psRegion *trimsec = psMetadataLookupPtr(NULL, outCell->concepts, "CELL.TRIMSEC"); ///< Trim section
    748     trimsec->x0 = trimsec->x1 = trimsec->y0 = trimsec->y1 = 0; ///< All pixels
    749 
    750     if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) {
    751         psError(psErrorCodeLast(), false, "Unable to copy FPA concepts from input to output.");
    752         psFree(stats);
    753         psFree(view);
    754         goto DONE;
    755     }
    756 
    757     pmHDU *hdu = outFPA->hdu;           ///< HDU for the output warped image
    758 
    759     // Copy header from target
    760     {
    761         pmFPAview *skyView = pmFPAviewAlloc(0); ///< View into skycell
    762         skyView->chip = skyView->cell = 0;
    763         pmCell *cell = pmFPAfileThisCell(config->files, skyView, "PSWARP.SKYCELL"); // Skycell cell
    764         psFree(skyView);
    765         pmHDU *skyHDU = pmHDUFromCell(cell); ///< HDU
    766         if (!skyHDU) {
    767             psError(PSWARP_ERR_DATA, false, "Unable to find skycell HDU.");
    768             psFree(view);
    769             goto DONE;
    770         }
    771         hdu->header = psMetadataCopy(hdu->header, skyHDU->header);
    772     }
    773     pswarpVersionHeader(hdu->header);
    774    
    775     if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) {
    776         psError(psErrorCodeLast(), false, "Unable to generate WCS header.");
    777         psFree(stats);
    778         goto DONE;
    779     }
    780     if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    781         psError(psErrorCodeLast(), false, "Unable to write files.");
    782         goto DONE;
    783     }
    784     // Done with the detector side of things
    785     pswarpFileActivation(config, detectorFiles, false);
    786     pswarpFileActivation(config, independentFiles, false);
    787 
    788 
    789     // Add MD5 information for readout
    790     const char *chipName = psMetadataLookupStr(NULL, output->parent->parent->concepts, "CHIP.NAME");
    791     const char *cellName = psMetadataLookupStr(NULL, output->parent->concepts, "CELL.NAME");
    792     psString headerName = NULL; ///< Header name for MD5
    793     psStringAppend(&headerName, "MD5_%s_%s_%d", chipName, cellName, view->readout);
    794     psVector *md5 = psImageMD5(output->image); ///< md5 hash
    795     psString md5string = psMD5toString(md5); ///< String
    796     psFree(md5);
    797     psMetadataAddStr(hdu->header, PS_LIST_TAIL, headerName, PS_META_REPLACE,
    798                      "Image MD5", md5string);
    799     psFree(md5string);
    800     psFree(headerName);
    801     psFree(view);
    802  DONE:
    803 
    804     return true;
    805 }
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarpParseCamera.c

    r34800 r35421  
    5555}
    5656
    57 
    58 
    59 
    6057bool pswarpParseCamera(pmConfig *config)
    6158{
     
    7067    }
    7168
    72     pmFPAfile *astrom = defineInputFile(config, NULL, "PSWARP.ASTROM", "ASTROM", PM_FPA_FILE_CMF);
     69    // XXX I should allow the astrometry input to be either WCS or CMF
     70    // Define the input astrometry file(s)
     71    bool status = false;
     72    pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM");
     73    if (!astrom) {
     74        // look for the file on the RUN metadata
     75        astrom = pmFPAfileDefineFromRun(&status, NULL, config, "PSWARP.ASTROM"); // File to return
     76        if (!status) {
     77            psLogMsg("pswarp", PS_LOG_INFO, "Failed to load file definition for %s", "PSWARP.ASTROM");
     78        }
     79    }
     80    if ((astrom->type != PM_FPA_FILE_CMF) && (astrom->type != PM_FPA_FILE_WCS)) {
     81        psLogMsg("pswarp", PS_LOG_INFO, "%s is neither CMF nor WCS", "PSWARP.ASTROM");
     82    }
    7383    psLogMsg("pswarp", PS_LOG_INFO, "Astrometry source: %s", astrom ? "supplied" : "header");
    7484
     85    // Define the input mask file(s)
    7586    pmFPAfile *inMask = defineInputFile(config, input, "PSWARP.MASK", "MASK", PM_FPA_FILE_MASK);
    7687    if (!inMask) {
     
    7889    }
    7990
     91    // Define the input variance file(s)
    8092    pmFPAfile *inVariance = defineInputFile(config, input, "PSWARP.VARIANCE", "VARIANCE",
    8193                                            PM_FPA_FILE_VARIANCE);
     
    91103   
    92104    // The input skycell is a required argument: it defines the output image
    93     // XXX we may need a different skycell structure here
     105    pmConfig *skyConfig = NULL;
    94106    pmFPAfile *skycell = NULL;
    95     pmConfig *skyConfig = NULL;
    96     bool status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
    97     if (!status) {
    98         psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.SKYCELL");
    99         return false;
    100     }
     107
     108# define USE_PSWARP_DEFINE_SKYCELL 0
     109# if (USE_PSWARP_DEFINE_SKYCELL)
     110    // XXX this function is no longer needed; drop
     111    status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
     112# else
     113    skycell = pmFPAfileDefineNewConfig(&status, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
     114# endif
     115
     116    if (!status || !skycell) {
     117      psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.SKYCELL");
     118      return false;
     119      }
     120    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL.CAMERA", 0, "Name of camera for skycell", skyConfig->cameraName);
    101121    psFree(skyConfig);
    102122
     
    142162    if (inBackground && psMetadataLookupBool(&mdok, recipe, "BACKGROUND.MODEL")) {
    143163      pmFPAfile *outBackground = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT.BKGMODEL");
    144 /*       pmFPAfile *outBackground = pmFPAfileDefineFromFPA(config,output->fpa, */
    145 /*                                                      psMetadataLookupS32(&mdok,recipe,"BKG.XGRID"), */
    146 /*                                                      psMetadataLookupS32(&mdok,recipe,"BKG.YGRID"), */
    147 /*                                                      "PSWARP.OUTPUT.BKGMODEL"); */
    148164      outBackground->xBin = psMetadataLookupS32(&mdok, recipe, "BKG.XGRID");
    149165      outBackground->yBin = psMetadataLookupS32(&mdok, recipe, "BKG.YGRID");
Note: See TracChangeset for help on using the changeset viewer.