Details
-
Type:
Story
-
Status: In Progress
-
Resolution: Unresolved
-
Fix Version/s: None
-
Component/s: meas_base
-
Labels:
-
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)
|
See also
DM-3184.