Skip to content

Add filter method to SpectralLibrary class #98

Open

Description

@tboggs

Spectral libraries may have more bands than actually needed or may have bands in a non-monotonic order. This issue is to add a filter method to the SpectralLibrary to enable things like:

  • Selecting a subset of bands from the library
  • Re-ordering bands to make them monotonically increasing/decreasing
  • Removing bad bands (e.g., bands identified in the bbl list)

Activity

  1. self-assigned this
    on Dec 6, 2019
  2. kormang commented on Jun 12, 2020

    @kormang
    Contributor

    I think function like that could be generally useful.
    Maybe make general purpose functions and call them from spectral library?
    I would like to help. For start with first point, selecting a subset of bands from library.
    But would like to know, what exactly did you have in mind?
    What should this function accept as arguments?
    What should in return?
    What side effects should it have inside the class?

  3. tboggs commented on Jun 12, 2020

    @tboggs
    MemberAuthor

    My initial thought was just to have a simple interface for selecting a subset of bands from a SpectralLibrary, based on keywords or specific band indices. For example:

    • If the bands are in descending order, one might want to reverse them
    • If bands are not monotonically increasing (which often happens at detector boundaries), one might either want to sort them or just select the ones that are increasing (i.e., ignore the first few bands of the second detector)

    However, the more I've thought about this, I believe it makes sense to have a more general capability so that in addition to selecting/reordering bands from a SpectralLibrary, one could also select/reorder the bands in an associated image. To accomplish that, it is probably best to have the filter-related methods in several classes:

    • BandInfo
    • SpectralLibrary
    • Image

    Starting with BandInfo, there should be a method to get a set of band indices, based on either a set of constants ('ascending', 'descending', 'monotonic', etc.) or a callable object that can determine the appropriate order. The return of that method would be the actual band indices (in desired order), which could then be passed to the filter methods of BandInfo, SpectralLibrary, and Image to perform the desired transformation.

    Related to this, I've also been toying with the idea of changing the structure of BandInfo so instead of having a fixed set of specific arrays ("centers", "bandwidths", etc.), There could be a single object to manage all the band-specific quantities and then use property decorators to expose the individual attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions