Simple-Track 2.0.3__tar.gz → 2.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {simple_track-2.0.3 → simple_track-2.0.4}/PKG-INFO +1 -1
  2. {simple_track-2.0.3 → simple_track-2.0.4}/pyproject.toml +1 -1
  3. {simple_track-2.0.3 → simple_track-2.0.4}/src/Simple_Track.egg-info/PKG-INFO +1 -1
  4. {simple_track-2.0.3 → simple_track-2.0.4}/src/run_simple_track.py +7 -10
  5. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/feature.py +1 -2
  6. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/flow_solver.py +2 -3
  7. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/frame.py +1 -2
  8. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/frame_output.py +1 -2
  9. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/frame_tracker.py +2 -4
  10. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/load.py +1 -2
  11. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/track.py +2 -3
  12. {simple_track-2.0.3 → simple_track-2.0.4}/LICENSE +0 -0
  13. {simple_track-2.0.3 → simple_track-2.0.4}/README.md +0 -0
  14. {simple_track-2.0.3 → simple_track-2.0.4}/setup.cfg +0 -0
  15. {simple_track-2.0.3 → simple_track-2.0.4}/src/Simple_Track.egg-info/SOURCES.txt +0 -0
  16. {simple_track-2.0.3 → simple_track-2.0.4}/src/Simple_Track.egg-info/dependency_links.txt +0 -0
  17. {simple_track-2.0.3 → simple_track-2.0.4}/src/Simple_Track.egg-info/entry_points.txt +0 -0
  18. {simple_track-2.0.3 → simple_track-2.0.4}/src/Simple_Track.egg-info/requires.txt +0 -0
  19. {simple_track-2.0.3 → simple_track-2.0.4}/src/Simple_Track.egg-info/top_level.txt +0 -0
  20. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/__init__.py +0 -0
  21. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/exceptions.py +0 -0
  22. {simple_track-2.0.3 → simple_track-2.0.4}/src/simpletrack/utils.py +0 -0
  23. {simple_track-2.0.3 → simple_track-2.0.4}/tests/test_feature.py +0 -0
  24. {simple_track-2.0.3 → simple_track-2.0.4}/tests/test_flow_solver.py +0 -0
  25. {simple_track-2.0.3 → simple_track-2.0.4}/tests/test_frame.py +0 -0
  26. {simple_track-2.0.3 → simple_track-2.0.4}/tests/test_frame_tracker.py +0 -0
  27. {simple_track-2.0.3 → simple_track-2.0.4}/tests/test_mwe_output.py +0 -0
  28. {simple_track-2.0.3 → simple_track-2.0.4}/tests/test_simple_track_and_load.py +0 -0
  29. {simple_track-2.0.3 → simple_track-2.0.4}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Simple-Track
3
- Version: 2.0.3
3
+ Version: 2.0.4
4
4
  Summary: Threshold-based object tracking algorithm for 2D data
5
5
  Author-email: Adam Gainford <adam.gainford@reading.ac.uk>, Thorwald Stein <t.h.m.stein@reading.ac.uk>
6
6
  License-Expression: MPL-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "Simple-Track"
7
- version = "2.0.3"
7
+ version = "2.0.4"
8
8
  authors = [
9
9
  { name="Adam Gainford", email="adam.gainford@reading.ac.uk" },
10
10
  { name="Thorwald Stein", email="t.h.m.stein@reading.ac.uk"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Simple-Track
3
- Version: 2.0.3
3
+ Version: 2.0.4
4
4
  Summary: Threshold-based object tracking algorithm for 2D data
5
5
  Author-email: Adam Gainford <adam.gainford@reading.ac.uk>, Thorwald Stein <t.h.m.stein@reading.ac.uk>
6
6
  License-Expression: MPL-2.0
@@ -1,23 +1,20 @@
1
1
  import argparse
2
- import sys
3
2
 
4
3
  from simpletrack import Tracker
5
4
 
6
5
 
7
6
  def run_tracking():
8
- if len(sys.argv) < 2:
9
- raise Exception("Running SimpleTrack requires path to at least one config")
7
+ # TODO: make argparser default way of handling inputs, including configs and loaders
8
+ # Need to make sure that changes don't affect pyproject.toml entry points
9
+ # easiest just to pass the parser in to run_tracking.
10
+ parser = argparse.ArgumentParser(description="Run Simple-Track")
11
+ parser.add_argument("configs", help="Path to one or more yaml config files.")
12
+ args = parser.parse_args()
10
13
 
11
- config_paths = sys.argv[1:]
12
- for config_path in config_paths:
14
+ for config_path in args.configs:
13
15
  # With None passed into run method, uses input path in config
14
16
  Tracker(config_path).run()
15
17
 
16
18
 
17
19
  if __name__ == "__main__":
18
- # TODO: make argparser default way of handling inputs, including configs and loaders
19
- # Need to make sure that changes don't affect pyproject.toml entry points
20
- # easiest just to pass the parser in to run_tracking.
21
- msg = "Run Simple-Track. Requires path to at least one yaml config file"
22
- parser = argparse.ArgumentParser(description=msg)
23
20
  run_tracking()
@@ -1,5 +1,4 @@
1
1
  import datetime as dt
2
- from typing import Union
3
2
 
4
3
  import numpy as np
5
4
  from numpy.typing import NDArray
@@ -261,7 +260,7 @@ class Feature:
261
260
 
262
261
  def summarise(
263
262
  self, output_type: str = "str", headers_only: bool = False
264
- ) -> Union[str, dict, list]:
263
+ ) -> str | dict | list:
265
264
  """
266
265
  Return a summary of the Feature properties
267
266
 
@@ -1,7 +1,6 @@
1
1
  import itertools
2
2
  import warnings
3
3
  from collections.abc import Iterable
4
- from typing import Union
5
4
 
6
5
  import numpy as np
7
6
  import scipy.ndimage as ndimage
@@ -69,7 +68,7 @@ class FlowSolver:
69
68
  self.apply_tukey_filtering = apply_tukey_filtering
70
69
 
71
70
  def analyse_flow(
72
- self, prev_field: Union[Frame, NDArray], current_field: Union[Frame, NDArray]
71
+ self, prev_field: Frame | NDArray, current_field: Frame | NDArray
73
72
  ) -> list[NDArray, NDArray]:
74
73
  """
75
74
  Analyses previous field and current field to identify flow field. Uses phase
@@ -330,7 +329,7 @@ class FlowSolver:
330
329
 
331
330
  subdomain_check = [
332
331
  dim % sd_shape / 2
333
- for dim, sd_shape in zip(feature_field_shape, subdomain_shape)
332
+ for dim, sd_shape in zip(feature_field_shape, subdomain_shape, strict=True)
334
333
  ]
335
334
  return not any([remainder != 0 for remainder in subdomain_check])
336
335
 
@@ -1,5 +1,4 @@
1
1
  import datetime as dt
2
- from typing import Union
3
2
 
4
3
  import numpy as np
5
4
  import scipy.ndimage as ndimage
@@ -123,7 +122,7 @@ class Frame:
123
122
  else:
124
123
  return None
125
124
 
126
- def get_flow(self) -> Union[NDArray, None]:
125
+ def get_flow(self) -> NDArray | None:
127
126
  """
128
127
  Get a list of the y-flow and x-flow fields derived by comparing features between
129
128
  this frame and a frame from a previous timestep. Flow fields are both numpy
@@ -2,7 +2,6 @@ import csv
2
2
  import datetime
3
3
  from ast import literal_eval
4
4
  from pathlib import Path
5
- from typing import Union
6
5
 
7
6
  import numpy as np
8
7
 
@@ -152,7 +151,7 @@ class LoadOutput:
152
151
  (contanining Frames of field and Feature data) for further inspection and analysis.
153
152
  """
154
153
 
155
- def __init__(self, st_data_path: Union[str | Path]):
154
+ def __init__(self, st_data_path: str | Path):
156
155
  self.path = Path(st_data_path)
157
156
  self.strftime = "%Y%m%d_%H%M"
158
157
  # Links field type names in outputs to attribute names in Frame
@@ -1,5 +1,3 @@
1
- from typing import Union
2
-
3
1
  import numpy as np
4
2
  from numpy.typing import NDArray
5
3
 
@@ -493,7 +491,7 @@ class FrameTracker:
493
491
  advected_feature_field: NDArray,
494
492
  current_feature_field: NDArray,
495
493
  current_feature_id: int,
496
- ) -> list[Union[int, None], Union[NDArray, None]]:
494
+ ) -> list[int | None, NDArray | None]:
497
495
  """
498
496
  Use overlap histogram to find the closest matching feature id in the advected
499
497
  field for the current_feature_id in the current_field. Any other ids that are
@@ -865,7 +863,7 @@ def advect_field_using_motion_vectors(
865
863
  dx = np.mean(x_flow[feature_mask], dtype=int)
866
864
 
867
865
  # Now, advect the feature to the new position
868
- for y_coord, x_coord in zip(*feature_mask):
866
+ for y_coord, x_coord in zip(*feature_mask, strict=True):
869
867
  advected_y_coord = y_coord + dy
870
868
  advected_x_coord = x_coord + dx
871
869
 
@@ -1,5 +1,4 @@
1
1
  import datetime as dt
2
- from typing import Union
3
2
 
4
3
  from numpy.typing import NDArray
5
4
 
@@ -39,7 +38,7 @@ class BaseLoader:
39
38
  Loaders should be
40
39
  """
41
40
 
42
- def __init__(self, input_data: Union[list[str] | dict]) -> None:
41
+ def __init__(self, input_data: list[str] | dict) -> None:
43
42
  self.domain_shape = None
44
43
  self.input_data = input_data
45
44
  # Set the iterating list
@@ -3,7 +3,6 @@ Run the SimpleTrack algorithm to track objects through a sequence of images
3
3
  """
4
4
 
5
5
  from pathlib import Path
6
- from typing import Union
7
6
 
8
7
  from yaml import safe_load
9
8
 
@@ -19,7 +18,7 @@ class Tracker:
19
18
  Simple-Track manager controlling inputs, processing, outputs
20
19
  """
21
20
 
22
- def __init__(self, config_input: Union[str | dict]) -> None:
21
+ def __init__(self, config_input: str | dict) -> None:
23
22
  """
24
23
  Initialize SimpleTrack with configuration file
25
24
 
@@ -80,7 +79,7 @@ class Tracker:
80
79
  config_path,
81
80
  )
82
81
 
83
- def run(self, input_data: Union[list[str] | dict] = None) -> Timeline:
82
+ def run(self, input_data: list[str] | dict = None) -> Timeline:
84
83
  """
85
84
  Runs SimpleTrack using the designated config options.
86
85
 
File without changes
File without changes
File without changes