Coverage for tests/test_applyLookupTable.py : 96%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # Copyright 2017 LSST Corporation. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. #
"""!Reference implementation of applyLookupTable
The algorithm is as follows: numOutOfRange = 0 For each i,j of the image: lookupInd = int(indOffset + image[i,j]) if lookupInd not in range [0, table.size() - 1]: set lookupInd to nearest edge and increment numOutOfRange image[i,j] += table[lookupInd] return numOutOfRange
@param[in,out] image image to which to add the values; modified in place @param[in] table lookup table @param[in] indOffset scalar added to image value before truncating to lookup column
@return the number of pixels whose values were out of range """
"""!Test basic functionality of applyLookupTable """
"""Test that a given image and lookup table produce the known answer
Apply a negative ramp table to a positive ramp image to get a flat image, but have one value out of range at each end, to offset each end point by one """ # generate a small ramp image with ascending integer values # starting at some small negative value going positive # generate a ramp lookup table with descending integer values, # with a range offset by a small arbitrary value from the image ramp # make it two elements too short so we can have one value out of range at each end start=stop + tableOffset, stop=numOutOfRange + start + tableOffset, num=numPix - numOutOfRange) # apply the table with the first and last image value out of range by one # at this point the image should all have the same value # except the first point will be one less and the last one more
lsst.utils.tests.init() unittest.main() |