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

Rewrite Noise Replacer as a context manager

    XMLWordPrintable

    Details

    • Story Points:
      6
    • Team:
      Data Release Production

      Description

      The noise replacer functions in contexts where python context managers would be a natural control flow type. Specifically it would be great to do something akin to the following pseudo code:

      with NoiseReplacer(args) as nr:
          for imageOfSource, sourceRecord in nr: #<- nr will take care of swapping out sources
              measurementPlugin.run(sourceRecord, imageOfSource)
      

      For ease of debugging it would be great if the proxy object returned by the NoiseReplacer context manager to implement both an iter method (that inside itself has a context manager inside surrounding a yield for functionality as shown above), and also implement _getItem_ which will take an index of the catalog and return a new context manager object. This will make it much easier to investigate a single source. It will behave as the following:

      with NoiseReplacer(args) as nr:
          with nr[100] as (imageOfSource, sourceRecord):
              analizeObjectFunction(imageOfSource, sourceRecord)
      

        Attachments

          Issue Links

            Activity

            Hide
            price Paul Price added a comment -

            See also DM-3184.

            Show
            price Paul Price added a comment - See also DM-3184 .
            Hide
            nlust Nate Lust added a comment -

            It was Jim and I that were hammering away on this idea earlier, and so we will have to see if things have changed since the last time he thought about this, but we feel pretty good about this design.

            Show
            nlust Nate Lust added a comment - It was Jim and I that were hammering away on this idea earlier, and so we will have to see if things have changed since the last time he thought about this, but we feel pretty good about this design.
            Hide
            nlust Nate Lust added a comment -

            I'm not ready to assign this ticket to me, but I have been starting to play with this while waiting on other work to progress, so if someone else picks this ticket up please send me a message.

            Show
            nlust Nate Lust added a comment - I'm not ready to assign this ticket to me, but I have been starting to play with this while waiting on other work to progress, so if someone else picks this ticket up please send me a message.
            Hide
            jbosch Jim Bosch added a comment -

            Erin Sheldon has a context manager that wraps the existing NoiseReplacer and makes it easier to use. That seems to be an existence proof, despite the fact that previous tickets on this subject were closed due to the difficulty of actually making this work.

            Show
            jbosch Jim Bosch added a comment - Erin Sheldon has a context manager that wraps the existing NoiseReplacer and makes it easier to use. That seems to be an existence proof, despite the fact that previous tickets on this subject were closed due to the difficulty of actually making this work.
            Show
            jbosch Jim Bosch added a comment - https://github.com/esheldon/metadetect/blob/e6c3b3808cfdcf5b690e73cfb4498306c0c9921f/metadetect/lsst/util.py#L9

              People

              Assignee:
              fred3m Fred Moolekamp
              Reporter:
              nlust Nate Lust
              Watchers:
              Jim Bosch, Nate Lust, Paul Price
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Jenkins

                  No builds found.