1- """Core features for building and processing pipelines in DeepTrack2. # TODO
1+ """Core features for building and processing pipelines in DeepTrack2.
22
33This module defines the core classes and utilities used to create and
44manipulate features in DeepTrack2, enabling users to build sophisticated data
@@ -5544,18 +5544,23 @@ def get(
55445544 return [* inputs , * value ]
55455545
55465546
5547- class Arguments (Feature ): # TODO
5547+ class Arguments (Feature ):
55485548 """A convenience container for pipeline arguments.
55495549
55505550 `Arguments` allows dynamic control of pipeline behavior by providing a
55515551 container for arguments that can be modified or overridden at runtime. This
55525552 is particularly useful when working with parametrized pipelines, such as
5553- toggling behaviors based on whether an image is a label or a raw input.
5553+ toggling behaviors based on whether an array is a label or a raw input.
5554+
5555+ Parameters
5556+ ----------
5557+ **kwargs: Any
5558+ Properties to expose as pipeline arguments.
55545559
55555560 Methods
55565561 -------
55575562 `get(inputs, **kwargs) -> Any`
5558- It passes the inputs through unchanged, while allowing for property
5563+ Passes the inputs through unchanged, while allowing for property
55595564 overrides.
55605565
55615566 Examples
@@ -5573,30 +5578,24 @@ class Arguments(Feature): # TODO
55735578
55745579 A typical use-case is:
55755580
5576- >>> arguments = dt.Arguments(is_label=False )
5581+ >>> arguments = dt.Arguments(noise_level=0.0 )
55775582 >>> image_pipeline = (
55785583 ... dt.LoadImage(path=temp_png.name)
5579- ... >> dt.Gaussian(sigma=arguments.is_label ) # Image with no noise
5584+ ... >> dt.Gaussian(sigma=arguments.noise_level ) # Image with no noise
55805585 ... )
55815586 >>> image_pipeline.bind_arguments(arguments)
5582- >>>
5587+
55835588 >>> image = image_pipeline()
55845589 >>> image.std()
55855590 0.0
55865591
55875592 Change the argument:
55885593
5589- >>> image = image_pipeline(is_label=True ) # Image with added noise
5594+ >>> image = image_pipeline(noise_level=1.0 ) # Image with added noise
55905595 >>> image.std()
55915596 1.0104364326447652
55925597
5593- Remove the temporary image:
5594-
5595- >>> import os
5596- >>>
5597- >>> os.remove(temp_png.name)
5598-
5599- For a non-mathematical dependence, create a local link to the property as
5598+ For a conditional dependence, create a local link to the property as
56005599 follows:
56015600
56025601 >>> arguments = dt.Arguments(is_label=False)
@@ -5609,8 +5608,16 @@ class Arguments(Feature): # TODO
56095608 ... )
56105609 >>> image_pipeline.bind_arguments(arguments)
56115610
5612- As with any feature, all arguments can be passed by deconstructing the
5613- properties dict:
5611+ >>> image = image_pipeline() # Image with added noise
5612+ >>> image.std()
5613+ 0.9994058570249776
5614+
5615+ >>> image = image_pipeline(is_label=True) # Raw image with no noise
5616+ >>> image.std()
5617+ 0.0
5618+
5619+ As with any feature, all arguments can be passed by unpacking the
5620+ properties dictionary:
56145621
56155622 >>> arguments = dt.Arguments(is_label=False, noise_sigma=5)
56165623 >>> image_pipeline = (
@@ -5623,7 +5630,7 @@ class Arguments(Feature): # TODO
56235630 ... )
56245631 ... )
56255632 >>> image_pipeline.bind_arguments(arguments)
5626- >>>
5633+
56275634 >>> image = image_pipeline() # Image with added noise
56285635 >>> image.std()
56295636 5.002151761964336
@@ -5632,14 +5639,19 @@ class Arguments(Feature): # TODO
56325639 >>> image.std()
56335640 0.0
56345641
5642+ Remove the temporary image:
5643+
5644+ >>> import os
5645+ >>>
5646+ >>> os.remove(temp_png.name)
5647+
56355648 """
56365649
56375650 def get (
56385651 self : Arguments ,
56395652 inputs : Any ,
56405653 ** kwargs : Any ,
56415654 ) -> Any :
5642-
56435655 """Return the inputs and allow property overrides.
56445656
56455657 This method does not modify the inputs but provides a mechanism for
0 commit comments