IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40179


Ignore:
Timestamp:
Oct 24, 2017, 4:20:46 PM (9 years ago)
Author:
watersc1
Message:

HSC changes that haven't been committed yet. Includes a number of configuration changes, improved glint masking, unfinished ghost masking, and the PSF model that I forgot to include previously.

Location:
branches/czw_branch/20170908
Files:
5 added
16 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20170908/ippconfig/dvo.photcodes

    r39926 r40179  
    16631663  25110 HSC.NB921.110            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
    16641664  25111 HSC.NB921.111            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
    1665 
     1665  26000 HSC.NB816.00             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1666  26001 HSC.NB816.01             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1667  26002 HSC.NB816.02             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1668  26003 HSC.NB816.03             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1669  26004 HSC.NB816.04             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1670  26005 HSC.NB816.05             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1671  26006 HSC.NB816.06             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1672  26007 HSC.NB816.07             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1673  26008 HSC.NB816.08             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1674  26009 HSC.NB816.09             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1675  26010 HSC.NB816.10             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1676  26011 HSC.NB816.11             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1677  26012 HSC.NB816.12             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1678  26013 HSC.NB816.13             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1679  26014 HSC.NB816.14             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1680  26015 HSC.NB816.15             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1681  26016 HSC.NB816.16             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1682  26017 HSC.NB816.17             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1683  26018 HSC.NB816.18             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1684  26019 HSC.NB816.19             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1685  26020 HSC.NB816.20             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1686  26021 HSC.NB816.21             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1687  26022 HSC.NB816.22             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1688  26023 HSC.NB816.23             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1689  26024 HSC.NB816.24             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1690  26025 HSC.NB816.25             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1691  26026 HSC.NB816.26             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1692  26027 HSC.NB816.27             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1693  26028 HSC.NB816.28             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1694  26029 HSC.NB816.29             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1695  26030 HSC.NB816.30             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1696  26031 HSC.NB816.31             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1697  26032 HSC.NB816.32             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1698  26033 HSC.NB816.33             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1699  26034 HSC.NB816.34             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1700  26035 HSC.NB816.35             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1701  26036 HSC.NB816.36             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1702  26037 HSC.NB816.37             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1703  26038 HSC.NB816.38             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1704  26039 HSC.NB816.39             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1705  26040 HSC.NB816.40             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1706  26041 HSC.NB816.41             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1707  26042 HSC.NB816.42             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1708  26043 HSC.NB816.43             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1709  26044 HSC.NB816.44             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1710  26045 HSC.NB816.45             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1711  26046 HSC.NB816.46             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1712  26047 HSC.NB816.47             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1713  26048 HSC.NB816.48             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1714  26049 HSC.NB816.49             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1715  26050 HSC.NB816.50             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1716  26051 HSC.NB816.51             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1717  26052 HSC.NB816.52             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1718  26053 HSC.NB816.53             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1719  26054 HSC.NB816.54             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1720  26055 HSC.NB816.55             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1721  26056 HSC.NB816.56             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1722  26057 HSC.NB816.57             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1723  26058 HSC.NB816.58             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1724  26059 HSC.NB816.59             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1725  26060 HSC.NB816.60             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1726  26061 HSC.NB816.61             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1727  26062 HSC.NB816.62             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1728  26063 HSC.NB816.63             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1729  26064 HSC.NB816.64             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1730  26065 HSC.NB816.65             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1731  26066 HSC.NB816.66             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1732  26067 HSC.NB816.67             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1733  26068 HSC.NB816.68             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1734  26069 HSC.NB816.69             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1735  26070 HSC.NB816.70             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1736  26071 HSC.NB816.71             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1737  26072 HSC.NB816.72             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1738  26073 HSC.NB816.73             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1739  26074 HSC.NB816.74             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1740  26075 HSC.NB816.75             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1741  26076 HSC.NB816.76             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1742  26077 HSC.NB816.77             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1743  26078 HSC.NB816.78             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1744  26079 HSC.NB816.79             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1745  26080 HSC.NB816.80             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1746  26081 HSC.NB816.81             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1747  26082 HSC.NB816.82             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1748  26083 HSC.NB816.83             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1749  26084 HSC.NB816.84             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1750  26085 HSC.NB816.85             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1751  26086 HSC.NB816.86             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1752  26087 HSC.NB816.87             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1753  26088 HSC.NB816.88             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1754  26089 HSC.NB816.89             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1755  26090 HSC.NB816.90             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1756  26091 HSC.NB816.91             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1757  26092 HSC.NB816.92             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1758  26093 HSC.NB816.93             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1759  26094 HSC.NB816.94             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1760  26095 HSC.NB816.95             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1761  26096 HSC.NB816.96             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1762  26097 HSC.NB816.97             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1763  26098 HSC.NB816.98             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1764  26099 HSC.NB816.99             dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1765  26100 HSC.NB816.100            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1766  26101 HSC.NB816.101            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1767  26102 HSC.NB816.102            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1768  26103 HSC.NB816.103            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1769  26104 HSC.NB816.104            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1770  26105 HSC.NB816.105            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1771  26106 HSC.NB816.106            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1772  26107 HSC.NB816.107            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1773  26108 HSC.NB816.108            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1774  26109 HSC.NB816.109            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1775  26110 HSC.NB816.110            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1776  26111 HSC.NB816.111            dep  25.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000
     1777
  • branches/czw_branch/20170908/ippconfig/hsc/Makefile.am

    r39926 r40179  
    1111        ppMerge.config \
    1212        psastro.config \
     13        psphot.config \
    1314        ppStats.config \
    1415        ppStack.config
  • branches/czw_branch/20170908/ippconfig/hsc/camera.config

    r39926 r40179  
    140140   z        STR   HSC-z
    141141   y        STR   HSC-Y
     142   NB816    STR   NB0816
    142143   NB921    STR   NB0921
    143144END
     
    153154END
    154155
    155 DVO.CAMERADIR   STR     megacam         # Camera directory for DVO
     156DVO.CAMERADIR   STR     hsc             # Camera directory for DVO
    156157
    157158# convert supplied FPA.OBSTYPE values to abstract exptype names
     
    170171RECIPES         METADATA
    171172        # Other recipes
    172 #       PSPHOT          STR     hsc/psphot.config           # psphot details
     173        PSPHOT          STR     hsc/psphot.config           # psphot details
    173174        PSASTRO         STR     hsc/psastro.config          # psastro details
    174175#       PSWARP          STR     hsc/pswarp.config               # pswarp details
  • branches/czw_branch/20170908/ippconfig/hsc/format_cmf.config

    r39926 r40179  
    194194#       FPA.POSANGLE    STR     INR-STR
    195195        FPA.POSANGLE    STR     INST-PA
     196        FPA.ROTANGLE    STR     INST-PA
    196197        FPA.RA          STR     RA
    197198        FPA.DEC         STR     DEC
  • branches/czw_branch/20170908/ippconfig/hsc/format_mef.config

    r39926 r40179  
    195195#       FPA.POSANGLE    STR     INR-STR -- this is equivalent to the GPC1 ROT, not POS
    196196        FPA.POSANGLE    STR     INST-PA
     197        FPA.ROTANGLE    STR     INST-PA
    197198        FPA.RA          STR     RA
    198199        FPA.DEC         STR     DEC
  • branches/czw_branch/20170908/ippconfig/hsc/format_raw.config

    r39926 r40179  
    194194#       FPA.POSANGLE    STR     INR-STR
    195195        FPA.POSANGLE    STR     INST-PA
     196        FPA.ROTANGLE    STR     INST-PA
    196197        FPA.RA          STR     RA
    197198        FPA.DEC         STR     DEC
  • branches/czw_branch/20170908/ippconfig/hsc/ppStack.config

    r39926 r40179  
    1111        HSC-Y       F32     0.0
    1212        NB0921      F32     0.0
     13        NB0816      F32     0.0
    1314END
    1415
     
    2223        HSC-Y       F32     30.0
    2324        NB0921      F32     30.0
     25        NB0816      F32     30.0
    2426END
    2527
  • branches/czw_branch/20170908/ippconfig/hsc/psastro.config

    r39929 r40179  
    77DVO.GETSTAR.PHOTCODE          STR      i
    88DVO.GETSTAR.MAX.RHO           F32      30000.0
    9 DVO.GETSTAR.MIN.MAG           F32      12.0
    10 DVO.GETSTAR.MIN.MAG.INST      F32     -15.0
     9DVO.GETSTAR.MIN.MAG           F32      -3.0
     10DVO.GETSTAR.MIN.MAG.INST      F32     -27.0
    1111
    1212PHOTCODE.DATA MULTI
     
    3939  ZEROPT   F32 25.1
    4040  PHOTCODE STR y
     41  GHOST_MAX_MAG                   F32 -25.0
     42END
     43PHOTCODE.DATA METADATA
     44  FILTER   STR NB816
     45  ZEROPT   F32 26.0
     46  PHOTCODE STR i
    4147  GHOST_MAX_MAG                   F32 -25.0
    4248END
     
    116122
    117123# Masking parameters
    118 # REFSTAR_MASK                  BOOL TRUE
    119 # REFSTAR_MASK_MAX_MAG          F32  -15.0
    120 # REFSTAR_MASK_SATSTAR_MAG_MAX    F32  -15.0
    121 # REFSTAR_MASK_SATSTAR_MAG_SLOPE  F32  10.15
    122 # REFSTAR_MASK_SATSTAR_POS_ZERO   F32   0.0
    123 
    124 # REFSTAR_MASK_SATSPIKE_MAG_SLOPE F32 0.5188
    125 # REFSTAR_MASK_SATSPIKE_MAG_MAX   F32 -14.644
    126 # REFSTAR_MASK_SATSPIKE_OFFSET    F32 0.0
    127 # REFSTAR_MASK_SATSPIKE_WIDTH     F32 6.0
    128 # REFSTAR_MASK_SATSPIKE_L0        F32 0
    129 # REFSTAR_MASK_SATSPIKE_WIDTH_SLOPE  F32 0.0106
     124REFSTAR_MASK                    BOOL TRUE
     125REFSTAR_MASK_MAX_MAG            F32  -15.0
     126REFSTAR_MASK_SATSTAR_MAG_MAX    F32  -15.0
     127REFSTAR_MASK_SATSTAR_MAG_SLOPE  F32   4.45 # Was 10.15
     128REFSTAR_MASK_SATSTAR_POS_ZERO   F32   -15.0
     129
     130REFSTAR_MASK_SATSPIKE_MAG_SLOPE F32 0.35
     131REFSTAR_MASK_SATSPIKE_MAG_MAX   F32 -14.5
     132REFSTAR_MASK_SATSPIKE_OFFSET    F32 0.0
     133REFSTAR_MASK_SATSPIKE_WIDTH     F32 6.0
     134REFSTAR_MASK_SATSPIKE_L0        F32 0
     135REFSTAR_MASK_SATSPIKE_WIDTH_SLOPE  F32 0.0106
     136
     137REFSTAR_MASK_BLEED              BOOL TRUE
     138
     139REFSTAR_MASK_BLEED_MAG_MAX      F32 -14.5
     140REFSTAR_MASK_BLEED_MAG_SLOPE    F32   2.0
     141
     142REFSTAR_MASK_BLEED_ORIENTATION_X BOOL FALSE
     143REFSTAR_MASK_BLEED_MAG_MAX_X    F32 -15.0
     144REFSTAR_MASK_BLEED_MAG_SLOPE_X  F32   5.0
     145
     146REFSTAR_MASK_BLEED_ORIENTATION_Y BOOL TRUE
     147REFSTAR_MASK_BLEED_MAG_MAX_Y    F32 -14.5
     148REFSTAR_MASK_BLEED_MAG_SLOPE_Y  F32   0.425
     149
     150REFSTAR_MASK_GLINTS             BOOL TRUE
     151GLINT_MAX_MAG                   F32  -19
     152GLINT_LENGTH_MAG_SLOPE          F32  0.0
     153GLINT_LENGTH_MAG_ZERO           F32  0.0
     154GLINT_WIDTH                     F32  80.0
     155
     156
     157# The slopes and radii and region below are all in FPA units, 1/13.5 of a regular pixel.
     158GLINT.REGION                    MULTI
     159GLINT.REGION                    METADATA
     160  GLINT.TYPE                    STR  HSC
     161  GLINT.PIXEL.SCALE             F32  3.49794238e-06
     162  REGION                        STR  [-350000:350000,-350000:350000]
     163  GLINT.RADIUS.INNER            F32  252435  # 0.883 degrees
     164  GLINT.RADIUS.OUTER            F32  283025  # 0.990 degrees
     165 
     166  GLINT.FILTER.TERM             MULTI
     167  GLINT.FILTER.TERM             METADATA
     168    FILTER                      STR     g
     169    @C_TERMS                    F32     -4467.9759580157  10022.1277915657  -5156.3556611527 # a comment
     170    @R_TERMS                    F32     -4375.9715493905  9717.6993803237   -5203.2424778605 # a comment
     171    FACTOR                      F32     1.002
     172    LIMIT                       F32     14.0
     173  END
     174  GLINT.FILTER.TERM             METADATA
     175    FILTER                      STR      r
     176    @C_TERMS                    F32      -4354.2575893763  9762.9766653532  -5011.1243975288 # a comment
     177    @R_TERMS                    F32      -4263.2230039887  9457.4516871365  -5057.2762518308 # a comment
     178    FACTOR                      F32      1.0015
     179    LIMIT                       F32      13.5
     180  END
     181  GLINT.FILTER.TERM             METADATA
     182    FILTER                      STR      i
     183    @C_TERMS                    F32      -4243.1837126908  9517.3512135240  -4876.3237965836 # a comment
     184    @R_TERMS                    F32      -4154.5095389959  9215.4140278639  -4924.2923196315 # a comment
     185    FACTOR                      F32     1.001
     186    LIMIT                       F32     13.5
     187  END
     188  GLINT.FILTER.TERM             METADATA
     189    FILTER                      STR      z
     190    @C_TERMS                    F32      -3966.2315539829  8920.7199277389  -4555.9567436784 # a comment
     191    @R_TERMS                    F32      -3878.4529585585  8619.7241050446  -4604.3603386145 # a comment
     192    FACTOR                      F32     0.9995
     193    LIMIT                       F32     13.0
     194  END
     195  GLINT.FILTER.TERM             METADATA
     196    FILTER                      STR      y
     197    @C_TERMS                    F32      -3723.5919271089  8403.7641770854  -4281.0159171765 # a comment
     198    @R_TERMS                    F32      -3637.0352789862  8104.8245491120  -4330.4583627761 # a comment
     199    FACTOR                      F32     1.000
     200    LIMIT                       F32     13.0
     201  END
     202  GLINT.FILTER.TERM             METADATA
     203    FILTER                      STR      NB816
     204    @C_TERMS                    F32      -4243.1837126908  9517.3512135240  -4876.3237965836 # a comment
     205    @R_TERMS                    F32      -4154.5095389959  9215.4140278639  -4924.2923196315 # a comment
     206    FACTOR                      F32     1.001
     207    LIMIT                       F32     13.5
     208  END
     209  GLINT.FILTER.TERM             METADATA
     210    FILTER                      STR      NB921
     211    @C_TERMS                    F32      -3966.2315539829  8920.7199277389  -4555.9567436784 # a comment
     212    @R_TERMS                    F32      -3878.4529585585  8619.7241050446  -4604.3603386145 # a comment
     213    FACTOR                      F32     1.0005
     214    LIMIT                       F32     12.0
     215  END
     216
     217END
     218
     219#  GLINT.RADIUS.INNER           F32  245000
     220#  GLINT.RADIUS.OUTER           F32  260000
     221
     222#  GLINT.ANGLE.INNER_SLOPE       F32  -0.0059259
     223#  GLINT.ANGLE.INNER_ZERO       F32  72
     224
     225#  GLINT.ANGLE.OUTER_SLOPE      F32 0.0088889
     226#  GLINT.ANGLE.OUTER_ZERO       F32 -41
     227
     228#   GLINT.ANGLE.INNER_SLOPE      F32  0.0
     229#   GLINT.ANGLE.INNER_ZERO       F32  7.0
     230#   GLINT.ANGLE.INNER_ZERO       F32  1.5
     231#   GLINT.ANGLE.OUTER_SLOPE      F32  0.0
     232#   GLINT.ANGLE.OUTER_ZERO       F32 22.0
     233#   GLINT.ANGLE.OUTER_ZERO       F32  6.0
     234
     235
     236
     237
     238
    130239
    131240# REFSTAR_MASK_GLINTS             BOOL  TRUE
     
    137246#   GLINT.TYPE                    STR HSC
    138247# END
     248
     249STATICSKY_CAL   METADATA
     250    REFSTAR_MASK                BOOL FALSE
     251    PSASTRO.SAVE.REFMATCH       BOOL FALSE
     252    PSASTRO.FIX.CHIPS           BOOL FALSE
     253    PSASTRO.USE.MODEL           BOOL FALSE
     254    PSASTRO.MOSAIC.MODE         BOOL FALSE
     255    DVO.GETSTAR.FIXED.ZEROPT    F32   30.0
     256        DVO.GETSTAR.MIN.MAG.INST    F32   -22.0
     257    PSASTRO.CATDIR               STR  PS1.REF.20140713
     258    ZERO.POINT.USE.MEAN                  BOOL    TRUE
     259    PSASTRO.MATCH.RADIUS.N0 F32    30
     260    PSASTRO.MATCH.RADIUS.N1 F32    20
     261    PSASTRO.MATCH.RADIUS.N2 F32    10
     262    PSASTRO.MATCH.RADIUS.N3 F32    2
     263    PSASTRO.MATCH.RADIUS.N4 F32    1
     264    PSASTRO.MATCH.FIT.NITER S32    5
     265
     266    PSASTRO.MAX.ERROR      F32      0.2  # in arcsec units, if larger than 0.2" on skycell then a problem..
     267
     268    TRANSFORM.GALAXY.SHAPE.ERRORS  BOOL T
     269END
  • branches/czw_branch/20170908/ippconfig/recipes/psastro.config

    r39926 r40179  
    154154
    155155REFSTAR_MASK_BLEED              BOOL FALSE
     156
    156157REFSTAR_MASK_BLEED_MAG_MAX      F32 -15.0
    157158REFSTAR_MASK_BLEED_MAG_SLOPE    F32   5.0
     159
     160# Additional parameters to allow for saturation bleeds to be masked in either direction.
     161REFSTAR_MASK_BLEED_ORIENTATION_X BOOL FALSE
     162REFSTAR_MASK_BLEED_MAG_MAX_X    F32 -15.0
     163REFSTAR_MASK_BLEED_MAG_SLOPE_X  F32   5.0
     164
     165REFSTAR_MASK_BLEED_ORIENTATION_Y BOOL FALSE
     166REFSTAR_MASK_BLEED_MAG_MAX_Y    F32 -15.0
     167REFSTAR_MASK_BLEED_MAG_SLOPE_Y  F32   5.0
    158168
    159169REFSTAR_MASK_GLINTS             BOOL  FALSE
  • branches/czw_branch/20170908/psModules/src/objects/Makefile.am

    r37964 r40179  
    9292        models/pmModel_EXP.c \
    9393        models/pmModel_DEV.c \
    94         models/pmModel_TRAIL.c
     94        models/pmModel_TRAIL.c \
     95        models/pmModel_HSC_V1.c
    9596
    9697pkginclude_HEADERS = \
     
    142143        models/pmModel_EXP.h \
    143144        models/pmModel_DEV.h \
    144         models/pmModel_TRAIL.h
     145        models/pmModel_TRAIL.h \
     146        models/pmModel_HSC_V1.h
    145147
    146148CLEANFILES = *~
  • branches/czw_branch/20170908/psModules/src/objects/models/fwhm.sh

    r38280 r40179  
    161161end
    162162
    163 # qgauss is like ps1_v1 with z^2.25
    164 macro find.fwhm.qgauss
     163# hsc
     164macro find.fwhm.hscv1
    165165  if ($0 != 2)
    166     echo "USAGE: find.qgauss (K)"
     166    echo "USAGE: find.fwhm (K)"
    167167    break
    168168  end
     
    180180  create z 0 50 $dz
    181181
    182   # set f = 1.0 / (1.0 + $K*z + z^2.25)
    183   # f = $K*z + z^2.25 - 1.0, find where f == 0.0
    184  
    185   set f = $K*z + z^2.25 - 1.0
    186   set dfdz = $K + 2.25*z^1.25
     182  # set f = 1.0 / (1.0 + $K*z + z^1.667)
     183  # f = $K*z + z^1.667 - 1.0, find where f == 0.0
     184 
     185  set f = $K*z + z^1.8 - 1.0
     186  set dfdz = $K + 1.8*z^0.8
    187187
    188188  #lim -n 0 z f; clear; box; plot z f
    189189  #lim -n 1 z dfdz; clear; box; plot z dfdz 
    190190
    191   $nZ0 = 0
    192   $nZ1 = 5 / $dz
     191  # these just need to bound the solution
     192  $nZ0 = 0.5 / $dz
     193  $nZ1 = 5.0 / $dz
    193194
    194195  $Zg = 0.5*(z[$nZ0] + z[$nZ1]) 
     
    206207    $dZ = $Fg / $dFdz_g
    207208
     209    # echo -no-return $Zg $Fg $dZ $dFdz_g
     210
     211    $Zg -= $dZ
     212
     213    $Zg = max ($Zg , 0)
     214    $Zg = min ($Zg , z[-2])
     215    $nZg = int($Zg / $dz)
     216   
     217    # echo ": $Zg $nZg"
     218  end
     219  # echo $Zg $Fg $dZ $dFdz_g
     220  $Zhm = $Zg
     221  $FWHM = 2*sqrt(2*$Zg)
     222
     223  fprintf "%4.2f, // %4.1f, %4.2f" $FWHM $K $Zhm
     224end
     225
     226# qgauss is like ps1_v1 with z^2.25
     227macro find.fwhm.qgauss
     228  if ($0 != 2)
     229    echo "USAGE: find.qgauss (K)"
     230    break
     231  end
     232 
     233  $K = $1
     234
     235  if ($K == 0.0)
     236    $Zhm = 1.0
     237    $FWHM = 2*sqrt(2)
     238    fprintf "%4.2f, // %4.1f, %4.2f" $FWHM $K $Zhm
     239    return
     240  end
     241
     242  $dz = 0.01
     243  create z 0 50 $dz
     244
     245  # set f = 1.0 / (1.0 + $K*z + z^2.25)
     246  # f = $K*z + z^2.25 - 1.0, find where f == 0.0
     247 
     248  set f = $K*z + z^2.25 - 1.0
     249  set dfdz = $K + 2.25*z^1.25
     250
     251  #lim -n 0 z f; clear; box; plot z f
     252  #lim -n 1 z dfdz; clear; box; plot z dfdz 
     253
     254  $nZ0 = 0
     255  $nZ1 = 5 / $dz
     256
     257  $Zg = 0.5*(z[$nZ0] + z[$nZ1]) 
     258  $nZg = int($Zg / $dz)
     259  $dZ = 1.0
     260
     261  for i 0 10
     262    # interpolate between $nZg and $nZg + 1
     263    $Fg = f[$nZg] + ($Zg - $nZg*$dz)*(f[$nZg+1] - f[$nZg])/$dz
     264    $dFdz_g = dfdz[$nZg] + ($Zg - $nZg*$dz)*(dfdz[$nZg+1] - dfdz[$nZg])/$dz
     265
     266    # $Fg = f[$nZg]
     267    # $dFdz_g = dfdz[$nZg]
     268
     269    $dZ = $Fg / $dFdz_g
     270
    208271    # echo $Zg $Fg $dZ $dFdz_g
    209272
     
    223286  if ($0 != 4)
    224287    echo "USAGE: fwhm.trend (model) (struct) (output)"
    225     echo "  model: pgauss, rgauss, ps1v1, qgauss"
     288    echo "  model: pgauss, rgauss, ps1v1, qgauss, hscv1"
    226289    break
    227290  end
     
    229292  delete fwhm_v k_v
    230293
    231   $SAVE = 0
     294  $SAVE = 1
    232295  if ($SAVE) exec rm -f $3
    233296  if ($SAVE) output $3
     
    240303  if ($SAVE) echo "# define MIN_FWHM_BIN $minK"
    241304  if ($SAVE) echo "# define N_FWHM_BIN {int(($maxK - $minK) / $delK) + 1}"
    242   if ($SAVE) echo "static float $2[] = \{"
     305#  if ($SAVE) echo "static float $2[] = \{"
    243306
    244307  for k $minK $maxK $delK -incl
     
    247310    concat $FWHM fwhm_v
    248311  end
    249   if ($SAVE) echo "\}@"
     312#  if ($SAVE) echo "\}@"
    250313  if ($SAVE) output stdout
    251314
    252   lim k_v fwhm_v; clear; box; plot k_v fwhm_v -pt 10 -sz 1.0
    253 end
    254 
     315#  lim k_v fwhm_v; clear; box; plot k_v fwhm_v -pt 10 -sz 1.0
     316end
     317
  • branches/czw_branch/20170908/psModules/src/objects/pmModelClass.c

    r36859 r40179  
    4747# include "models/pmModel_QGAUSS.h"
    4848# include "models/pmModel_PS1_V1.h"
     49# include "models/pmModel_HSC_V1.h"
    4950# include "models/pmModel_RGAUSS.h"
    5051# include "models/pmModel_SERSIC.h"
     
    6364    {"PS_MODEL_DEV",          7, 1, (pmModelFunc)pmModelFunc_DEV,     (pmModelFlux)pmModelFlux_DEV,     (pmModelRadius)pmModelRadius_DEV,     (pmModelSetFWHM)pmModelSetFWHM_DEV,     (pmModelLimits)pmModelLimits_DEV,     (pmModelGuessFunc)pmModelGuess_DEV,    (pmModelFromPSFFunc)pmModelFromPSF_DEV,    (pmModelParamsFromPSF)pmModelParamsFromPSF_DEV,    (pmModelFitStatusFunc)pmModelFitStatus_DEV,    (pmModelSetLimitsFunc)pmModelSetLimits_DEV    },
    6465    {"PS_MODEL_TRAIL",        7, 0, (pmModelFunc)pmModelFunc_TRAIL,   (pmModelFlux)pmModelFlux_TRAIL,   (pmModelRadius)pmModelRadius_TRAIL,   (pmModelSetFWHM)pmModelSetFWHM_TRAIL,   (pmModelLimits)pmModelLimits_TRAIL,   (pmModelGuessFunc)pmModelGuess_TRAIL,  (pmModelFromPSFFunc)pmModelFromPSF_TRAIL,  (pmModelParamsFromPSF)pmModelParamsFromPSF_TRAIL,  (pmModelFitStatusFunc)pmModelFitStatus_TRAIL,  (pmModelSetLimitsFunc)pmModelSetLimits_TRAIL  },
     66    {"PS_MODEL_HSC_V1",       8, 0, (pmModelFunc)pmModelFunc_HSC_V1,  (pmModelFlux)pmModelFlux_HSC_V1,  (pmModelRadius)pmModelRadius_HSC_V1,  (pmModelSetFWHM)pmModelSetFWHM_HSC_V1,  (pmModelLimits)pmModelLimits_HSC_V1,  (pmModelGuessFunc)pmModelGuess_HSC_V1, (pmModelFromPSFFunc)pmModelFromPSF_HSC_V1, (pmModelParamsFromPSF)pmModelParamsFromPSF_HSC_V1, (pmModelFitStatusFunc)pmModelFitStatus_HSC_V1, (pmModelSetLimitsFunc)pmModelSetLimits_HSC_V1 },
    6567};
    6668
  • branches/czw_branch/20170908/psModules/src/objects/pmSourceOutputs.c

    r38038 r40179  
    135135                outputs->psfCore = PAR[PM_PAR_7];
    136136            }
     137            if (model->type == pmModelClassGetType ("PS_MODEL_HSC_V1")) {
     138                outputs->psfCore = PAR[PM_PAR_7];
     139            }
    137140
    138141            outputs->psfMajorFWHM = model->class->modelSetFWHM(model->params, axes.major);
  • branches/czw_branch/20170908/psastro/src/psastroLoadGhosts.c

    r33859 r40179  
    4040 * calculate ghost FPA and Chip positions for the stars loaded on the FPA
    4141 */
     42
     43                   
     44
    4245bool psastroLoadGhosts (pmConfig *config) {
    4346
     
    256259    return false;
    257260}
     261
     262
     263 
     264bool psastroLoadGhostsHSC (pmConfig *config) {
     265  bool status;
     266    pmChip *chip = NULL;
     267    pmCell *cell = NULL;
     268    pmReadout *readout = NULL;
     269    float zeropt, exptime, MAX_MAG;
     270    psMetadata *ghostModel = NULL;
     271    psVector *C_terms;
     272    psVector *R_terms;
     273    float glintPixelScale;
     274   
     275    psLogMsg ("psastro", PS_LOG_INFO, "determine ghost positions");
     276
     277    // select the current recipe
     278    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
     279    if (!recipe) {
     280        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe");
     281        return false;
     282    }
     283
     284    bool REFSTAR_MASK_GHOST = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK_GHOST");
     285    if (!REFSTAR_MASK_GHOST) return true;
     286
     287    // Load model from file
     288    char *ghostFile = psMetadataLookupStr (&status, recipe, "GHOST_MODEL");
     289    if (!strcasecmp(ghostFile, "NONE")) return true;
     290
     291    if (!pmConfigFileRead (&ghostModel, ghostFile, "GHOST MODEL")) {
     292        psError(PSASTRO_ERR_CONFIG, true, "Trouble loading ghost model");
     293        return false;
     294    }
     295
     296    // Allocate FPA and refstars
     297    pmFPAview *view = pmFPAviewAlloc (0);
     298    // select the input astrometry data (also carries the refstars)
     299    pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     300    if (!astrom) {
     301        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");
     302        goto escape;
     303    }
     304    pmFPA *fpa = astrom->fpa;
     305
     306    char *filter = psMetadataLookupStr (&status, fpa->concepts, "FPA.FILTERID");
     307    psMetadataItem *item = psMetadataLookup(glintItem->data.md, "GLINT.FILTER.TERM");
     308    if (!item) {
     309      psLogMsg ("psastro", PS_LOG_INFO, "GLINT.FILTER.TERM data missing");
     310      return false;
     311    }
     312    if (item->type != PS_DATA_METADATA_MULTI) {
     313      psLogMsg ("psastro", PS_LOG_INFO, "GLINT.FILTER.TERM not multi");
     314      return false;
     315    }
     316    psListIterator *iter = psListIteratorAlloc(item->data.list,PS_LIST_HEAD, false);
     317    psMetadataItem *refItem = NULL;
     318    while ((refItem = psListGetAndIncrement(iter))) {
     319      if (refItem->type != PS_DATA_METADATA) {
     320        psLogMsg ("psastro", PS_LOG_INFO, "GLINT.FILTER.TERM entry not metadata");
     321        return false;
     322      }
     323      char *refFilter = psMetadataLookupStr (&status, refItem->data.md, "FILTER");
     324      if (!status) {
     325        // psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER");
     326        continue;
     327      }
     328      if (strcmp(refFilter, filter)) continue;
     329
     330      C_terms = psMetadataLookupPtr(&status, refItem->data.md, "C_TERMS");
     331      R_terms = psMetadataLookupPtr(&status, refItem->data.md, "R_TERMS");
     332      MAX_MAG = psMetadataLookupF32(&status, refItem->data.md, "LIMIT");
     333      glintPixelScale = psMetadataLookupF32(&status, refItem->data.md, "SCALE");
     334    }
     335
     336    // really error-out here?  or just skip?
     337    //    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa, recipe)) {
     338    //        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
     339    //  goto escape;
     340    //    }
     341   
     342    // recipe values are given in instrumental magnitudes
     343    // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime)
     344    //    float MagOffset = zeropt + 2.5*log10(exptime);
     345    //    MAX_MAG += MagOffset;
     346
     347    // this loop selects the matched stars for all chips
     348    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
     349        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     350        if (!chip->process || !chip->file_exists) { continue; }
     351        if (!chip->fromFPA) { continue; }
     352
     353        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
     354            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     355            if (!cell->process || !cell->file_exists) { continue; }
     356
     357            // process each of the readouts
     358            while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
     359                if (! readout->data_exists) { continue; }
     360
     361                // select the raw objects for this readout (loaded in psastroChooseRefstars.c)
     362                // XXX : note that we place limits on the refstar sample in psastroChooseRefstars.c:
     363                // 1) on chip and 2) < PSASTRO.MAX.NREF. magnitude limits and clump exclusion are only
     364                psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS");
     365                if (refstars == NULL) { continue; }
     366
     367                // identify the bright stars of interest
     368                for (int i = 0; i < refstars->n; i++) {
     369                    pmAstromObj *ref = refstars->data[i];
     370                    psTrace("psastro.ghost",5,"Begin ghost %d/%ld: MAX_MAG: %g; ref_mag: %g @ (%.10g,%.10g) TPA: (%f %f)",
     371                            i,refstars->n,MAX_MAG,ref->Mag,ref->sky->r * 180 / M_PI,ref->sky->d * 180.0 / M_PI,ref->TP->x,ref->RP->y);
     372                    if (ref->Mag > MAX_MAG) continue;
     373                   
     374                    psastroGhost *ghost = psastroGhostAlloc ();
     375
     376                    double R_TPA  = sqrt(pow(star->TP->y,2) + pow(star->TP->x,2));
     377                    double theta0 = atan2(star->TP->y,star->TP->x);
     378                    double star_radius_deg = R_TPA * glintPixelScale;
     379                    if (star_radius_deg > 0.5) { continue; }
     380
     381                    // Calculate expected position.
     382                    double C = C_terms->data.F32[0] + C_terms->data.F32[1] * star_radius_deg + C_terms->data.F32[2] * pow(star_radius_deg,2) +
     383                      C_terms->data.F32[3] * pow(star_radius_deg,3) + C_terms->data.F32[4] * pow(star_radius_deg,4) +
     384                      C_terms->data.F32[5] * pow(star_radius_deg,5) + C_terms->data.F32[6] * pow(star_radius_deg,6) +
     385                      C_terms->data.F32[7] * pow(star_radius_deg,7);
     386                    double R = R_terms->data.F32[0] + R_terms->data.F32[1] * star_radius_deg + R_terms->data.F32[2] * pow(star_radius_deg,2) +
     387                      R_terms->data.F32[3] * pow(star_radius_deg,3) + R_terms->data.F32[4] * pow(star_radius_deg,4) +
     388                      R_terms->data.F32[5] * pow(star_radius_deg,5) + R_terms->data.F32[6] * pow(star_radius_deg,6) +
     389                      R_terms->data.F32[7] * pow(star_radius_deg,7);
     390                    R = 13.5 * (R / 0.015); // Convert to TPA units.
     391
     392                    psPlane *fp = psPlaneAlloc();
     393                    psPlane *tp = psPlaneAlloc();
     394
     395                    tp->x = 13.5 * (C * cos(theta0) / 0.015 + 12.78);
     396                    tp->y = 13.5 * (C * sin(theta0) / 0.015 + 57.74);
     397                    psPlaneTransformApply(fp,fpa->fromTPA, tp);
     398                   
     399                    ghost->srcFP->x = ref->FP->x;
     400                    ghost->srcFP->y = ref->FP->y;
     401                    ghost->FP->x    = fp->x;
     402                    ghost->FP->y    = fp->y;
     403
     404                    ghost->inner.major = 0.0;
     405                    ghost->inner.minor = 0.0;
     406                    ghost->outer.major = R;
     407                    ghost->outer.minor = R;
     408                   
     409                    pmChip *ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
     410                   
     411
     412                   
     413                    if (ghostChip) {
     414                      psTrace("psastro.ghost",5,"   in ghost: %d/%ld: ref: (%f,%f) or (%s) ghost: (%f,%f) or (%f,%f,%s) %f inner: (%f,%f,%f) outer: (%f,%f,%f)",
     415                              i,refstars->n,
     416                              ref->FP->x,ref->FP->y,
     417                              psMetadataLookupStr(NULL,chip->concepts,"CHIP.NAME"),
     418                              ghost->FP->x,ghost->FP->y,
     419                              ghost->chip->x,ghost->chip->y,psMetadataLookupStr(NULL,ghostChip->concepts,"CHIP.NAME"),
     420                              rSrc,
     421                              ghost->inner.major,ghost->inner.minor,ghost->inner.theta,
     422                              ghost->outer.major,ghost->outer.minor,ghost->outer.theta);
     423/*                    psWarning("   GHOST_DATA: %d/%ld: ref: (%f,%f) or (%f,%f,%s) ghost: (%f,%f) or (%f,%f,%s) %f inner: (%f,%f,%f) outer: (%f,%f,%f)", */
     424/*                            i,refstars->n, */
     425/*                            ref->FP->x,ref->FP->y, */
     426/*                            ref_chip_x,ref_chip_y,psMetadataLookupStr(NULL,chip->concepts,"CHIP.NAME"), */
     427/*                            ghost->FP->x,ghost->FP->y, */
     428/*                            ghost->chip->x,ghost->chip->y,psMetadataLookupStr(NULL,ghostChip->concepts,"CHIP.NAME"), */
     429/*                            rSrc, */
     430/*                            ghost->inner.major,ghost->inner.minor,ghost->inner.theta, */
     431/*                            ghost->outer.major,ghost->outer.minor,ghost->outer.theta); */
     432                    }
     433                    else {
     434                      psTrace("psastro.ghost",5,"   in ghost: %d/%ld: ref: (%f,%f) ghost: (%f,%f) or (%f,%f,%s) inner: (%f,%f,%f) outer: (%f,%f,%f)",
     435                              i,refstars->n,
     436                              ref->FP->x,ref->FP->y,
     437                              ghost->FP->x,ghost->FP->y,
     438                              ghost->chip->x,ghost->chip->y,"NONE",
     439                              ghost->inner.major,ghost->inner.minor,ghost->inner.theta,
     440                              ghost->outer.major,ghost->outer.minor,ghost->outer.theta);
     441                    }                 
     442                     
     443
     444                           
     445                    if (!ghostChip) goto skip;
     446                    if (!ghostChip->cells) goto skip;
     447                    if (!ghostChip->cells->n) goto skip;
     448
     449                   
     450                    pmCell *ghostCell = ghostChip->cells->data[0];
     451                    if (!ghostCell) goto skip;
     452                    if (!ghostCell->readouts) goto skip;
     453                    if (!ghostCell->readouts->n) goto skip;
     454                    pmReadout *ghostReadout = ghostCell->readouts->data[0];
     455                    if (!ghostReadout) goto skip;
     456
     457                    psArray *ghosts = psMetadataLookupPtr (&status, ghostReadout->analysis, "PSASTRO.GHOSTS");
     458                    if (ghosts == NULL) {
     459                        ghosts = psArrayAllocEmpty (100);
     460                        if (!psMetadataAdd (ghostReadout->analysis, PS_LIST_TAIL, "PSASTRO.GHOSTS", PS_DATA_ARRAY, "astrometry matches", ghosts)) {
     461                          psError(PSASTRO_ERR_CONFIG, false, "failure to add ghosts to readout");
     462                          goto escape;
     463                        }
     464                        psFree (ghosts);
     465                    }
     466
     467                    psArrayAdd (ghosts, 100, ghost);
     468
     469                skip:
     470                   
     471                    psFree (ghost);
     472                }
     473            }
     474        }
     475    }
     476
     477    psastroExtractFreeChipBounds();
     478
     479    psFree (C_terms);
     480    psFree (R_terms);
     481    psFree (ghostModel);
     482    psFree (view);
     483    return true;
     484
     485escape:
     486    psFree (C_terms);
     487    psFree (R_terms);
     488    psFree (ghostModel);
     489    psFree (view);
     490    return false;
     491}
  • branches/czw_branch/20170908/psastro/src/psastroLoadGlints.c

    r24645 r40179  
    4444    double GLINT_LENGTH_MAG_ZERO = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_ZERO");
    4545    double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH");
     46    double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE");
     47   
    4648
    4749    // select the set of glint regions (GLINT.REGION is a MULTI of METADATA items)
     
    9597        psProject (star->TP, star->sky, fpa->toSky);
    9698        psPlaneTransformApply (star->FP, fpa->fromTPA, star->TP);
    97         fprintf (stderr, "glint: %7.2f @ %8.1f, %8.1f\n", star->Mag, star->FP->x, star->FP->y);
     99        fprintf (stderr, "glint: %7.2f @ %8.1f, %8.1f (%f %f) %8.1f %8.1f\n", star->Mag, star->FP->x, star->FP->y, star->sky->r * PS_DEG_RAD, star->sky->d * PS_DEG_RAD, star->TP->x,star->TP->y);
    98100
    99101        // find the GLINT.REGION this star lands in (if any)
     
    298300                }
    299301            }
     302            if (!strcasecmp(glintType, "HSC")) {
     303              // It's inefficient to keep looking these up.
     304              double GLINT_RADIUS_INNER = psMetadataLookupF32(&status, glintItem->data.md, "GLINT.RADIUS.INNER");
     305              double GLINT_RADIUS_OUTER = psMetadataLookupF32(&status, glintItem->data.md, "GLINT.RADIUS.OUTER");
     306             
     307              //              double R_FPA = sqrt(pow(star->FP->y,2) + pow(star->FP->x,2));
     308              double R_FPA = sqrt(pow(star->TP->y,2) + pow(star->TP->x,2));
     309              //              R_FPA *= 1.30;
     310              if (R_FPA < GLINT_RADIUS_INNER) { continue; }
     311              if (R_FPA > GLINT_RADIUS_OUTER) { continue; }
     312              psTrace("psastro.masks",4,"HSC_GLINT_STARS: %f %f %f\n",
     313                      //                      star->FP->x,star->FP->y,star->Mag);
     314                      star->TP->x,star->TP->y,star->Mag);
     315              psVector *C_terms;
     316              psVector *R_terms;
     317              double scale_factor = 1.0;
     318             
     319              char *filter = psMetadataLookupStr (&status, fpa->concepts, "FPA.FILTERID");
     320              psMetadataItem *item = psMetadataLookup(glintItem->data.md, "GLINT.FILTER.TERM");
     321              if (!item) {
     322                psLogMsg ("psastro", PS_LOG_INFO, "GLINT.FILTER.TERM data missing");
     323                return false;
     324              }
     325              if (item->type != PS_DATA_METADATA_MULTI) {
     326                psLogMsg ("psastro", PS_LOG_INFO, "GLINT.FILTER.TERM not multi");
     327                return false;
     328              }
     329              psListIterator *iter = psListIteratorAlloc(item->data.list,PS_LIST_HEAD, false);
     330              psMetadataItem *refItem = NULL;
     331              while ((refItem = psListGetAndIncrement(iter))) {
     332                if (refItem->type != PS_DATA_METADATA) {
     333                  psLogMsg ("psastro", PS_LOG_INFO, "GLINT.FILTER.TERM entry not metadata");
     334                  return false;
     335                }
     336                char *refFilter = psMetadataLookupStr (&status, refItem->data.md, "FILTER");
     337                if (!status) {
     338                  // psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER");
     339                  continue;
     340                }
     341                if (strcmp(refFilter, filter)) continue;
     342
     343                C_terms = psMetadataLookupPtr(&status, refItem->data.md, "C_TERMS");
     344                R_terms = psMetadataLookupPtr(&status, refItem->data.md, "R_TERMS");
     345                scale_factor = psMetadataLookupF32(&status, refItem->data.md, "FACTOR");
     346                double limit = psMetadataLookupF32(&status, refItem->data.md, "LIMIT");
     347                if (star->Mag > limit) { continue; }
     348              }
     349              // check
     350              double glintPixelScale = psMetadataLookupF32(&status, glintItem->data.md, "GLINT.PIXEL.SCALE");
     351              //              psMetadata *GLINT_PARAMETER_SET = psMetadataLookupPtr(&status, glintItem->data.md, "GLINT.FILTER.TERM");
     352              //              psMetadata *GLINT_PARAMETERS    = psMetadataLookupPtr(&status, GLINT_PARAMETER_SET, filter);
     353             
     354
     355              //              double theta0 = atan2(star->FP->y,star->FP->x);
     356              double theta0 = atan2(star->TP->y,star->TP->x);
     357              double star_radius_deg = R_FPA * glintPixelScale;
     358
     359              double C = C_terms->data.F32[0] + C_terms->data.F32[1] * star_radius_deg + C_terms->data.F32[2] * pow(star_radius_deg,2);
     360              double R = R_terms->data.F32[0] + R_terms->data.F32[1] * star_radius_deg + R_terms->data.F32[2] * pow(star_radius_deg,2);
     361
     362              double inner_edge_angle, outer_edge_angle;
     363              if (star_radius_deg < 0.8831) {
     364                outer_edge_angle = 0.0;
     365              }
     366              else if (star_radius_deg < 0.9368) {
     367                outer_edge_angle = 46.2985 * sqrt(star_radius_deg - 0.8831);
     368              }
     369              else {
     370                outer_edge_angle = -2.67 + 14.3 * star_radius_deg;
     371              }
     372              if (star_radius_deg < 0.964) {
     373                inner_edge_angle = -243.866 * pow(star_radius_deg - 0.932,2) + 2.4636;
     374              }
     375              else {
     376                inner_edge_angle = 66.2061 * sqrt(star_radius_deg - 0.9635);
     377              }
     378
     379              inner_edge_angle = inner_edge_angle * PS_RAD_DEG;
     380              outer_edge_angle = outer_edge_angle * PS_RAD_DEG;
     381             
     382              // These define the ends of a single arc in arc-centric coordinates
     383              double x1 = C - R * cos(inner_edge_angle);
     384              double y1 = R * sin(inner_edge_angle);
     385              double x2 = C - R * cos(outer_edge_angle);
     386              double y2 = R * sin(outer_edge_angle);
     387
     388              // Create the endpoints for the pair of arcs in device coordinates (in millimeters)
     389              double theta1 = theta0 + M_PI / 2.0;
     390              double x1s = (x1 * cos(theta1) - y1 * sin(theta1)) * scale_factor;
     391              double y1s = (y1 * cos(theta1) + x1 * sin(theta1)) * scale_factor;
     392              double x1e = (x2 * cos(theta1) - y2 * sin(theta1)) * scale_factor;
     393              double y1e = (y2 * cos(theta1) + x2 * sin(theta1)) * scale_factor;
     394             
     395              double x2s = (x1 * cos(theta1) + y1 * sin(theta1)) * scale_factor;
     396              double y2s = (-1.0 * y1 * cos(theta1) + x1 * sin(theta1)) * scale_factor;
     397              double x2e = (x2 * cos(theta1) + y2 * sin(theta1)) * scale_factor;
     398              double y2e = (-1.0 * y2 * cos(theta1) + x2 * sin(theta1)) * scale_factor;
     399
     400              psVector *x_start = psVectorAlloc(4,PS_TYPE_F32);
     401              psVector *y_start = psVectorAlloc(4,PS_TYPE_F32);
     402              psVector *x_end   = psVectorAlloc(4,PS_TYPE_F32);
     403              psVector *y_end   = psVectorAlloc(4,PS_TYPE_F32);
     404                     
     405              // CZW: I know this looks like a typo, but trust me, it's not a typo.
     406              psPlane *fp = psPlaneAlloc();
     407              psPlane *tp = psPlaneAlloc();
     408
     409              fprintf(stderr,"HSC GLINT: x1x2(%f %f) (%f %f) x1sx1e (%f %f %f %f) x2sx2e (%f %f %f %f)\n",
     410                      x1,y1,x2,y2,
     411                      x1s,y1s,x1e,y1e,
     412                      x2s,y2s,x2e,y2e);
     413                     
     414             
     415              tp->x = 13.5 * (y1s / 0.015 + 12.78);
     416              tp->y = 13.5 * (x1s / -0.015 + 57.74);
     417              psPlaneTransformApply(fp,fpa->fromTPA, tp);
     418              x_start->data.F32[0] = fp->x;
     419              y_start->data.F32[0] = fp->y;
     420              x_start->data.F32[0] = tp->x;
     421              y_start->data.F32[0] = tp->y;
     422
     423              tp->x = 13.5 * (y1e / 0.015 + 12.78);
     424              tp->y = 13.5 * (x1e / -0.015 + 57.74);
     425              psPlaneTransformApply(fp,fpa->fromTPA, tp);
     426              x_end->data.F32[0]   = fp->x;
     427              y_end->data.F32[0]   = fp->y;
     428              x_end->data.F32[0]   = tp->x;
     429              y_end->data.F32[0]   = tp->y;
     430
     431              x_start->data.F32[1] = x_end->data.F32[0]; 
     432              y_start->data.F32[1] = y_end->data.F32[0]; 
     433              x_end->data.F32[1]   = x_start->data.F32[0];
     434              y_end->data.F32[1]   = y_start->data.F32[0];
     435
     436              tp->x = 13.5 * (y2s / 0.015 + 12.78);
     437              tp->y = 13.5 * (x2s / -0.015 + 57.74);
     438              psPlaneTransformApply(fp,fpa->fromTPA, tp);
     439              x_start->data.F32[2] = fp->x;
     440              y_start->data.F32[2] = fp->y;
     441              x_start->data.F32[2] = tp->x;
     442              y_start->data.F32[2] = tp->y;
     443
     444              tp->x = 13.5 * (y2e / 0.015 + 12.78);
     445              tp->y = 13.5 * (x2e / -0.015 + 57.74);
     446              psPlaneTransformApply(fp,fpa->fromTPA, tp);
     447              x_end->data.F32[2]   = fp->x;
     448              y_end->data.F32[2]   = fp->y;
     449              x_end->data.F32[2]   = tp->x;
     450              y_end->data.F32[2]   = tp->y;
     451             
     452              x_start->data.F32[3] = x_end->data.F32[2]; 
     453              y_start->data.F32[3] = y_end->data.F32[2]; 
     454              x_end->data.F32[3]   = x_start->data.F32[2];
     455              y_end->data.F32[3]   = y_start->data.F32[2];
     456
     457              psFree(fp);
     458              psFree(tp);
     459             
     460              for (int glint_point = 0; glint_point < 4; glint_point++) {
     461                for (int nChip = 0; nChip < fpa->chips->n; nChip++) {
     462                  pmChip *chip = fpa->chips->data[nChip];
     463                  if (!chip) continue;
     464                 
     465                  if (!psastroFindChipInYrange (fpa, nChip, x_start->data.F32[glint_point], y_start->data.F32[glint_point])) {
     466                    continue;
     467                  }
     468                  if (!psastroFindChipInXrange (fpa, nChip, x_start->data.F32[glint_point], y_start->data.F32[glint_point])) {
     469                    continue;
     470                  }
     471
     472                  double xChip0, yChip0, xChip1, yChip1, chip_angle, glint_length;
     473                  psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, x_start->data.F32[glint_point], y_start->data.F32[glint_point]);
     474                  psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, x_end->data.F32[glint_point], y_end->data.F32[glint_point]);
     475
     476                  chip_angle = atan2(yChip1 - yChip0, xChip1 - xChip0);
     477                  glint_length = sqrt(pow(yChip1 - yChip0,2) + pow(xChip1 - xChip0,2));
     478
     479                  // select the 0th readout of the 0th cell for this chip
     480                  if (!chip->cells) continue;
     481                  if (!chip->cells->n) continue;
     482                  pmCell *glintCell = chip->cells->data[0];
     483                  if (!glintCell) continue;
     484                  if (!glintCell->readouts) continue;
     485                  if (!glintCell->readouts->n) continue;
     486                  pmReadout *glintReadout = glintCell->readouts->data[0];
     487                  if (!glintReadout) continue;
     488                 
     489                  // save the glints on the readout->analysis metadata, creating if needed
     490                  psArray *glints = psMetadataLookupPtr (&status, glintReadout->analysis, "PSASTRO.GLINTS.HSC");
     491                  if (glints == NULL) {
     492                    glints = psArrayAllocEmpty (100);
     493                    if (!psMetadataAdd (glintReadout->analysis, PS_LIST_TAIL, "PSASTRO.GLINTS.HSC", PS_DATA_ARRAY, "astrometry matches", glints)) {
     494                      psWarning("failure to add glints to readout");
     495                      psFree (glints);
     496                      continue;
     497                  }
     498                    psFree (glints);
     499                  }
     500                 
     501                  fprintf (stderr, "glint %s : %d %f,%f to %f,%f (%f %f %f)\n", glintType, nChip, xChip0, yChip0, xChip1, yChip1, glint_length, glintWidth, chip_angle);
     502                  psTrace("psastro.masks",4,"HSC_GLINT: Star: %f %f Glint CR %f %f Parameters: %f %f %f Ends: %f %f -> %f %f Chip: %f %f -> %f %f @ %s %f\n",
     503                          star->FP->x,star->FP->y,
     504                          C,R,
     505                          inner_edge_angle,outer_edge_angle,theta0,
     506                          x_start->data.F32[glint_point],y_start->data.F32[glint_point],x_end->data.F32[glint_point],y_end->data.F32[glint_point],
     507                          xChip0,yChip0,xChip1,yChip1,
     508                          psMetadataLookupStr(&status,glintReadout->parent->parent->concepts,"CHIP.NAME"),chip_angle);
     509                  psVector *glint = psVectorAlloc(5,PS_TYPE_F32);
     510                  glint->data.F32[0] = xChip0;
     511                  glint->data.F32[1] = yChip0;
     512                  glint->data.F32[2] = glint_length * pixelScale / pixelScale;
     513                  glint->data.F32[3] = glintWidth;
     514                  glint->data.F32[4] = chip_angle;
     515
     516                  psArrayAdd (glints, 100, glint);
     517
     518                  psFree (glint);
     519                } // End loop over chips
     520              } // End loop over glint endpoints
     521
     522              psFree(x_start);
     523              psFree(x_end);
     524              psFree(y_start);
     525              psFree(y_end);
     526            } // End HSC glint block
     527           
    300528        }
    301529    }
  • branches/czw_branch/20170908/psastro/src/psastroMaskUpdates.c

    r33851 r40179  
    129129   
    130130    bool REFSTAR_MASK_BLEED                = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK_BLEED");
    131 
     131    bool REFSTAR_MASK_BLEED_ORIENTATION_X  = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK_BLEED_ORIENTATION_X");
     132    bool REFSTAR_MASK_BLEED_ORIENTATION_Y  = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK_BLEED_ORIENTATION_Y");
     133
     134   
    132135    double REFSTAR_MASK_MAX_MAG            = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_MAX_MAG");
    133136    double REFSTAR_MASK_SATSTAR_MAG_SLOPE  = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_SATSTAR_MAG_SLOPE");
     
    143146    double REFSTAR_MASK_BLEED_MAG_SLOPE    = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_SLOPE");
    144147
     148    double REFSTAR_MASK_BLEED_MAG_MAX_X    = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_MAX_X");
     149    double REFSTAR_MASK_BLEED_MAG_SLOPE_X  = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_SLOPE_X");
     150    double REFSTAR_MASK_BLEED_MAG_MAX_Y    = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_MAX_Y");
     151    double REFSTAR_MASK_BLEED_MAG_SLOPE_Y  = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_SLOPE_Y");
     152
    145153    double REFSTAR_MASK_CROSSTALK_MAG_MAX  = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_MAX");
    146154    double REFSTAR_MASK_CROSSTALK_MAG_SLOPE= psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_SLOPE");
     
    180188    }
    181189
     190    psTrace("psastro.masks",2,"Configuration loaded for masking.");
     191   
    182192    // recipe values are given in instrumental magnitudes
    183193    // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime)
     
    187197    REFSTAR_MASK_SATSPIKE_MAG_MAX += MagOffset;
    188198    REFSTAR_MASK_BLEED_MAG_MAX += MagOffset;
     199    REFSTAR_MASK_BLEED_MAG_MAX_X += MagOffset;
     200    REFSTAR_MASK_BLEED_MAG_MAX_Y += MagOffset;
     201   
    189202    GHOST_MAX_MAG += MagOffset;
    190203
     204    psTrace("psastro.masks",2,"Magnitudes: max_mag: %f satstar: %f satspike: %f bleed: %f ghost %f\n",
     205            REFSTAR_MASK_MAX_MAG,REFSTAR_MASK_SATSTAR_MAG_MAX,REFSTAR_MASK_SATSPIKE_MAG_MAX,REFSTAR_MASK_BLEED_MAG_MAX,GHOST_MAX_MAG);
     206   
    191207    // select the output mask image :: we mosaic to chip mosaic format
    192208    pmFPAfile *outMask = psMetadataLookupPtr (NULL, config->files, "PSASTRO.OUTPUT.MASK");
     
    287303                if (!refstars) continue;
    288304
     305                psTrace("psastro.masks",2,"In Readout loop.");
    289306                // we need to generate the following masks regions:
    290307                // 1) circle around the saturated stars (scaled by magnitude)
     
    301318                        }
    302319                    }
    303 
     320                    psTrace("psastro.masks",4,"In refstar loop: %d/%ld %f %f\n",
     321                            i,refstars->n,ref->Mag,REFSTAR_MASK_MAX_MAG);
    304322                    if (ref->Mag > REFSTAR_MASK_MAX_MAG) continue;
    305323
     
    334352
    335353                        // The length should also be a function of the image background level
    336 
     354                        psTrace("psastro.masks",4,"Masking: Radius: %f Theta: %f Length: %f Width: %f\n",
     355                                radius,Theta,spikeLength,spikeWidth);
     356                        psTrace("psastro.masks",4,"Also: %f %f %f %f\n",ref->chip->x,ref->chip->y,ROTANGLE,REFSTAR_MASK_SATSTAR_POS_ZERO);
    337357                        psastroMaskBox (readoutMask->mask, spikeMaskValue, ref->chip->x, ref->chip->y, spikeLength, spikeWidth, Theta);
    338358                    }
     
    349369                            float xCell = 0.0;
    350370                            float yCell = 0.0;
    351                             float xEnd = 0.0;
    352                             float yEnd = 0.0;
     371                            float xStart = 0.0;
     372                            float xEnd   = 0.0;
     373                            float yStart = 0.0;
     374                            float yEnd   = 0.0;
     375                            //                            float xEnd = 0.0;
     376                            //                            float yEnd = 0.0;
     377                            float width = 0.0;
     378                            float length = 0.0;
    353379                            // find coordinate of star on cell
    354380                            pmCellCoordsForChip (&xCell, &yCell, refCell, ref->chip->x, ref->chip->y);
    355381                            // find coordinate of end-point on chip
    356382
    357                             int ySize = psMetadataLookupS32(NULL, refCell->concepts, "CELL.YSIZE");
    358                             pmChipCoordsForCell (&xEnd, &yEnd, refCell, xCell, ySize);
    359 
    360                             float width = REFSTAR_MASK_BLEED_MAG_SLOPE*(REFSTAR_MASK_BLEED_MAG_MAX - ref->Mag);
    361                             psastroMaskRectangle (readoutMask->mask, spikeMaskValue, (int) ref->chip->x-0.5*width, (int) ref->chip->y, (int) ref->chip->x+0.5*width+1, yEnd);
     383                            if (REFSTAR_MASK_BLEED_ORIENTATION_X) {
     384                              length = pow(10,REFSTAR_MASK_BLEED_MAG_SLOPE_X*(REFSTAR_MASK_BLEED_MAG_MAX_X - ref->Mag));
     385                              width  = REFSTAR_MASK_BLEED_MAG_SLOPE  *(REFSTAR_MASK_BLEED_MAG_MAX - ref->Mag);
     386
     387                              pmChipCoordsForCell (&xStart, &yStart, refCell, xCell - length, yCell - 0.5 * width);
     388                              pmChipCoordsForCell (&xEnd, &yEnd,     refCell, xCell + length, yCell + 0.5 * width);
     389                              psastroMaskRectangle (readoutMask->mask, spikeMaskValue, (int) xStart, (int) yStart, (int) xEnd, (int) yEnd + 1);
     390                            }
     391                            if (REFSTAR_MASK_BLEED_ORIENTATION_Y) {
     392                              length = pow(10,REFSTAR_MASK_BLEED_MAG_SLOPE_Y*(REFSTAR_MASK_BLEED_MAG_MAX_Y - ref->Mag));
     393                              width  = REFSTAR_MASK_BLEED_MAG_SLOPE  *(REFSTAR_MASK_BLEED_MAG_MAX - ref->Mag);
     394
     395                              pmChipCoordsForCell (&xStart, &yStart, refCell, xCell - 0.5 * width, yCell - length);
     396                              pmChipCoordsForCell (&xEnd, &yEnd,     refCell, xCell + 0.5 * width, yCell + length);
     397                              psastroMaskRectangle (readoutMask->mask, spikeMaskValue, (int) xStart, (int) yStart, (int) xEnd + 1, (int) yEnd);
     398                            }
     399                           
    362400                        }
    363401                    }
     
    392430                    }
    393431                }
    394 
     432                // Because it's very GPC1-specific, handle alternate glint types here
     433                psArray *hsc_glints = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.GLINTS.HSC");
     434                if (hsc_glints) {
     435                  for (int i = 0; i < hsc_glints->n; i++) {
     436                    // Contains (start_x, start_y, length, width, theta)
     437                    psVector *glint = hsc_glints->data[i];
     438
     439                    psTrace("psastro.masks", 4, "Masking glint %d on chip %s with params (%f,%f,%f,%f,%f)\n",
     440                            i, psMetadataLookupStr(&status,readout->parent->parent->concepts,"CHIP.NAME"),
     441                            glint->data.F32[0], glint->data.F32[1],
     442                            glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]);
     443
     444                    psastroMaskBox (readoutMask->mask, glintMaskValue, glint->data.F32[0], glint->data.F32[1],
     445                                    glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]);
     446                  }
     447                }
     448               
    395449                // Select the crosstalk artifact regions for this readout, and mask a circular region
    396450                // corresponding to the source star
Note: See TracChangeset for help on using the changeset viewer.