← Về thư mục
tests/openpiv/test_scripts.py
- particle_image · function · L57-L62 — def particle_image(rows: np.ndarray, columns: np.ndarray, dy: int, dx: int) -> np.ndarray
- DisplacementRecoveryTests · class · L65-L215 — class DisplacementRecoveryTests(unittest.TestCase)
- setUpClass · method · L69-L75 — def setUpClass(cls) -> None: # A fixed seed keeps the particle pattern -- and therefore the # correlation quality -- identical from run to run.
- setUp · method · L77-L81 — def setUp(self) -> None
- pair · method · L83-L90 — def pair(self, dy: int, dx: int) -> tuple[Path, Path]
- field · method · L92-L106 — def field(self, dy: int, dx: int, **overrides) -> dict
- test_a_rightward_shift_is_recovered_as_a_positive_u · method · L108-L115 — def test_a_rightward_shift_is_recovered_as_a_positive_u(self) -> None: # Particles move exactly +4 px in x, so with dt = 1 s and 1 px per unit # every valid vector must read u = 4 and v = 0.
- test_a_leftward_shift_is_recovered_as_a_negative_u · method · L117-L120 — def test_a_leftward_shift_is_recovered_as_a_negative_u(self) -> None
- test_a_downward_shift_is_recovered_as_a_negative_v · method · L122-L129 — def test_a_downward_shift_is_recovered_as_a_negative_v(self) -> None: # transform_coordinates() puts the field in a right-handed y-up frame, # so motion towards higher row indices -- down the image -- is negative # v. Getting this backwards mirrors every reported flow.
- test_identical_frames_recover_no_motion · method · L131-L135 — def test_identical_frames_recover_no_motion(self) -> None
- test_the_grid_geometry_follows_the_window_and_overlap · method · L137-L147 — def test_the_grid_geometry_follows_the_window_and_overlap(self) -> None
- test_dt_converts_the_displacement_into_a_velocity · method · L149-L152 — def test_dt_converts_the_displacement_into_a_velocity(self) -> None: # 4 px over 0.5 s is 8 px/s.
- test_the_scaling_factor_is_pixels_per_physical_unit · method · L154-L160 — def test_the_scaling_factor_is_pixels_per_physical_unit(self) -> None: # 4 px at 2 px/mm is 2 mm/s, so u must be divided by the factor, not # multiplied by it.
- test_a_larger_search_area_still_recovers_the_shift · method · L162-L166 — def test_a_larger_search_area_still_recovers_the_shift(self) -> None: # search_area > window_size switches the correlation to "linear"; the # answer must not change.
- test_every_documented_output_file_is_written · method · L168-L182 — def test_every_documented_output_file_is_written(self) -> None
- test_dropping_invalid_vectors_leaves_holes_where_they_were_flagged · method · L184-L198 — def test_dropping_invalid_vectors_leaves_holes_where_they_were_flagged(self) -> None: # By default a flagged vector is replaced by the local mean, so the # field has no holes; --drop_invalid must NaN out exactly the flagged # positions and leave every other vector untouched.
- test_a_uniform_translation_has_no_vorticity · method · L200-L215 — def test_a_uniform_translation_has_no_vorticity(self) -> None: # End to end: rigid translation carries no rotation, so the derived # vorticity must stay at the noise level rather than pick up a bias.
- WindowGeometryTests · class · L218-L247 — class WindowGeometryTests(unittest.TestCase)
- test_a_search_area_smaller_than_the_window_is_refused · method · L221-L223 — def test_a_search_area_smaller_than_the_window_is_refused(self) -> None
- test_an_overlap_at_or_above_the_window_is_refused · method · L225-L232 — def test_an_overlap_at_or_above_the_window_is_refused(self) -> None: # overlap == window_size would give a zero step and an infinite grid.
- test_the_guards_fire_before_the_images_are_opened · method · L234-L238 — def test_the_guards_fire_before_the_images_are_opened(self) -> None: # Both paths below do not exist; a FileNotFoundError instead of a # ValueError would mean the geometry check runs too late to be useful.
- test_the_shipped_defaults_satisfy_their_own_guards · method · L240-L247 — def test_the_shipped_defaults_satisfy_their_own_guards(self) -> None: # window 32 / overlap 12 / search 38 is a legal combination, so the # documented defaults must reach the image read rather than be refused.
- CliArgumentTests · class · L250-L264 — class CliArgumentTests(unittest.TestCase)
- test_exactly_two_images_are_required · method · L251-L264 — def test_exactly_two_images_are_required(self) -> None
- AnalyzerFixtureCase · class · L267-L297 — class AnalyzerFixtureCase(unittest.TestCase)
- setUp · method · L273-L277 — def setUp(self) -> None
- analyzer · method · L279-L297 — def analyzer( self, u: np.ndarray, v: np.ndarray, x: np.ndarray, y: np.ndarray, flags: np.ndarray | None = None, ) -> analyze.PIVAnalyzer
- GridSpacingTests · class · L300-L322 — class GridSpacingTests(AnalyzerFixtureCase)
- test_the_spacing_is_read_off_the_coordinates_not_assumed · method · L301-L305 — def test_the_spacing_is_read_off_the_coordinates_not_assumed(self) -> None
- test_the_spacing_is_positive_even_when_a_coordinate_runs_backwards · method · L307-L313 — def test_the_spacing_is_positive_even_when_a_coordinate_runs_backwards(self) -> None: # runner.py writes y decreasing; the reported spacing is a magnitude.
- test_a_degenerate_axis_falls_back_to_one · method · L315-L322 — def test_a_degenerate_axis_falls_back_to_one(self) -> None: # A single-column field has no spacing to infer; 1.0 keeps the # derivative per grid cell instead of dividing by zero.
- AnalyticFlowTests · class · L325-L399 — class AnalyticFlowTests(AnalyzerFixtureCase)
- grid · method · L331-L336 — def grid(self, descending_y: bool) -> tuple[np.ndarray, np.ndarray]
- test_solid_body_rotation_has_vorticity_twice_the_rate · method · L338-L349 — def test_solid_body_rotation_has_vorticity_twice_the_rate(self) -> None: # u = -omegay, v = omegax is rigid rotation at omega; its vorticity # dv/dx - du/dy is exactly 2*omega everywhere, including at the edges, # because the field is linear and np.gradient is exact for linear data.
- test_rotation_carries_no_strain · method · L351-L358 — def test_rotation_carries_no_strain(self) -> None
- test_pure_shear_splits_between_vorticity_and_shear_strain · method · L360-L369 — def test_pure_shear_splits_between_vorticity_and_shear_strain(self) -> None: # u = ky, v = 0: dv/dx - du/dy = -k, and exy = 0.5(du/dy + dv/dx) = k/2.
- test_incompressible_extension_gives_opposite_normal_strains · method · L371-L380 — def test_incompressible_extension_gives_opposite_normal_strains(self) -> None: # u = ax, v = -ay is divergence free, so exx = a and eyy = -a.
- test_a_supplied_spacing_overrides_the_inferred_one · method · L382-L392 — def test_a_supplied_spacing_overrides_the_inferred_one(self) -> None: # The gradients are per unit length, so halving the assumed spacing # doubles every derivative.
- test_a_uniform_flow_has_neither_vorticity_nor_strain · method · L394-L399 — def test_a_uniform_flow_has_neither_vorticity_nor_strain(self) -> None
- VelocityMagnitudeTests · class · L402-L408 — class VelocityMagnitudeTests(AnalyzerFixtureCase)
- test_the_magnitude_is_the_euclidean_norm · method · L403-L408 — def test_the_magnitude_is_the_euclidean_norm(self) -> None
- StatisticsTests · class · L411-L451 — class StatisticsTests(AnalyzerFixtureCase)
- field · method · L412-L415 — def field(self, u: np.ndarray, v: np.ndarray) -> analyze.PIVAnalyzer
- test_a_uniform_field_has_zero_fluctuation_and_zero_energy · method · L417-L423 — def test_a_uniform_field_has_zero_fluctuation_and_zero_energy(self) -> None
- test_the_rms_is_the_population_standard_deviation · method · L425-L433 — def test_the_rms_is_the_population_standard_deviation(self) -> None: # [-2, -2, 2, 2] has mean 0 and population variance 4, so sd = 2 exactly # -- the sample (n-1) convention would give 2.309 instead.
- test_subtracting_the_mean_makes_the_rms_offset_invariant · method · L435-L443 — def test_subtracting_the_mean_makes_the_rms_offset_invariant(self) -> None: # The fluctuation statistics describe the spread, so adding a uniform # 100 to every vector must move only the means.
- test_holes_left_by_drop_invalid_are_ignored_not_propagated · method · L445-L451 — def test_holes_left_by_drop_invalid_are_ignored_not_propagated(self) -> None: # --drop_invalid writes NaN where a vector was rejected; the statistics # must describe the surviving vectors instead of returning NaN.
- FlagsTests · class · L454-L478 — class FlagsTests(AnalyzerFixtureCase)
- test_flags_are_loaded_as_a_boolean_mask · method · L455-L464 — def test_flags_are_loaded_as_a_boolean_mask(self) -> None: # runner.py saves them as bool, but a float or int array from an older # run must still index correctly rather than be read as positions.
- test_the_quiver_plot_draws_only_the_valid_vectors · method · L466-L478 — def test_the_quiver_plot_draws_only_the_valid_vectors(self) -> None
- BundledExampleTests · class · L481-L489 — class BundledExampleTests(unittest.TestCase)
- test_the_example_pair_ships_inside_the_installed_openpiv · method · L482-L489 — def test_the_example_pair_ships_inside_the_installed_openpiv(self) -> None: # run_example.py's whole premise is that no external data is needed, so # if upstream drops these files the script is broken.