Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-31860

Add flux statistic task and sky object metrics into faro

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Story Points:
      9
    • Epic Link:
    • Team:
      Data Release Production
    • Urgent?:
      No

      Description

      Sky objects are pseudo-objects which measure the flux in 'empty' patches of sky in coadded imaging. These are useful for various QA purposes, including analysis of the background estimate. Metrics for sky objects are currently being computed in pipe_analysis. This ticket aims to add these metrics also into faro, specifically, skyObjectMean_ap09Flux (formerly skyObjectMean_CircApRad9pix) and skyObjectStd_ap09Flux (formerly skyObjectStd_CircApRad9pix) as defined in https://github.com/lsst/verify_metrics/blob/master/metrics/pipe_analysis.yaml.

        Attachments

          Issue Links

            Activity

            Hide
            lskelvin Lee Kelvin added a comment -

            I think this ticket is now ready for review. I've added a new task into TractTableMeasurementTasks.py: the FluxStatisticTask. This task takes in any column, optionally applying the necessary selectors, and generates a flux metric measurement from these data.

            The genesis for this task was to reproduce sky object flux measurements as previously calculated in pipe_analysis. To achieve this, in addition to the new generic task above, I've also added two new tasks into the measurement_tract_table.yaml pipeline: SkyObjectMean and SkyObjectStd. Testing of these tasks has been performed using commands similar to this:

            pipetask --long-log run --register-dataset-types \
            -b /repo/main \
            -i HSC/runs/RC2/w_2022_12/DM-34125 \
            --output-run u/lskelvin/scratch/DM-31860 \
            -p $FARO_DIR/pipelines/measurement/measurement_tract_table.yaml#SkyObjectMean,SkyObjectStd \
            -d "instrument='HSC' AND skymap='hsc_rings_v1' AND tract=9615 AND band='i'"
            

            Would you mind reviewing this, Keith Bechtol?

            Show
            lskelvin Lee Kelvin added a comment - I think this ticket is now ready for review. I've added a new task into TractTableMeasurementTasks.py : the FluxStatisticTask . This task takes in any column, optionally applying the necessary selectors, and generates a flux metric measurement from these data. The genesis for this task was to reproduce sky object flux measurements as previously calculated in pipe_analysis . To achieve this, in addition to the new generic task above, I've also added two new tasks into the measurement_tract_table.yaml pipeline: SkyObjectMean and SkyObjectStd . Testing of these tasks has been performed using commands similar to this: pipetask --long-log run --register-dataset-types \ -b /repo/main \ -i HSC/runs/RC2/w_2022_12/DM-34125 \ --output-run u/lskelvin/scratch/DM-31860 \ -p $FARO_DIR/pipelines/measurement/measurement_tract_table.yaml#SkyObjectMean,SkyObjectStd \ -d "instrument='HSC' AND skymap='hsc_rings_v1' AND tract=9615 AND band='i'" Would you mind reviewing this, Keith Bechtol ?
            Hide
            lskelvin Lee Kelvin added a comment -

            Jenkins run for this ticket. This run has been kicked off using the standard build products: lsst_distrib lsst_ci. If you would recommend using any additional build products to validate this PR, please do let me know.

            Show
            lskelvin Lee Kelvin added a comment - Jenkins run for this ticket . This run has been kicked off using the standard build products: lsst_distrib lsst_ci . If you would recommend using any additional build products to validate this PR, please do let me know.
            Hide
            lskelvin Lee Kelvin added a comment -

            PS - the two new tasks in the measurement_tract_table.yaml pipeline make use of already defined metrics in the verify_metrics repo: https://github.com/lsst/verify_metrics/blob/main/metrics/pipe_analysis.yaml. I'm not sure if the names of these need to be changed or not on this ticket too?

            For example, the sky object mean flux metric is defined in pipe_analysis.yaml like this:

            skyObjectMean_CircApRad9pix:
              description: >
                The mean value of the sigma-clipped sky object base_CircularApertureFlux_9_0_instFlux data.
              unit: nanojansky
              tags:
              - skyObject
              - skyLevel
            

            However, the pipeline I have set up on this PR is defined like this:

              SkyObjectMean:
                class: lsst.faro.measurement.TractTableMeasurementTask
                config:
                  measure.statistic: MEAN
                  connections.package: pipe_analysis
                  connections.metric: SkyObjectMean
                  python: |
                    from lsst.faro.measurement import FluxStatisticTask
                    import lsst.faro.utils.selectors as selectors
                    config.measure.retarget(FluxStatisticTask)
                    config.measure.columnsBand = {"flux": "ap09Flux"}
                    config.measure.selectorActions.FlagSelector=selectors.FlagSelector
                    config.measure.selectorActions.FlagSelector.selectWhenTrue=["sky_object"]
            

            Notably, I'm wondering if the connections.metric parameter name needs to match the task name in the pipe_analysis.yaml or not?

            Show
            lskelvin Lee Kelvin added a comment - PS - the two new tasks in the measurement_tract_table.yaml pipeline make use of already defined metrics in the verify_metrics repo: https://github.com/lsst/verify_metrics/blob/main/metrics/pipe_analysis.yaml . I'm not sure if the names of these need to be changed or not on this ticket too? For example, the sky object mean flux metric is defined in pipe_analysis.yaml like this: skyObjectMean_CircApRad9pix: description: > The mean value of the sigma-clipped sky object base_CircularApertureFlux_9_0_instFlux data. unit: nanojansky tags: - skyObject - skyLevel However, the pipeline I have set up on this PR is defined like this: SkyObjectMean: class: lsst.faro.measurement.TractTableMeasurementTask config: measure.statistic: MEAN connections.package: pipe_analysis connections.metric: SkyObjectMean python: | from lsst.faro.measurement import FluxStatisticTask import lsst.faro.utils.selectors as selectors config.measure.retarget(FluxStatisticTask) config.measure.columnsBand = {"flux": "ap09Flux"} config.measure.selectorActions.FlagSelector=selectors.FlagSelector config.measure.selectorActions.FlagSelector.selectWhenTrue=["sky_object"] Notably, I'm wondering if the connections.metric parameter name needs to match the task name in the pipe_analysis.yaml or not?
            Hide
            lskelvin Lee Kelvin added a comment - - edited

            Additional Jenkins run started using the following build products:

            lsst_distrib lsst_ci ci_hsc_gen3 ci_imsim
            

            Show
            lskelvin Lee Kelvin added a comment - - edited Additional Jenkins run started using the following build products: lsst_distrib lsst_ci ci_hsc_gen3 ci_imsim
            Hide
            lskelvin Lee Kelvin added a comment -

            Update: thanks Jeffrey Carlin for a useful discussion on Slack on my question above Re: the task connection names. Following this discussion, I have opened an additional PR in verify_metrics which changes the metric names to skyObjectMean_ap09Flux and skyObjectStd_ap09Flux. I have also updated the original PR in faro with these connection names, and restarted the above Jenkins run with these new commits in place (URL updated to point to the new Jenkins run).

            Show
            lskelvin Lee Kelvin added a comment - Update: thanks Jeffrey Carlin for a useful discussion on Slack on my question above Re: the task connection names. Following this discussion, I have opened an additional PR in verify_metrics which changes the metric names to skyObjectMean_ap09Flux and skyObjectStd_ap09Flux . I have also updated the original PR in faro with these connection names, and restarted the above Jenkins run with these new commits in place (URL updated to point to the new Jenkins run).
            Hide
            kbechtol Keith Bechtol added a comment -

            Thanks for adding the new functionality of metrics using sky_objects.

            Show
            kbechtol Keith Bechtol added a comment - Thanks for adding the new functionality of metrics using sky_objects.
            Hide
            lskelvin Lee Kelvin added a comment -

            Thanks for your review Keith! I kicked off a final round of Jenkins, which completed successfully overnight. Branches merged and deleted. Cheers!

            Show
            lskelvin Lee Kelvin added a comment - Thanks for your review Keith! I kicked off a final round of Jenkins , which completed successfully overnight. Branches merged and deleted. Cheers!

              People

              Assignee:
              lskelvin Lee Kelvin
              Reporter:
              lskelvin Lee Kelvin
              Reviewers:
              Keith Bechtol
              Watchers:
              Jeffrey Carlin, Keith Bechtol, Lee Kelvin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.