AU-ExoMars / PCOT

Pancam Operations Toolkit
MIT License
3 stars 0 forks source link

ROI pixel counts in spectrum #12

Closed jimfinnis closed 3 years ago

jimfinnis commented 3 years ago

We use the pixel counts from the ROIs to calculate the standard error for error bars in spectra. Feeding ROIs with the same name into a spectrum node causes them to be considered as the same ROI. This is typically used when they are from two different images. What happens in this case?

jimfinnis commented 3 years ago

Here's how it works.

When an image or image-with-ROIs is plugged into spectrum, the ROIs are processed into a dictionary (called 'data'). It is keyed by ROI name, and each ROI has a list of tuples of channel data. Let's imagine that there are two ROIs on separate images with different sizes - but they have the same name. They'll get combined into an entry like this under that name:

    [
        # channel index, cwl, mean intensity, sd of intensity, channel label, pixel count
       (0, 438.0, 0.09718827482688777, 0.033184560153696856, 'L4_438', 3132),
        (1, 500.0, 0.12427511008154235, 0.04296475099012811, 'L5_500', 3132),
        (2, 532.0, 0.15049515647449713, 0.04899176061731549, 'L6_532', 3132),
        (3, 568.0, 0.18620748507717713, 0.05834286572257662, 'L7_568', 3132),
        (4, 610.0, 0.23161822595511056, 0.07227542372780232, 'L8_610', 3132),
        (5, 671.0, 0.2626209478268678, 0.08226790002558386, 'L9_671', 3132),
        (0, 740.0, 0.3917202910115896, 0.08213716515845079, 'R4_740', 484),
        (1, 780.0, 0.41594551023372933, 0.08695280835403581, 'R5_780', 484),
        (2, 832.0, 0.39478648792613635, 0.08164454531723438, 'R6_832', 484),
        (3, 900.0, 0.37751833072378616, 0.07634822775362438, 'R7_900', 484),
        (4, 950.0, 0.3726376304941729, 0.07310612483354316, 'R8_950', 484),
        (5, 1000.0, 0.4105814784026343, 0.08091608212909969, 'R9_1000', 484)]
    ]

So each entry has a different wavelength, but also has its own pixel count - that means that the SDs will be processed correctly into standard errors.

jimfinnis commented 3 years ago

So it should be fine!