Skip to content

Allow specifying column metadata for features in FeatureGeneratorΒ #2922

@kosack

Description

@kosack

Please describe the use case that requires this feature.

FeatureGenerator transforms an input astropy Table to an output, generating new columns. In some cases, the resulting table will be written out to a FITS for ECSV file. The column description is carried over to the output table for original columns, but there is no way to specify it for generated columns.

Describe the solution you'd like

An (optional) way to give a column description to generated feature columns.

Simplest implementation with no change to current API: allow a third element in the Tuple used to specify a feature, i.e.:

FeatureGenerator:
  features:
     - ["column_with_description", "x**2+3*x", "the description goes here"]
     - ["some_other_col", "x*2"]   # the old API should still work, assigning a default blank description

Describe alternatives you've considered

An alternative would be a more radical change, using a list[dict] in a defined format. It's more readable, but would be a large change and break the API, so I think it's better to stick with the simple option.

FeatureGenerator:
  features:
    - name: "column_with_description"
      expression: "x**2+3*x"
      description: "the description goes here"
    - name: some_other_col
      expression: "x**2"

Additional context

This is something I would like to use to greatly simplify DL2EventLoader, as in #2919, which currently has a very complex way of specifying metadata for new columns.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions