|
22 | 22 | "cell_type": "markdown", |
23 | 23 | "metadata": {}, |
24 | 24 | "source": [ |
25 | | - "This advanced tutorial introduces the module deeptrack.properties." |
| 25 | + "This advanced tutorial introduces the module `properties.py`." |
26 | 26 | ] |
27 | 27 | }, |
28 | 28 | { |
|
31 | 31 | "source": [ |
32 | 32 | "## 1. What is `properties.py`?\n", |
33 | 33 | "\n", |
34 | | - "The `properties.py` module in DeepTrack2 defines the mechanisms for \n", |
35 | | - "managing the dynamic and hierarchical properties of features. Unlike \n", |
36 | | - "standard Python attributes, these properties support lazy evaluation, \n", |
37 | | - "inheritance, dependency tracking, and value caching. This makes them \n", |
38 | | - "ideal for defining complex, data-driven feature graphs where values \n", |
39 | | - "may depend on other values—either statically or dynamically. The \n", |
40 | | - "properties' system is tightly integrated with the `Feature` class, \n", |
41 | | - "serving as the foundation for the flexible and declarative interface \n", |
42 | | - "used to build DeepTrack pipelines." |
| 34 | + "The `properties.py` module in DeepTrack2 defines the mechanisms for managing the dynamic and hierarchical properties of features. Unlike standard Python attributes, these properties support lazy evaluation, inheritance, dependency tracking, and value caching. This makes them ideal for defining complex, data-driven feature graphs where values may depend on other values—either statically or dynamically. The properties' system is tightly integrated with the `Feature` class, serving as the foundation for the flexible and declarative interface used to build DeepTrack2 pipelines." |
43 | 35 | ] |
44 | 36 | }, |
45 | 37 | { |
|
49 | 41 | "The key roles of `properties.py` are:\n", |
50 | 42 | "\n", |
51 | 43 | "- **Lazy-Evaluated Properties:**\n", |
52 | | - " Properties can be set as static values or as callables, allowing for \n", |
53 | | - " on-demand evaluation. This is critical for dynamic data pipelines \n", |
54 | | - " where some values depend on runtime conditions.\n", |
| 44 | + " Properties can be set as static values or as callables, allowing for on-demand evaluation. This is critical for dynamic data pipelines where some values depend on runtime conditions.\n", |
55 | 45 | "\n", |
56 | 46 | "- **Tracking of Dependencies Between Properties:**\n", |
57 | | - " Properties can depend on other properties. When a dependency is \n", |
58 | | - " updated, dependent properties are automatically re-evaluated. This \n", |
59 | | - " enables consistent and efficient parameter propagation.\n", |
| 47 | + " Properties can depend on other properties. When a dependency is updated, dependent properties are automatically re-evaluated. This enables consistent and efficient parameter propagation.\n", |
60 | 48 | "\n", |
61 | 49 | "- **Hierarchical Property Inheritance:**\n", |
62 | | - " Sub-features can inherit and override properties from their parent \n", |
63 | | - " features, enabling modular and composable configurations.\n", |
| 50 | + " Sub-features can inherit and override properties from their parent features, enabling modular and composable configurations.\n", |
64 | 51 | "\n", |
65 | 52 | "- **Introspection and Documentation:**\n", |
66 | | - " Properties can be introspected to extract their default values, \n", |
67 | | - " types, and documentation, which supports automated documentation \n", |
68 | | - " generation and better developer experience.\n", |
| 53 | + " Properties can be introspected to extract their default values, types, and documentation, which supports automated documentation generation and better developer experience.\n", |
69 | 54 | "\n", |
70 | 55 | "- **Evaluated Values Caching:**\n", |
71 | | - " Once evaluated, a property's value is cached until its dependencies \n", |
72 | | - " change. This prevents unnecessary recomputation while ensuring \n", |
73 | | - " correctness.\n", |
| 56 | + " Once evaluated, a property's value is cached until its dependencies change. This prevents unnecessary recomputation while ensuring correctness.\n", |
74 | 57 | "\n", |
75 | 58 | "- **Declarative Syntax for Pipeline Specification:**\n", |
76 | | - " The use of properties allows DeepTrack users to define image \n", |
77 | | - " generation pipelines in a high-level, declarative manner while \n", |
78 | | - " retaining low-level control when needed." |
| 59 | + " The use of properties allows DeepTrack users to define image generation pipelines in a high-level, declarative manner while retaining low-level control when needed." |
79 | 60 | ] |
80 | 61 | }, |
81 | 62 | { |
|
87 | 68 | "Each feature (instance of the class `Feature`, see [DTAT301_features.ipynb](DTAT301_features.ipynb)) can have several properties (instances of the class `Property`). These properties can be constants, functions, lists, dictionaries, iterators, or slices, providing flexibility in defining and controlling different aspects of the system being modelled.\n", |
88 | 69 | "\n", |
89 | 70 | "A propety has a value accessible through the field `current_value`, whose data type is not restricted. \n", |
90 | | - "This value is updated through a sampling rule (method `.update()`), which is passed to the class constructor on initialization. " |
| 71 | + "This value is updated through a sampling rule (used by the `.update()` method), which is passed to the class constructor on initialization. " |
91 | 72 | ] |
92 | 73 | }, |
93 | 74 | { |
|
476 | 457 | "\n", |
477 | 458 | "Another class contained in the module deeptrack.properties is `PropertyDict`. This is a dictionary of properties (keys: name of properties; values: properties) complemented by utility methods to manage collections of properties. These include:\n", |
478 | 459 | "\n", |
479 | | - "- `.current_value_dict()`, which creates and returns a dictionary with the current value of all properties in the PropertyDict (keys: name of properties; values: current values of the properties).\n", |
| 460 | + "- `.current_value_dict()`, which creates and returns a dictionary with the current value of all properties in the `PropertyDict` (keys: name of properties; values: current values of the properties).\n", |
480 | 461 | "\n", |
481 | 462 | "- `.update()`, which calls the method `.update()` on all properties in the PropertyDict.\n", |
482 | 463 | "\n", |
|
601 | 582 | "source": [ |
602 | 583 | "### 4.2. Simulating a Random Walker with a Markov Chain\n", |
603 | 584 | "\n", |
604 | | - "We will now simulate a random walker in one dimension by iterating the `SequentialProperty` with random number sampling rule as the displacements in each time step and updating the walkers position as a cummulative sum of the sampled displacements." |
| 585 | + "You will now simulate a random walker in one dimension by iterating the `SequentialProperty` with random number sampling rule as the displacements in each time step and updating the walkers position as a cummulative sum of the sampled displacements." |
605 | 586 | ] |
606 | 587 | }, |
607 | 588 | { |
|
0 commit comments