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

Rewrite Noise Replacer as a context manager

    Details

    • Type: Story
    • Status: To Do
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: meas_base
    • Labels:
      None
    • Templates:
    • 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

          Activity

            People

            • Assignee:
              Unassigned
              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:

                Summary Panel