Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter method to SpectralLibrary class #98

Open
tboggs opened this issue Dec 6, 2019 · 2 comments
Open

Add filter method to SpectralLibrary class #98

tboggs opened this issue Dec 6, 2019 · 2 comments
Assignees

Comments

@tboggs
Copy link
Member

tboggs commented Dec 6, 2019

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)
@kormang
Copy link
Contributor

kormang commented Jun 12, 2020

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?

@tboggs
Copy link
Member Author

tboggs commented Jun 12, 2020

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
Projects
None yet
Development

No branches or pull requests

2 participants