IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33243


Ignore:
Timestamp:
Feb 10, 2012, 6:07:30 PM (14 years ago)
Author:
watersc1
Message:

Implementation of PATTERN.CONTINUITY correction, which replaces the PATTERN.CELL correction and ensures that the cell-to-cell variations are minimized, and that background fitting code has a smooth background to work with. Includes ippconfig files to enable this by default across all of GPC1. Tested, and memory leaks fixed.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/gpc1/format_20090220.config

    r32411 r33243  
    590590        XY76    STR     1111111111111111111111111111111111111111111111111111111111111111
    591591END
     592PATTERN.CELL    BOOL    FALSE
     593PATTERN.CONTINUITY BOOL TRUE
    592594PATTERN.CELL.SUBSET      METADATA        # List of chips and whether to do cell pattern correction 
    593595        XY01    BOOL    FALSE
  • trunk/ippconfig/gpc1/format_20091209.config

    r32863 r33243  
    717717END
    718718
    719 # PATTERN.CELL  BOOL    TRUE            # by default, do not do any cell pattern correction
    720 PATTERN.CELL.SUBSET     METADATA        # List of chips and whether to do cell pattern correction
    721         XY01    BOOL    FALSE
    722         XY02    BOOL    FALSE
    723         XY03    BOOL    FALSE
    724         XY04    BOOL    FALSE
    725         XY05    BOOL    FALSE
    726 #       XY06    STR     0101000000010000000110000100000000000000000000000000000000000000
    727         XY06    BOOL    FALSE
    728         XY10    BOOL    FALSE
    729         XY11    BOOL    FALSE
    730         XY12    BOOL    FALSE
    731         XY13    BOOL    FALSE
    732         XY14    STR     0000000000000000111111110000000000000000000000000000000000000000
    733         XY15    STR     1111111110000000100000000000000000000000000000000000000000000000
    734 #       XY16    STR     0000000100000000000000000000000000000001000000000000000000000000
    735         XY16    BOOL    FALSE
    736         XY17    BOOL    FALSE
    737         XY20    BOOL    FALSE
    738         XY21    BOOL    FALSE
    739         XY22    BOOL    FALSE
    740         XY23    BOOL    FALSE
    741 #       XY24    STR     0000000000100000000000000110100000100000001000000011100000000000
    742         XY24    BOOL    FALSE
    743 #       XY25    STR     0100010000001001001011000000001000000111000110000000100000000010
    744         XY25    BOOL    FALSE
    745 #       XY26    STR     0000000000000100000000000000000000001000001000000000000000000000
    746         XY26    BOOL    FALSE
    747         XY27    BOOL    FALSE
    748         XY30    BOOL    FALSE
    749         XY31    BOOL    FALSE
    750         XY32    BOOL    FALSE
    751         XY33    BOOL    FALSE
    752 #       XY34    STR     0000000000000000000000000000000000000001000011000000101000111111
    753         XY34    BOOL    FALSE
    754         XY35    BOOL    FALSE
    755 #       XY36    STR     0001000000000000000000000000000000010000000000000000000000000000
    756         XY36    BOOL    FALSE
    757 #       XY37    STR     0000000000000000000000000000000100010001000000001011000010110110 ?
    758         XY37    BOOL    FALSE
    759 #       XY40    STR     0000000000000000000000000010110000000000000001110000001000011111
    760         XY40    BOOL    FALSE
    761         XY41    BOOL    FALSE
    762 #       XY42    BOOL    FALSE
    763         XY42    STR     0000000000000000000100000001000000000000000000000000000000000000
    764 #       XY43    STR     0000000000000000000000010000000100000000000010000100000100000100
    765         XY43    STR     0000000000000000000000000000000000000000000010000000000000000000
    766         XY44    BOOL    FALSE
    767         XY45    BOOL    FALSE
    768         XY46    BOOL    FALSE
    769         XY47    BOOL    FALSE
    770         XY50    BOOL    FALSE
    771         XY51    BOOL    FALSE
    772         XY52    BOOL    FALSE
    773         XY53    BOOL    FALSE
    774         XY54    BOOL    FALSE
    775         XY55    BOOL    FALSE
    776         XY56    BOOL    FALSE
    777         XY57    BOOL    FALSE
    778         XY60    BOOL    FALSE
    779         XY61    BOOL    FALSE
    780 #       XY62    STR     0000000000000000000000000000000000000000000000000000000000000010
    781         XY62    BOOL    FALSE
    782         XY63    BOOL    FALSE
    783         XY64    BOOL    FALSE
    784         XY65    BOOL    FALSE
    785         XY66    BOOL    FALSE
    786         XY67    BOOL    FALSE
    787         XY71    BOOL    FALSE
    788 #       XY72    STR     0000000000000000000000000000000000000000000000000000000000000001
    789         XY72    BOOL    FALSE
    790 #       XY73    STR     0001100000000000000000000000001000000000000000000000000000000000
    791         XY73    BOOL    FALSE
    792         XY74    BOOL    FALSE
    793         XY75    BOOL    FALSE
    794         XY76    BOOL    FALSE
    795 END
     719PATTERN.CELL    BOOL   FALSE
     720PATTERN.CONTINUITY BOOL TRUE
     721
     722# # PATTERN.CELL        BOOL    TRUE            # by default, do not do any cell pattern correction
     723# PATTERN.CELL.SUBSET   METADATA        # List of chips and whether to do cell pattern correction
     724#       XY01    BOOL    FALSE
     725#       XY02    BOOL    FALSE
     726#       XY03    BOOL    FALSE
     727#       XY04    BOOL    FALSE
     728#       XY05    BOOL    FALSE
     729# #     XY06    STR     0101000000010000000110000100000000000000000000000000000000000000
     730#       XY06    BOOL    FALSE
     731#       XY10    BOOL    FALSE
     732#       XY11    BOOL    FALSE
     733#       XY12    BOOL    FALSE
     734#       XY13    BOOL    FALSE
     735#       XY14    STR     0000000000000000111111110000000000000000000000000000000000000000
     736#       XY15    STR     1111111110000000100000000000000000000000000000000000000000000000
     737# #     XY16    STR     0000000100000000000000000000000000000001000000000000000000000000
     738#       XY16    BOOL    FALSE
     739#       XY17    BOOL    FALSE
     740#       XY20    BOOL    FALSE
     741#       XY21    BOOL    FALSE
     742#       XY22    BOOL    FALSE
     743#       XY23    BOOL    FALSE
     744# #     XY24    STR     0000000000100000000000000110100000100000001000000011100000000000
     745#       XY24    BOOL    FALSE
     746# #     XY25    STR     0100010000001001001011000000001000000111000110000000100000000010
     747#       XY25    BOOL    FALSE
     748# #     XY26    STR     0000000000000100000000000000000000001000001000000000000000000000
     749#       XY26    BOOL    FALSE
     750#       XY27    BOOL    FALSE
     751#       XY30    BOOL    FALSE
     752#       XY31    BOOL    FALSE
     753#       XY32    BOOL    FALSE
     754#       XY33    BOOL    FALSE
     755# #     XY34    STR     0000000000000000000000000000000000000001000011000000101000111111
     756#       XY34    BOOL    FALSE
     757#       XY35    BOOL    FALSE
     758# #     XY36    STR     0001000000000000000000000000000000010000000000000000000000000000
     759#       XY36    BOOL    FALSE
     760# #     XY37    STR     0000000000000000000000000000000100010001000000001011000010110110 ?
     761#       XY37    BOOL    FALSE
     762# #     XY40    STR     0000000000000000000000000010110000000000000001110000001000011111
     763#       XY40    BOOL    FALSE
     764#       XY41    BOOL    FALSE
     765# #     XY42    BOOL    FALSE
     766#       XY42    STR     0000000000000000000100000001000000000000000000000000000000000000
     767# #     XY43    STR     0000000000000000000000010000000100000000000010000100000100000100
     768#       XY43    STR     0000000000000000000000000000000000000000000010000000000000000000
     769#       XY44    BOOL    FALSE
     770#       XY45    BOOL    FALSE
     771#       XY46    BOOL    FALSE
     772#       XY47    BOOL    FALSE
     773#       XY50    BOOL    FALSE
     774#       XY51    BOOL    FALSE
     775#       XY52    BOOL    FALSE
     776#       XY53    BOOL    FALSE
     777#       XY54    BOOL    FALSE
     778#       XY55    BOOL    FALSE
     779#       XY56    BOOL    FALSE
     780#       XY57    BOOL    FALSE
     781#       XY60    BOOL    FALSE
     782#       XY61    BOOL    FALSE
     783# #     XY62    STR     0000000000000000000000000000000000000000000000000000000000000010
     784#       XY62    BOOL    FALSE
     785#       XY63    BOOL    FALSE
     786#       XY64    BOOL    FALSE
     787#       XY65    BOOL    FALSE
     788#       XY66    BOOL    FALSE
     789#       XY67    BOOL    FALSE
     790#       XY71    BOOL    FALSE
     791# #     XY72    STR     0000000000000000000000000000000000000000000000000000000000000001
     792#       XY72    BOOL    FALSE
     793# #     XY73    STR     0001100000000000000000000000001000000000000000000000000000000000
     794#       XY73    BOOL    FALSE
     795#       XY74    BOOL    FALSE
     796#       XY75    BOOL    FALSE
     797#       XY76    BOOL    FALSE
     798# END
  • trunk/ippconfig/gpc1/format_20100122.config

    r32863 r33243  
    720720END
    721721
    722 # PATTERN.CELL  BOOL    TRUE            # by default, do not do any cell pattern correction
    723 PATTERN.CELL.SUBSET     METADATA        # List of chips and whether to do cell pattern correction
    724         XY01    BOOL    FALSE
    725         XY02    BOOL    FALSE
    726         XY03    BOOL    FALSE
    727         XY04    BOOL    FALSE
    728         XY05    BOOL    FALSE
    729 #       XY06    STR     0101000000010000000110000100000000000000000000000000000000000000
    730         XY06    BOOL    FALSE
    731         XY10    BOOL    FALSE
    732         XY11    BOOL    FALSE
    733         XY12    BOOL    FALSE
    734         XY13    BOOL    FALSE
    735         XY14    STR     0000000000000000111111110000000000000000000000000000000000000000
    736         XY15    STR     1111111110000000100000000000000000000000000000000000000000000000
    737 #       XY16    STR     0000000100000000000000000000000000000001000000000000000000000000
    738         XY16    BOOL    FALSE
    739         XY17    BOOL    FALSE
    740         XY20    BOOL    FALSE
    741         XY21    BOOL    FALSE
    742         XY22    BOOL    FALSE
    743         XY23    BOOL    FALSE
    744 #       XY24    STR     0000000000100000000000000110100000100000001000000011100000000000
    745         XY24    BOOL    FALSE
    746 #       XY25    STR     0100010000001001001011000000001000000111000110000000100000000010
    747         XY25    BOOL    FALSE
    748 #       XY26    STR     0000000000000100000000000000000000001000001000000000000000000000
    749         XY26    BOOL    FALSE
    750         XY27    BOOL    FALSE
    751         XY30    BOOL    FALSE
    752         XY31    BOOL    FALSE
    753         XY32    BOOL    FALSE
    754         XY33    BOOL    FALSE
    755 #       XY34    STR     0000000000000000000000000000000000000001000011000000101000111111
    756         XY34    BOOL    FALSE
    757         XY35    BOOL    FALSE
    758 #       XY36    STR     0001000000000000000000000000000000010000000000000000000000000000
    759         XY36    BOOL    FALSE
    760 #       XY37    STR     0000000000000000000000000000000100010001000000001011000010110110 ?
    761         XY37    BOOL    FALSE
    762 #       XY40    STR     0000000000000000000000000010110000000000000001110000001000011111
    763         XY40    BOOL    FALSE
    764         XY41    BOOL    FALSE
    765 #       XY42    BOOL    FALSE
    766         XY42    STR     0000000000000000000100000001000000000000000000000000000000000000
    767 #       XY43    STR     0000000000000000000000010000000100000000000010000100000100000100
    768         XY43    STR     0000000000000000000000000000000000000000000010000000000000000000
    769         XY44    BOOL    FALSE
    770         XY45    BOOL    FALSE
    771         XY46    BOOL    FALSE
    772         XY47    BOOL    FALSE
    773         XY50    BOOL    FALSE
    774         XY51    BOOL    FALSE
    775         XY52    BOOL    FALSE
    776         XY53    BOOL    FALSE
    777         XY54    BOOL    FALSE
    778         XY55    BOOL    FALSE
    779         XY56    BOOL    FALSE
    780         XY57    BOOL    FALSE
    781         XY60    BOOL    FALSE
    782         XY61    BOOL    FALSE
    783 #       XY62    STR     0000000000000000000000000000000000000000000000000000000000000010
    784         XY62    BOOL    FALSE
    785         XY63    BOOL    FALSE
    786         XY64    BOOL    FALSE
    787         XY65    BOOL    FALSE
    788         XY66    BOOL    FALSE
    789         XY67    BOOL    FALSE
    790         XY71    BOOL    FALSE
    791 #       XY72    STR     0000000000000000000000000000000000000000000000000000000000000001
    792         XY72    BOOL    FALSE
    793 #       XY73    STR     0001100000000000000000000000001000000000000000000000000000000000
    794         XY73    BOOL    FALSE
    795         XY74    BOOL    FALSE
    796         XY75    BOOL    FALSE
    797         XY76    BOOL    FALSE
    798 END
     722PATTERN.CELL BOOL FALSE
     723PATTERN.CONTINUITY BOOL TRUE
     724
     725# # PATTERN.CELL        BOOL    TRUE            # by default, do not do any cell pattern correction
     726# PATTERN.CELL.SUBSET   METADATA        # List of chips and whether to do cell pattern correction
     727#       XY01    BOOL    FALSE
     728#       XY02    BOOL    FALSE
     729#       XY03    BOOL    FALSE
     730#       XY04    BOOL    FALSE
     731#       XY05    BOOL    FALSE
     732# #     XY06    STR     0101000000010000000110000100000000000000000000000000000000000000
     733#       XY06    BOOL    FALSE
     734#       XY10    BOOL    FALSE
     735#       XY11    BOOL    FALSE
     736#       XY12    BOOL    FALSE
     737#       XY13    BOOL    FALSE
     738#       XY14    STR     0000000000000000111111110000000000000000000000000000000000000000
     739#       XY15    STR     1111111110000000100000000000000000000000000000000000000000000000
     740# #     XY16    STR     0000000100000000000000000000000000000001000000000000000000000000
     741#       XY16    BOOL    FALSE
     742#       XY17    BOOL    FALSE
     743#       XY20    BOOL    FALSE
     744#       XY21    BOOL    FALSE
     745#       XY22    BOOL    FALSE
     746#       XY23    BOOL    FALSE
     747# #     XY24    STR     0000000000100000000000000110100000100000001000000011100000000000
     748#       XY24    BOOL    FALSE
     749# #     XY25    STR     0100010000001001001011000000001000000111000110000000100000000010
     750#       XY25    BOOL    FALSE
     751# #     XY26    STR     0000000000000100000000000000000000001000001000000000000000000000
     752#       XY26    BOOL    FALSE
     753#       XY27    BOOL    FALSE
     754#       XY30    BOOL    FALSE
     755#       XY31    BOOL    FALSE
     756#       XY32    BOOL    FALSE
     757#       XY33    BOOL    FALSE
     758# #     XY34    STR     0000000000000000000000000000000000000001000011000000101000111111
     759#       XY34    BOOL    FALSE
     760#       XY35    BOOL    FALSE
     761# #     XY36    STR     0001000000000000000000000000000000010000000000000000000000000000
     762#       XY36    BOOL    FALSE
     763# #     XY37    STR     0000000000000000000000000000000100010001000000001011000010110110 ?
     764#       XY37    BOOL    FALSE
     765# #     XY40    STR     0000000000000000000000000010110000000000000001110000001000011111
     766#       XY40    BOOL    FALSE
     767#       XY41    BOOL    FALSE
     768# #     XY42    BOOL    FALSE
     769#       XY42    STR     0000000000000000000100000001000000000000000000000000000000000000
     770# #     XY43    STR     0000000000000000000000010000000100000000000010000100000100000100
     771#       XY43    STR     0000000000000000000000000000000000000000000010000000000000000000
     772#       XY44    BOOL    FALSE
     773#       XY45    BOOL    FALSE
     774#       XY46    BOOL    FALSE
     775#       XY47    BOOL    FALSE
     776#       XY50    BOOL    FALSE
     777#       XY51    BOOL    FALSE
     778#       XY52    BOOL    FALSE
     779#       XY53    BOOL    FALSE
     780#       XY54    BOOL    FALSE
     781#       XY55    BOOL    FALSE
     782#       XY56    BOOL    FALSE
     783#       XY57    BOOL    FALSE
     784#       XY60    BOOL    FALSE
     785#       XY61    BOOL    FALSE
     786# #     XY62    STR     0000000000000000000000000000000000000000000000000000000000000010
     787#       XY62    BOOL    FALSE
     788#       XY63    BOOL    FALSE
     789#       XY64    BOOL    FALSE
     790#       XY65    BOOL    FALSE
     791#       XY66    BOOL    FALSE
     792#       XY67    BOOL    FALSE
     793#       XY71    BOOL    FALSE
     794# #     XY72    STR     0000000000000000000000000000000000000000000000000000000000000001
     795#       XY72    BOOL    FALSE
     796# #     XY73    STR     0001100000000000000000000000001000000000000000000000000000000000
     797#       XY73    BOOL    FALSE
     798#       XY74    BOOL    FALSE
     799#       XY75    BOOL    FALSE
     800#       XY76    BOOL    FALSE
     801# END
  • trunk/ippconfig/gpc1/format_20100228.config

    r32863 r33243  
    719719END
    720720
     721PATTERN.CELL BOOL FALSE
     722PATTERN.CONTINUITY BOOL TRUE
     723
    721724# PATTERN.CELL  BOOL    TRUE            # by default, do not do any cell pattern correction
    722 PATTERN.CELL.SUBSET     METADATA        # List of chips and whether to do cell pattern correction
    723         XY01    BOOL    FALSE
    724         XY02    BOOL    FALSE
    725         XY03    BOOL    FALSE
    726         XY04    BOOL    FALSE
    727         XY05    BOOL    FALSE
    728 #       XY06    STR     0101000000010000000110000100000000000000000000000000000000000000
    729         XY06    BOOL    FALSE
    730         XY10    BOOL    FALSE
    731         XY11    BOOL    FALSE
    732         XY12    BOOL    FALSE
    733         XY13    BOOL    FALSE
    734         XY14    STR     0000000000000000111111110000000000000000000000000000000000000000
    735         XY15    STR     1111111110000000100000000000000000000000000000000000000000000000
    736 #       XY16    STR     0000000100000000000000000000000000000001000000000000000000000000
    737         XY16    BOOL    FALSE
    738         XY17    BOOL    FALSE
    739         XY20    BOOL    FALSE
    740         XY21    BOOL    FALSE
    741         XY22    BOOL    FALSE
    742         XY23    BOOL    FALSE
    743 #       XY24    STR     0000000000100000000000000110100000100000001000000011100000000000
    744         XY24    BOOL    FALSE
    745 #       XY25    STR     0100010000001001001011000000001000000111000110000000100000000010
    746         XY25    BOOL    FALSE
    747 #       XY26    STR     0000000000000100000000000000000000001000001000000000000000000000
    748         XY26    BOOL    FALSE
    749         XY27    BOOL    FALSE
    750         XY30    BOOL    FALSE
    751         XY31    BOOL    FALSE
    752         XY32    BOOL    FALSE
    753         XY33    BOOL    FALSE
    754 #       XY34    STR     0000000000000000000000000000000000000001000011000000101000111111
    755         XY34    BOOL    FALSE
    756         XY35    BOOL    FALSE
    757 #       XY36    STR     0001000000000000000000000000000000010000000000000000000000000000
    758         XY36    BOOL    FALSE
    759 #       XY37    STR     0000000000000000000000000000000100010001000000001011000010110110 ?
    760         XY37    BOOL    FALSE
    761 #       XY40    STR     0000000000000000000000000010110000000000000001110000001000011111
    762         XY40    BOOL    FALSE
    763         XY41    BOOL    FALSE
    764 #       XY42    BOOL    FALSE
    765         XY42    STR     0000000000000000000100000001000000000000000000000000000000000000
    766 #       XY43    STR     0000000000000000000000010000000100000000000010000100000100000100
    767         XY43    STR     0000000000000000000000000000000000000000000010000000000000000000
    768         XY44    BOOL    FALSE
    769         XY45    BOOL    FALSE
    770         XY46    BOOL    FALSE
    771         XY47    BOOL    FALSE
    772         XY50    BOOL    FALSE
    773         XY51    BOOL    FALSE
    774         XY52    BOOL    FALSE
    775         XY53    BOOL    FALSE
    776         XY54    BOOL    FALSE
    777         XY55    BOOL    FALSE
    778         XY56    BOOL    FALSE
    779         XY57    BOOL    FALSE
    780         XY60    BOOL    FALSE
    781         XY61    BOOL    FALSE
    782 #       XY62    STR     0000000000000000000000000000000000000000000000000000000000000010
    783         XY62    BOOL    FALSE
    784         XY63    BOOL    FALSE
    785         XY64    BOOL    FALSE
    786         XY65    BOOL    FALSE
    787         XY66    BOOL    FALSE
    788         XY67    BOOL    FALSE
    789         XY71    BOOL    FALSE
    790 #       XY72    STR     0000000000000000000000000000000000000000000000000000000000000001
    791         XY72    BOOL    FALSE
    792 #       XY73    STR     0001100000000000000000000000001000000000000000000000000000000000
    793         XY73    BOOL    FALSE
    794         XY74    BOOL    FALSE
    795         XY75    BOOL    FALSE
    796         XY76    BOOL    FALSE
    797 END
     725# PATTERN.CELL.SUBSET   METADATA        # List of chips and whether to do cell pattern correction
     726#       XY01    BOOL    FALSE
     727#       XY02    BOOL    FALSE
     728#       XY03    BOOL    FALSE
     729#       XY04    BOOL    FALSE
     730#       XY05    BOOL    FALSE
     731# #     XY06    STR     0101000000010000000110000100000000000000000000000000000000000000
     732#       XY06    BOOL    FALSE
     733#       XY10    BOOL    FALSE
     734#       XY11    BOOL    FALSE
     735#       XY12    BOOL    FALSE
     736#       XY13    BOOL    FALSE
     737#       XY14    STR     0000000000000000111111110000000000000000000000000000000000000000
     738#       XY15    STR     1111111110000000100000000000000000000000000000000000000000000000
     739# #     XY16    STR     0000000100000000000000000000000000000001000000000000000000000000
     740#       XY16    BOOL    FALSE
     741#       XY17    BOOL    FALSE
     742#       XY20    BOOL    FALSE
     743#       XY21    BOOL    FALSE
     744#       XY22    BOOL    FALSE
     745#       XY23    BOOL    FALSE
     746# #     XY24    STR     0000000000100000000000000110100000100000001000000011100000000000
     747#       XY24    BOOL    FALSE
     748# #     XY25    STR     0100010000001001001011000000001000000111000110000000100000000010
     749#       XY25    BOOL    FALSE
     750# #     XY26    STR     0000000000000100000000000000000000001000001000000000000000000000
     751#       XY26    BOOL    FALSE
     752#       XY27    BOOL    FALSE
     753#       XY30    BOOL    FALSE
     754#       XY31    BOOL    FALSE
     755#       XY32    BOOL    FALSE
     756#       XY33    BOOL    FALSE
     757# #     XY34    STR     0000000000000000000000000000000000000001000011000000101000111111
     758#       XY34    BOOL    FALSE
     759#       XY35    BOOL    FALSE
     760# #     XY36    STR     0001000000000000000000000000000000010000000000000000000000000000
     761#       XY36    BOOL    FALSE
     762# #     XY37    STR     0000000000000000000000000000000100010001000000001011000010110110 ?
     763#       XY37    BOOL    FALSE
     764# #     XY40    STR     0000000000000000000000000010110000000000000001110000001000011111
     765#       XY40    BOOL    FALSE
     766#       XY41    BOOL    FALSE
     767# #     XY42    BOOL    FALSE
     768#       XY42    STR     0000000000000000000100000001000000000000000000000000000000000000
     769# #     XY43    STR     0000000000000000000000010000000100000000000010000100000100000100
     770#       XY43    STR     0000000000000000000000000000000000000000000010000000000000000000
     771#       XY44    BOOL    FALSE
     772#       XY45    BOOL    FALSE
     773#       XY46    BOOL    FALSE
     774#       XY47    BOOL    FALSE
     775#       XY50    BOOL    FALSE
     776#       XY51    BOOL    FALSE
     777#       XY52    BOOL    FALSE
     778#       XY53    BOOL    FALSE
     779#       XY54    BOOL    FALSE
     780#       XY55    BOOL    FALSE
     781#       XY56    BOOL    FALSE
     782#       XY57    BOOL    FALSE
     783#       XY60    BOOL    FALSE
     784#       XY61    BOOL    FALSE
     785# #     XY62    STR     0000000000000000000000000000000000000000000000000000000000000010
     786#       XY62    BOOL    FALSE
     787#       XY63    BOOL    FALSE
     788#       XY64    BOOL    FALSE
     789#       XY65    BOOL    FALSE
     790#       XY66    BOOL    FALSE
     791#       XY67    BOOL    FALSE
     792#       XY71    BOOL    FALSE
     793# #     XY72    STR     0000000000000000000000000000000000000000000000000000000000000001
     794#       XY72    BOOL    FALSE
     795# #     XY73    STR     0001100000000000000000000000001000000000000000000000000000000000
     796#       XY73    BOOL    FALSE
     797#       XY74    BOOL    FALSE
     798#       XY75    BOOL    FALSE
     799#       XY76    BOOL    FALSE
     800# END
  • trunk/ippconfig/gpc1/format_20100723.config

    r32863 r33243  
    592592END
    593593
    594 # PATTERN.CELL  BOOL    TRUE            # by default, do not do any cell pattern correction
    595 PATTERN.CELL.SUBSET     METADATA        # List of chips and whether to do cell pattern correction
    596         XY01    BOOL    FALSE
    597         XY02    BOOL    FALSE
    598         XY03    BOOL    FALSE
    599         XY04    BOOL    FALSE
    600         XY05    BOOL    FALSE
    601 #       XY06    STR     0101000000010000000110000100000000000000000000000000000000000000
    602         XY06    BOOL    FALSE
    603         XY10    BOOL    FALSE
    604         XY11    BOOL    FALSE
    605         XY12    BOOL    FALSE
    606         XY13    BOOL    FALSE
    607         XY14    STR     0000000000000000111111110000000000000000000000000000000000000000
    608         XY15    STR     1111111110000000100000000000000000000000000000000000000000000000
    609 #       XY16    STR     0000000100000000000000000000000000000001000000000000000000000000
    610         XY16    BOOL    FALSE
    611         XY17    BOOL    FALSE
    612         XY20    BOOL    FALSE
    613         XY21    BOOL    FALSE
    614         XY22    BOOL    FALSE
    615         XY23    BOOL    FALSE
    616 #       XY24    STR     0000000000100000000000000110100000100000001000000011100000000000
    617         XY24    BOOL    FALSE
    618 #       XY25    STR     0100010000001001001011000000001000000111000110000000100000000010
    619         XY25    BOOL    FALSE
    620 #       XY26    STR     0000000000000100000000000000000000001000001000000000000000000000
    621         XY26    BOOL    FALSE
    622         XY27    BOOL    FALSE
    623         XY30    BOOL    FALSE
    624         XY31    BOOL    FALSE
    625         XY32    BOOL    FALSE
    626         XY33    BOOL    FALSE
    627 #       XY34    STR     0000000000000000000000000000000000000001000011000000101000111111
    628         XY34    BOOL    FALSE
    629         XY35    BOOL    FALSE
    630 #       XY36    STR     0001000000000000000000000000000000010000000000000000000000000000
    631         XY36    BOOL    FALSE
    632 #       XY37    STR     0000000000000000000000000000000100010001000000001011000010110110 ?
    633         XY37    BOOL    FALSE
    634 #       XY40    STR     0000000000000000000000000010110000000000000001110000001000011111
    635         XY40    BOOL    FALSE
    636         XY41    BOOL    FALSE
    637 #       XY42    BOOL    FALSE
    638         XY42    STR     0000000000000000000100000001000000000000000000000000000000000000
    639 #       XY43    STR     0000000000000000000000010000000100000000000010000100000100000100
    640         XY43    STR     0000000000000000000000000000000000000000000010000000000000000000
    641         XY44    BOOL    FALSE
    642         XY45    BOOL    FALSE
    643         XY46    BOOL    FALSE
    644         XY47    BOOL    FALSE
    645         XY50    BOOL    FALSE
    646         XY51    BOOL    FALSE
    647         XY52    BOOL    FALSE
    648         XY53    BOOL    FALSE
    649         XY54    BOOL    FALSE
    650         XY55    BOOL    FALSE
    651         XY56    BOOL    FALSE
    652         XY57    BOOL    FALSE
    653         XY60    BOOL    FALSE
    654         XY61    BOOL    FALSE
    655 #       XY62    STR     0000000000000000000000000000000000000000000000000000000000000010
    656         XY62    BOOL    FALSE
    657         XY63    BOOL    FALSE
    658         XY64    BOOL    FALSE
    659         XY65    BOOL    FALSE
    660         XY66    BOOL    FALSE
    661         XY67    BOOL    FALSE
    662         XY71    BOOL    FALSE
    663 #       XY72    STR     0000000000000000000000000000000000000000000000000000000000000001
    664         XY72    BOOL    FALSE
    665 #       XY73    STR     0001100000000000000000000000001000000000000000000000000000000000
    666         XY73    BOOL    FALSE
    667         XY74    BOOL    FALSE
    668         XY75    BOOL    FALSE
    669         XY76    BOOL    FALSE
    670 END
     594PATTERN.CONTINUITY BOOL TRUE
     595 PATTERN.CELL   BOOL    FALSE           # by default, do not do any cell pattern correction
     596# PATTERN.CELL.SUBSET   METADATA        # List of chips and whether to do cell pattern correction
     597#       XY01    BOOL    FALSE
     598#       XY02    BOOL    FALSE
     599#       XY03    BOOL    FALSE
     600#       XY04    BOOL    FALSE
     601#       XY05    BOOL    FALSE
     602# #     XY06    STR     0101000000010000000110000100000000000000000000000000000000000000
     603#       XY06    BOOL    FALSE
     604#       XY10    BOOL    FALSE
     605#       XY11    BOOL    FALSE
     606#       XY12    BOOL    FALSE
     607#       XY13    BOOL    FALSE
     608#       XY14    STR     0000000000000000111111110000000000000000000000000000000000000000
     609#       XY15    STR     1111111110000000100000000000000000000000000000000000000000000000
     610# #     XY16    STR     0000000100000000000000000000000000000001000000000000000000000000
     611#       XY16    BOOL    FALSE
     612#       XY17    BOOL    FALSE
     613#       XY20    BOOL    FALSE
     614#       XY21    BOOL    FALSE
     615#       XY22    BOOL    FALSE
     616#       XY23    BOOL    FALSE
     617# #     XY24    STR     0000000000100000000000000110100000100000001000000011100000000000
     618#       XY24    BOOL    FALSE
     619# #     XY25    STR     0100010000001001001011000000001000000111000110000000100000000010
     620#       XY25    BOOL    FALSE
     621# #     XY26    STR     0000000000000100000000000000000000001000001000000000000000000000
     622#       XY26    BOOL    FALSE
     623#       XY27    BOOL    FALSE
     624#       XY30    BOOL    FALSE
     625#       XY31    BOOL    FALSE
     626#       XY32    BOOL    FALSE
     627#       XY33    BOOL    FALSE
     628# #     XY34    STR     0000000000000000000000000000000000000001000011000000101000111111
     629#       XY34    BOOL    FALSE
     630#       XY35    BOOL    FALSE
     631# #     XY36    STR     0001000000000000000000000000000000010000000000000000000000000000
     632#       XY36    BOOL    FALSE
     633# #     XY37    STR     0000000000000000000000000000000100010001000000001011000010110110 ?
     634#       XY37    BOOL    FALSE
     635# #     XY40    STR     0000000000000000000000000010110000000000000001110000001000011111
     636#       XY40    BOOL    FALSE
     637#       XY41    BOOL    FALSE
     638# #     XY42    BOOL    FALSE
     639#       XY42    STR     0000000000000000000100000001000000000000000000000000000000000000
     640# #     XY43    STR     0000000000000000000000010000000100000000000010000100000100000100
     641#       XY43    STR     0000000000000000000000000000000000000000000010000000000000000000
     642#       XY44    BOOL    FALSE
     643#       XY45    BOOL    FALSE
     644#       XY46    BOOL    FALSE
     645#       XY47    BOOL    FALSE
     646#       XY50    BOOL    FALSE
     647#       XY51    BOOL    FALSE
     648#       XY52    BOOL    FALSE
     649#       XY53    BOOL    FALSE
     650#       XY54    BOOL    FALSE
     651#       XY55    BOOL    FALSE
     652#       XY56    BOOL    FALSE
     653#       XY57    BOOL    FALSE
     654#       XY60    BOOL    FALSE
     655#       XY61    BOOL    FALSE
     656# #     XY62    STR     0000000000000000000000000000000000000000000000000000000000000010
     657#       XY62    BOOL    FALSE
     658#       XY63    BOOL    FALSE
     659#       XY64    BOOL    FALSE
     660#       XY65    BOOL    FALSE
     661#       XY66    BOOL    FALSE
     662#       XY67    BOOL    FALSE
     663#       XY71    BOOL    FALSE
     664# #     XY72    STR     0000000000000000000000000000000000000000000000000000000000000001
     665#       XY72    BOOL    FALSE
     666# #     XY73    STR     0001100000000000000000000000001000000000000000000000000000000000
     667#       XY73    BOOL    FALSE
     668#       XY74    BOOL    FALSE
     669#       XY75    BOOL    FALSE
     670#       XY76    BOOL    FALSE
     671# END
  • trunk/ippconfig/gpc1/ppImage.config

    r32863 r33243  
    166166  MASK.BURNTOOL      BOOL    TRUE            # Mask potential burntool trails
    167167  PATTERN.ROW        BOOL    TRUE            # Row pattern correction
    168   PATTERN.CELL       BOOL    TRUE            # Cell pattern correction
     168  PATTERN.CELL       BOOL    FALSE           # Cell pattern correction
     169  PATTERN.CONTINUITY BOOL    TRUE            # Cell pattern correction using edge continuity
    169170  FRINGE             BOOL    TRUE            # Fringe subtraction
    170171  BIN1.FITS          BOOL    TRUE            # Save 1st binned chip image?
  • trunk/ippconfig/recipes/ppImage.config

    r32863 r33243  
    2727PATTERN.SUBSET     METADATA
    2828END
     29PATTERN.CONTINUITY BOOL    FALSE
     30PATTERN.CONTINUITY.WIDTH S32  50
     31PATTERN.CONTINUITY.SUBSET BOOL TRUE
    2932FRINGE             BOOL    FALSE           # Fringe subtraction
    3033PHOTOM             BOOL    FALSE           # Source identification and photometry
  • trunk/ppImage/src/ppImage.h

    r30655 r33243  
    4040    bool doPatternRow;                  // Row pattern correction
    4141    bool doPatternCell;                 // Cell pattern correction
     42    bool doPatternContinuity;           // Cell continuity correction
    4243    bool doFringe;                      // Fringe subtraction
    4344    bool doPhotom;                      // Source identification and photometry
     
    109110    psStatsOptions patternCellMean;        // Statistic for mean
    110111
     112  int patternContinuityEdgeWidth;        // Size of box to use for edge matching.
     113 
    111114    int remnanceSize;                   // Size for remnance detection
    112115    float remnanceThresh;               // Threshold for remnance detection
  • trunk/ppImage/src/ppImageDetrendPattern.c

    r31066 r33243  
    1818    pmCell *cell = NULL;
    1919
    20     assert(options->doPatternRow || options->doPatternCell); // do not call if not needed
     20    assert(options->doPatternRow || options->doPatternCell || options->doPatternContinuity); // do not call if not needed
    2121    assert(inputView->chip != -1);
    2222    assert(inputView->cell == -1);
     
    4040        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_ROW")) {
    4141          psLogMsg("ppImage", PS_LOG_INFO, "Not performing row pattern correction as it has already been done.");
    42           goto pattern_cell;
     42          goto pattern_continuity;
    4343        }
    4444
     
    9898    }
    9999
     100 pattern_continuity:
     101
     102    // see the comment for PATTERN.ROW; the same rules apply for PATTERN.CELL
     103
     104    if (options->doPatternContinuity) {
     105        int numCells = chip->cells->n;       // Number of cells
     106        psVector *tweak = psVectorAlloc(numCells, PS_TYPE_U8); // Tweak cell?
     107        pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
     108        *view = *inputView;
     109
     110        pmHDU *hdu = pmHDUFromChip(chip);
     111        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_CON")) {
     112          psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell continuity correction as it has already been done.");
     113          goto pattern_cell;
     114        }
     115
     116        for (int i = 0; i < chip->cells->n; i++) {
     117            view->cell = i;
     118
     119            pmCell *cell = chip->cells->data[i]; // Cell of interest
     120
     121            if (cell->readouts->n > 1) {
     122                psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell continuity correction on video cell.");
     123                continue;
     124            }
     125
     126            bool doPattern = false;
     127            if (!doPatternForView(&doPattern, config, chip, view, RECIPE_NAME, "PATTERN.CONTINUITY.SUBSET")) {
     128                ESCAPE(false, "Unable to determine whether row pattern matching should be applied.");
     129            }
     130            if (doPattern) {
     131                tweak->data.U8[i] = 0xFF;
     132            }
     133        }
     134
     135        // Tweak the cells
     136        if (!pmPatternContinuity(chip, tweak, options->patternCellBG, options->patternCellMean,
     137                                 options->maskValue, options->darkMask,options->patternContinuityEdgeWidth)) {
     138            psFree(tweak);
     139            psFree(view);
     140            return false;
     141        }
     142        psFree(tweak);
     143        psFree(view);
     144
     145        psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_CON",PS_META_REPLACE,"PATTERN.CONTINUITY correction applied",true);
     146    }
     147
    100148 pattern_cell:
    101 
    102     // see the comment for PATTERN.ROW; the same rules apply for PATTERN.CELL
    103 
     149   
    104150    if (options->doPatternCell) {
    105151        int numCells = chip->cells->n;       // Number of cells
     
    131177                tweak->data.U8[i] = 0xFF;
    132178            }
    133 
    134179        }
    135180
  • trunk/ppImage/src/ppImageLoop.c

    r30655 r33243  
    170170
    171171        // Apply the pattern correction
    172         if (options->doPatternRow || options->doPatternCell) {
     172        if (options->doPatternRow || options->doPatternCell || options->doPatternContinuity) {
    173173          if (!ppImageDetrendPatternApply(config,chip,view,options)) {
    174174            ESCAPE("Unable to apply pattern corrections");
  • trunk/ppImage/src/ppImageOptions.c

    r31066 r33243  
    3434    options->doPatternRow    = false;   // Row pattern correction
    3535    options->doPatternCell   = false;   // Cell pattern correction
     36    options->doPatternContinuity = false; // Cell continuity correction
    3637    options->doFringe        = false;   // Fringe subtraction
    3738    options->doPhotom        = false;   // Source identification and photometry
     
    253254    options->doPatternRow = psMetadataLookupBool(NULL, recipe, "PATTERN.ROW");
    254255    options->doPatternCell = psMetadataLookupBool(NULL, recipe, "PATTERN.CELL");
     256    options->doPatternContinuity = psMetadataLookupBool(NULL, recipe, "PATTERN.CONTINUITY");
    255257
    256258    options->doMaskStats = psMetadataLookupBool(NULL, recipe, "MASK.STATS");
     
    408410    }
    409411
     412    if (psMetadataLookup(format, "PATTERN.CONTINUITY.WIDTH")) {
     413      options->patternContinuityEdgeWidth = psMetadataLookupS32(NULL, format, "PATTERN.CONTINUITY.WIDTH");
     414    }
     415    else {
     416      options->patternContinuityEdgeWidth = psMetadataLookupS32(NULL, recipe, "PATTERN.CONTINUITY.WIDTH");
     417    }
     418   
    410419
    411420    // Remnance options
  • trunk/psModules/src/detrend/pmPattern.c

    r32970 r33243  
    146146        // Store the results we found for this row.
    147147        yaxisData->data.F32[y] = poly->coeff[0];
     148        xaxisData->data.F32[y] = poly->coeff[1];
     149        psTrace("pattern",1,"%d %g %g\n",y,poly->coeff[0],poly->coeff[1]);
     150       
     151        //      yaxisData->data.F32[y] = 0.0;
     152/*      xaxisData->data.F32[y] = 0.0; */
     153       
    148154#endif
    149155        memcpy(corr->data.F64[y], poly->coeff, (order + 1) * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
     
    161167        for (int x = 0; x < numCols; x++) {
    162168            image->data.F32[y][x] -= solution->data.F32[x];
     169            psTrace("pattern",5,"A: %d %d %g\n",x,y,solution->data.F32[x]);
    163170        }
    164171        psFree(solution);
     
    177184    // Fit the trend of the constant term, producing the y-axis global trend
    178185    psStatsInit(clip);
    179     psPolynomial1D *yaxisPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2); // Polynomial to fit.
     186    psPolynomial1D *yaxisPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 1); // Polynomial to fit.
    180187    if (!psVectorClipFitPolynomial1D(yaxisPoly,clip,yaxisMask,0xFF,yaxisData, NULL, yaxisIndices)) {
    181188      psWarning("Unable to fit polynomial to y-axis trend");
     
    209216            image->data.F32[y][x] += solution->data.F32[y];
    210217            corr->data.F64[y][0]  -= solution->data.F32[y];
     218            psTrace("pattern",5,"B: %d %d %g\n",x,y,solution->data.F32[x]);
    211219          }
    212220        }
     
    218226    // We can use the same mask vector, as the same rows failed the row-fit earlier.
    219227    psStatsInit(clip);
    220     psPolynomial1D *xaxisPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2); // Polynomial to fit.
     228    psPolynomial1D *xaxisPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 1); // Polynomial to fit.
    221229    if (!psVectorClipFitPolynomial1D(xaxisPoly,clip,yaxisMask,0xFF,xaxisData, NULL, yaxisIndices)) {
    222230      psWarning("Unable to fit polynomial to x-axis trend");
     
    233241          for (int x = 0; x < numCols; x++) {
    234242            image->data.F32[y][x] += solution->data.F32[y] * indices->data.F32[x];
    235             corr->data.F64[y][0]  -= solution->data.F32[y] * indices->data.F32[x];
     243            corr->data.F64[y][1]  -= solution->data.F32[y] ;
     244            psTrace("pattern",5,"C: %d %d %g %g\n",x,y,solution->data.F32[x],indices->data.F32[x]);
    236245          }
    237246        }
     
    500509
    501510
     511
     512bool pmPatternContinuity(pmChip *chip, const psVector *tweak, psStatsOptions bgStat, psStatsOptions cellStat,
     513                         psImageMaskType maskVal, psImageMaskType maskBad, int edgeWidth)
     514{
     515    PS_ASSERT_PTR_NON_NULL(chip, false);
     516    PS_ASSERT_VECTOR_NON_NULL(tweak, false);
     517    PS_ASSERT_VECTOR_SIZE(tweak, chip->cells->n, false);
     518    PS_ASSERT_VECTOR_TYPE(tweak, PS_TYPE_U8, false);
     519
     520    int numCells = tweak->n;            // Number of cells
     521
     522    psVector *meanMask = psVectorAlloc(numCells, PS_TYPE_VECTOR_MASK); // Mask for means
     523    psVectorInit(meanMask, 0);
     524
     525    // Mask bits
     526    enum {
     527        PM_PATTERN_IGNORE = 0x01,       // Ignore this cell
     528        PM_PATTERN_TWEAK  = 0x02,       // Tweak this cell
     529        PM_PATTERN_ERROR  = 0x04,       // Error in calculating background
     530        PM_PATTERN_ALL    = 0xFF,       // All causes
     531    };
     532
     533    // Count number of cells to tweak
     534    int numTweak = 0;                   // Number of cells to tweak
     535    int numIgnore = 0;                  // Number of cells to ignore
     536    for (int i = 0; i < numCells; i++) {
     537        pmCell *cell = chip->cells->data[i]; // Cell of interest
     538        if (!cell || !cell->data_exists || !cell->process ||
     539            cell->readouts->n == 0 || cell->readouts->n > 1 || !cell->readouts->data[0]) {
     540            numIgnore++;
     541            meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PM_PATTERN_IGNORE;
     542            continue;
     543        }
     544        if (tweak->data.U8[i]) {
     545            meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PM_PATTERN_TWEAK;
     546            numTweak++;
     547        }
     548    }
     549    if (numTweak == 0) {
     550        // Nothing to do
     551        psFree(meanMask);
     552        return true;
     553    }
     554
     555    // Measure mean of each cell edge, and use that to determine the cell offsets.
     556
     557    psStats *bgStats = psStatsAlloc(bgStat); // Statistics on background
     558    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator
     559
     560    psRegion region = {0,0,0,0};
     561
     562    /* These images hold the edge data for the OTA structure.  */
     563    psImage *A = psImageAlloc(8,8,PS_TYPE_F64); // Top edge
     564    psImage *B = psImageAlloc(8,8,PS_TYPE_F64); // Bottom edge
     565    psImage *C = psImageAlloc(8,8,PS_TYPE_F64); // Right edge
     566    psImage *D = psImageAlloc(8,8,PS_TYPE_F64); // Left edge
     567   
     568    for (int i = 0; i < numCells; i++) {
     569        if (meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PM_PATTERN_IGNORE) {
     570            continue;
     571        }
     572        pmCell *cell = chip->cells->data[i]; // Cell of interest
     573        pmReadout *ro = cell->readouts->data[0]; // Readout of interest
     574
     575        psStatsInit(bgStats);
     576
     577        // Convert cell iterator i into an xy coordinate on the grid of cells
     578        int y = (i % 8);
     579        int x = (i - y) / 8;
     580       
     581        for (int j = 0; j < 4; j++) {
     582          if (j == 0) {  // Region B
     583            region = psRegionSet(0,ro->image->numCols,
     584                                 0,edgeWidth);
     585          }
     586          else if (j == 1) { // Region A
     587            region = psRegionSet(0,ro->image->numCols,
     588                                 ro->image->numRows - edgeWidth,ro->image->numRows);
     589          }
     590          else if (j == 2) { // Region D
     591            region = psRegionSet(0,edgeWidth,
     592                                 0,ro->image->numRows);
     593          }
     594          else if (j == 3) { // Region C
     595            region = psRegionSet(ro->image->numCols - edgeWidth,ro->image->numCols,
     596                                 0,ro->image->numRows);
     597          }
     598          psImage *subset  = psImageSubset(ro->image,region);
     599          psImage *submask = psImageSubset(ro->mask,region);
     600
     601          if (!psImageBackground(bgStats, NULL, subset, submask, maskVal, rng)) {
     602            psWarning("Unable to measure background for cell %d on edge %d\n", i, j);
     603            psErrorClear();
     604            meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PM_PATTERN_ERROR;
     605            if (j == 0)      { B->data.F64[y][x] = NAN; }
     606            else if (j == 1) { A->data.F64[y][x] = NAN; }
     607            else if (j == 2) { C->data.F64[y][x] = NAN; }
     608            else if (j == 3) { D->data.F64[y][x] = NAN; }
     609            psFree(subset);
     610            psFree(submask);
     611            continue; // Move on to next edge, as only part of this cell may be a problem
     612          }
     613
     614          // If the returned value is zero, assume something is wrong.  Do I still need this?
     615          if (psStatsGetValue(bgStats,bgStat) < 1e-6) {
     616            if (j == 0)      { B->data.F64[y][x] = NAN; }
     617            else if (j == 1) { A->data.F64[y][x] = NAN; }
     618            else if (j == 2) { C->data.F64[y][x] = NAN; }
     619            else if (j == 3) { D->data.F64[y][x] = NAN; }
     620          }
     621          // If we have an error for this cell/edge, make sure we mask the value
     622          if (meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PM_PATTERN_ERROR) {
     623            if (j == 0)      { B->data.F64[y][x] = NAN; }
     624            else if (j == 1) { A->data.F64[y][x] = NAN; }
     625            else if (j == 2) { C->data.F64[y][x] = NAN; }
     626            else if (j == 3) { D->data.F64[y][x] = NAN; }
     627          }
     628          else { // Set the value to match what we got from the edge box.
     629            if (j == 0)      { B->data.F64[y][x] = psStatsGetValue(bgStats,bgStat); }
     630            else if (j == 1) { A->data.F64[y][x] = psStatsGetValue(bgStats,bgStat); }
     631            else if (j == 2) { C->data.F64[y][x] = psStatsGetValue(bgStats,bgStat); }
     632            else if (j == 3) { D->data.F64[y][x] = psStatsGetValue(bgStats,bgStat); }
     633          }
     634          psFree(subset);
     635          psFree(submask);
     636
     637        }
     638        psTrace("psModules.detrend.cont",5, "OTA: %d (%d %d) A: %f B: %f C: %f D: %f",
     639                i,x,y,
     640                A->data.F32[y][x],B->data.F32[y][x],C->data.F32[y][x],D->data.F32[y][x]);               
     641    }
     642    psFree(bgStats);
     643    psFree(rng);
     644
     645    // We've now allocated all the edge values, so we can now minimize the offsets.
     646    // This involves solving the equation A x = b, where
     647    // A is the (64x64 for GPC1) matrix containing the edges that match for each cell
     648    // x is the solution vector
     649    // b is the combination of offsets across each cell boundary for each cell.
     650    // Below "XX" is used as the matrix A, and "solution" is used as both b and x
     651    //   (due to the way psMatrixLUSolve operates).
     652    psVector *solution = psVectorAlloc(64,PS_TYPE_F64);
     653    psImage  *XX       = psImageAlloc(64,64,PS_TYPE_F64);
     654    psVectorInit(solution,0.0);
     655    psImageInit(XX,0.0);
     656   
     657    for (int i = 0; i < numCells; i++) {
     658      // Accumulate all the possible edge differences we can for this cell.
     659      // As we do so, make a note of the correlations by incrementing the element of the matrix.
     660      int y = (i % 8);
     661      int x = (i - y) / 8;
     662      int j;
     663      if (meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PM_PATTERN_IGNORE) {
     664        continue;
     665      }
     666      if (x + 1 < 8) {  // We have a neighbor adjacent in the +x direction
     667        j = 8 * (x + 1) + y; // Determine that neighbor's index
     668        psTrace("psModules.detrend.cont",5,"CmD %d %d %d %d %g %g", // diagnostic
     669                i,x,y,j,
     670                C->data.F64[y][x],
     671                D->data.F64[y][x+1]
     672                );
     673        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&  // If there are no errors with the neighbor,
     674            (isfinite(C->data.F64[y][x]))&&(isfinite(D->data.F64[y][x+1]))) {    // and all edges have valid values:
     675          solution->data.F64[i] += C->data.F64[y][x] - D->data.F64[y][x+1];     // Take the difference
     676          XX->data.F64[i][i] += 1;                                              // increment our relation with ourself
     677          XX->data.F64[i][j] += -1;                                             // decrement our relation with the neighbor
     678        }
     679      }
     680      if (x - 1 > -1) { // etc.
     681        j = 8 * (x - 1) + y;
     682        psTrace("psModules.detrend.cont",5,"DmC %d %d %d %d %g %g",
     683                i,x,y,j,
     684                D->data.F64[y][x],
     685                C->data.F64[y][x-1]
     686                );
     687
     688        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
     689            (isfinite(D->data.F64[y][x]))&&(isfinite(C->data.F64[y][x-1]))) {
     690          solution->data.F64[i] += D->data.F64[y][x] - C->data.F64[y][x-1];
     691          XX->data.F64[i][i] += 1;
     692          XX->data.F64[i][j] += -1;
     693        }
     694      }
     695      if (y + 1 < 8) {
     696        j = 8 * x + (y + 1);
     697        psTrace("psModules.detrend.cont",5,"AmB %d %d %d %d %g %g",
     698                i,x,y,j,
     699                A->data.F64[y][x],
     700                B->data.F64[y+1][x]
     701                );
     702
     703        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
     704            (isfinite(A->data.F64[y][x]))&&(isfinite(B->data.F64[y+1][x]))) {
     705          solution->data.F64[i] += A->data.F64[y][x] - B->data.F64[y+1][x];
     706          XX->data.F64[i][i] += 1;
     707          XX->data.F64[i][j] += -1;
     708        }
     709      }
     710      if (y - 1 > -1) {
     711        j = 8 * x +  (y - 1);
     712        psTrace("psModules.detrend.cont",5,"BmA %d %d %d %d %g %g",
     713                i,x,y,j,
     714                B->data.F64[y][x],
     715                A->data.F64[y-1][x]
     716                );
     717
     718        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
     719            (isfinite(B->data.F64[y][x]))&&(isfinite(A->data.F64[y-1][x]))) {
     720          solution->data.F64[i] += B->data.F64[y][x] - A->data.F64[y-1][x];
     721          XX->data.F64[i][i] += 1;
     722          XX->data.F64[i][j] += -1;
     723        }
     724      }
     725    }
     726    for (int i = 0; i < numCells; i++) { // If any cells have no value of themself, set the matrix to 1.0.
     727      if (XX->data.F64[i][i] == 0.0) {
     728        XX->data.F64[i][i] = 1.0;
     729      }
     730    }
     731#if (0)
     732    for (int i = 0; i < numCells; i++) { // print matrix A
     733      psTrace("psModules.detrend.cont",5,"A: %3d % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f",
     734              i,
     735              XX->data.F64[i][0],             XX->data.F64[i][1],             XX->data.F64[i][2],             XX->data.F64[i][3],
     736              XX->data.F64[i][4],             XX->data.F64[i][5],             XX->data.F64[i][6],             XX->data.F64[i][7],
     737              XX->data.F64[i][8],             XX->data.F64[i][9],             XX->data.F64[i][10],            XX->data.F64[i][11],
     738              XX->data.F64[i][12],            XX->data.F64[i][13],            XX->data.F64[i][14],            XX->data.F64[i][15],
     739              XX->data.F64[i][16],            XX->data.F64[i][17],            XX->data.F64[i][18],            XX->data.F64[i][19],
     740              XX->data.F64[i][20],            XX->data.F64[i][21],            XX->data.F64[i][22],            XX->data.F64[i][23],
     741              XX->data.F64[i][24],            XX->data.F64[i][25],            XX->data.F64[i][26],            XX->data.F64[i][27],
     742              XX->data.F64[i][28],            XX->data.F64[i][29],            XX->data.F64[i][30],            XX->data.F64[i][31],
     743              XX->data.F64[i][32],            XX->data.F64[i][33],            XX->data.F64[i][34],            XX->data.F64[i][35],
     744              XX->data.F64[i][36],            XX->data.F64[i][37],            XX->data.F64[i][38],            XX->data.F64[i][39],
     745              XX->data.F64[i][40],            XX->data.F64[i][41],            XX->data.F64[i][42],            XX->data.F64[i][43],
     746              XX->data.F64[i][44],            XX->data.F64[i][45],            XX->data.F64[i][46],            XX->data.F64[i][47],
     747              XX->data.F64[i][48],            XX->data.F64[i][49],            XX->data.F64[i][50],            XX->data.F64[i][51],
     748              XX->data.F64[i][52],            XX->data.F64[i][53],            XX->data.F64[i][54],            XX->data.F64[i][55],
     749              XX->data.F64[i][56],            XX->data.F64[i][57],            XX->data.F64[i][58],            XX->data.F64[i][59],
     750              XX->data.F64[i][60],            XX->data.F64[i][61],            XX->data.F64[i][62],            XX->data.F64[i][63]
     751              );
     752    }
     753
     754    for (int i = 0; i < numCells; i++) { // print vector b
     755      psTrace("psModules.detrend.cont",5,"b: %d %f",
     756              i,
     757              solution->data.F64[i]
     758              );
     759    }
     760#endif   
     761   
     762    // Solve the Ax=b equation
     763    psMatrixLUSolve(XX,solution);
     764
     765    /* old code to remove the minimum solution value from the set, to give a "minimal set of offsets." Mathematically unnecessary. */
     766/*     double min = 99e99; */
     767/*     for (int i = 0; i < numCells; i++) { */
     768/*       if (solution->data.F64[i] < min) { */
     769/*      min = solution->data.F64[i]; */
     770/*       } */
     771/*       psTrace("psModules.detrend.cont",5,"x: %d %f %f ", */
     772/*            i, */
     773/*            solution->data.F64[i],min */
     774/*            ); */
     775/*     } */
     776/*     for (int i = 0; i < numCells; i++) { */
     777/*      if (solution->data.F64[i] != 0.0) { */
     778/*        solution->data.F64[i] -= min; */
     779/*      } */
     780/*     } */
     781
     782    // Cleanup
     783    psFree(XX);
     784    psFree(A);
     785    psFree(B);
     786    psFree(C);
     787    psFree(D);
     788
     789    // Correct cells based on the offsets calculated, and store the result in the analysis metadata.
     790    for (int i = 0; i < numCells; i++) {
     791        if (meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PM_PATTERN_IGNORE) {
     792            continue;
     793        }
     794        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PM_PATTERN_TWEAK)) {
     795            continue;
     796        }
     797        pmCell *cell = chip->cells->data[i]; // Cell of interest
     798        pmReadout *ro = cell->readouts->data[0]; // Readout of interest
     799
     800        float correction = solution->data.F64[i];
     801        const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell
     802        psLogMsg("psModules.detrend", PS_LOG_DETAIL, "Correcting background of cell %s by %f",
     803                 cellName, correction);
     804        psBinaryOp(ro->image, ro->image, "-", psScalarAlloc(correction, PS_TYPE_F32));
     805        psMetadataAddF32(ro->analysis, PS_LIST_TAIL, PM_PATTERN_CELL_CORRECTION, PS_META_REPLACE,
     806                         "Pattern cell correction solution", correction);
     807    }
     808
     809    psFree(solution);
     810    psFree(meanMask);
     811
     812    return true;
     813}
     814
     815bool pmPatternContinuityApply(pmReadout *ro, psImageMaskType maskBad)
     816{
     817    PM_ASSERT_READOUT_NON_NULL(ro, false);
     818    PM_ASSERT_READOUT_IMAGE(ro, false);
     819
     820    bool mdok;                          // Status of MD lookup
     821    float corr = psMetadataLookupF32(&mdok, ro->analysis, PM_PATTERN_CELL_CORRECTION); // Correction to apply
     822    if (!mdok) {
     823        // No correction to apply
     824        return true;
     825    }
     826
     827    psImage *image = ro->image, *mask = ro->mask; // Image and mask of interest
     828    int numCols = image->numCols, numRows = image->numRows; // Size of image
     829
     830    if (!isfinite(corr)) {
     831        for (int y = 0; y < numRows; y++) {
     832            for (int x = 0; x < numCols; x++) {
     833                image->data.F32[y][x] = NAN;
     834            }
     835        }
     836        if (mask) {
     837            for (int y = 0; y < numRows; y++) {
     838                for (int x = 0; x < numCols; x++) {
     839                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskBad;
     840                }
     841            }
     842        }
     843    } else {
     844        for (int y = 0; y < numRows; y++) {
     845            for (int x = 0; x < numCols; x++) {
     846                image->data.F32[y][x] += corr;
     847            }
     848        }
     849    }
     850
     851    return true;
     852}
     853
     854
  • trunk/psModules/src/detrend/pmPattern.h

    r26893 r33243  
    5454                        );
    5555
     56/// Fix the background on cells known to be troublesome
     57bool pmPatternContinuity(
     58    pmChip *chip,                       ///< Chip to correct
     59    const psVector *tweak,              ///< U8 vector indicating whether to tweak the corresponding cell
     60    psStatsOptions bgStat,              ///< Statistic to use for background measurement
     61    psStatsOptions cellStat,            ///< Statistic to use for combination of cell background measurements
     62    psImageMaskType maskVal,            ///< Mask value to use
     63    psImageMaskType maskBad,            ///< Mask value to give bad pixels
     64    int edgeWidth                       ///< Size of box to use
     65    );
     66
     67/// Apply previously measured cell pattern correction
     68bool pmPatternContinuityApply(pmReadout *ro,          ///< Readout to correct
     69                        psImageMaskType maskBad ///< Mask value to give bad pixels
     70                        );
     71
     72
    5673
    5774/// @}
Note: See TracChangeset for help on using the changeset viewer.