Implement SVOFilter
type, make statistics generic
#22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following #21, which implemented the ability to query the SVO filter service, this PR implements an
SVOFilter
type that contains the transmission curve and the metadata returned by SVO. It is implemented as an encapsulatedPhotometricFilter
instance and a dictionary (2 total fields). A few dictionary methods are passed through to theSVOFilter
type so you can do things liketo retrieve metadata from the contained dictionary, but I had trouble finding the full dictionary API documented anywhere so I could be missing things. I tried to add the stuff I most commonly use (
getindex
,haskey
,keys
,values
).To better support this new type, I made many of the base methods of the package operate on
AbstractFilter
where before they required a concretePhotometricFilter
. This required two new accessor methods,name
, anddetector_type
to retrieve the relevant information from subtypes ofAbstractFilter
.A few unrelated changes:
Base.getindex(f::AbstractFilter, i::Int) = (wave(f)[i], throughput(f)[i])
rather than just returning the throughput as it was doing previously; not sure in what circumstance you would only want to iterate over the throughput rather than the wavelength and throughput together.PhotometricFilter
is now a Unitful vector, rather than plain numbers, to ensure thatwave(::AbstractFilter)
does not need to make a copy -- otherwise the above method would make a copy on every access. Previously, callingwave
would allocate a copy of the wavelength field because it had to add units to it.Happy to have feedback on this! I tried to add as few additional methods as possible, but now that we have a filter type with metadata, maybe we should add a few more methods (e.g.,
zeropoint(::AbstractFilter)
) to provide consistent access to this information (when it is available -- probably returnmissing
when unavailable). Tagging @lucasvalenzuela since they were interested in #21.