Ticket #2113 (inTicketWork enhancement)

Opened 7 years ago

Last modified 5 years ago

Please add a way to get a Filter's canonical name

Reported by: rhl Owned by: rhl
Priority: normal Milestone:
Component: afw Keywords:
Cc: rhl, rowen, bick, cloomis, price, jbosch Blocked By:
Blocking: Project: LSST
Version Number:
How to repeat:

not applicable

Description

We support aliases for filters (e.g. NAOJ calls Sloan r "W-S-R+"), but there's no way to ask for the canonical name of a filter. Please rectify this.

Change History

comment:1 Changed 7 years ago by DefaultCC Plugin

  • Cc rhl, rowen, bick, cloomis, price, jbosch added

comment:2 Changed 6 years ago by jbosch

There's now a workaround for the lack of this feature on the HSC fork of meas_astrom (commit c814d945), which I presume will make its way to the LSST fork at some point. We should make sure that workaround is updated when this ticket is implemented.

comment:3 Changed 6 years ago by rhl

Actually there is a way:

afwImage.Filter(afwImage.Filter("W-S-R+").getId()).getName()

will return "r"

It'd be better to add

afwImage.Filter("W-S-R+").getCanonicalName()

What is impossible is to get the possible aliases given a canonical name (e.g. get "W-S-R+" given "r"), so please add

afwImage.Filter("r").getAliases()

This would only work for canonical names, because "r" is not an alias for "W-S-R+" -- it's the name. An alternative is

afwImage.Filter.getAllNames("r")

which would return ["r", "W-S-R+"] (and afwImage.Filter.getAllNames("W-S-R+") would return the same list). I prefer the former due to the already-defined

afwImage.Filter.getNames()

which returns all canonical names, and I find getAllNames's semantics a little weird by comparison.

comment:4 Changed 6 years ago by rhl

  • Owner changed from rhl to krughoff
  • Status changed from new to inStandardsReview

Ooops, I did this on a plane and never pushed the branch. I adopted (my!) suggestion to use filter.getAliases() -- see the test coverage.

git diff --histogram --stat origin...
 include/lsst/afw/image/Filter.h | 14 ++++++++++++++
 src/image/Filter.cc             | 21 ++++++++++++++++++++-
 tests/color.py                  | 40 ++++++++++++++++++++++++++--------------
 ups/afw.table                   |  2 +-
 4 files changed, 61 insertions(+), 16 deletions(-)

comment:5 Changed 6 years ago by rhl

Sorry. Let's use u/rhl/2113 instead (patched relative to the latest master):

git diff --histogram --stat master..HEAD
 include/lsst/afw/image/Filter.h | 14 ++++++++++++++
 src/image/Filter.cc             | 21 ++++++++++++++++++++-
 tests/color.py                  | 40 ++++++++++++++++++++++++++--------------
 3 files changed, 60 insertions(+), 15 deletions(-)

This is identical to the tickets/2113, except that it doesn't accidentally revert a Mario change to afw.table.

comment:6 Changed 5 years ago by krughoff

  • Owner changed from krughoff to rhl
  • Status changed from inStandardsReview to inTicketWork

Looks fine to me. Free to merge.

Note: See TracTickets for help on using tickets.