diff --git a/.readthedocs.yml b/.readthedocs.yml index 1fcc341c..d6e8bc48 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,6 +1,9 @@ version: 2 formats: all +build: + os: ubuntu-22.04 + tools: + python: "3.9" python: - version: 3 install: - - requirements: doc/requirements.txt \ No newline at end of file + - requirements: doc/requirements.txt diff --git a/doc/requirements.txt b/doc/requirements.txt index 6ba789a0..799f24f9 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,3 +1,4 @@ ipykernel nbsphinx numpy +sphinx_rtd_theme diff --git a/tobac/segmentation.py b/tobac/segmentation.py index b173f48c..2f346e42 100644 --- a/tobac/segmentation.py +++ b/tobac/segmentation.py @@ -104,8 +104,13 @@ def add_markers( marker_arr = marker_arr[np.newaxis, :, :] if seed_3D_flag == "column": - for index, row in features.iterrows(): - marker_arr[level, int(row["hdim_1"]), int(row["hdim_2"])] = row["feature"] + for _, row in features.iterrows(): + # Offset marker locations by 0.5 to find nearest pixel + marker_arr[ + level, + int(row["hdim_1"] + 0.5) % h1_len, + int(row["hdim_2"] + 0.5) % h2_len, + ] = row["feature"] elif seed_3D_flag == "box": # Get the size of the seed box from the input parameter @@ -123,7 +128,7 @@ def add_markers( seed_h1 = seed_3D_size seed_h2 = seed_3D_size - for index, row in features.iterrows(): + for _, row in features.iterrows(): if is_3D: # If we have a 3D input and we need to do box seeding # we need to have 3D features. @@ -781,7 +786,7 @@ def segmentation_timestep( if buddy == 0: continue # isolate feature from set of buddies - buddy_feat = features_in[features_in["feature"] == buddy] + buddy_feat = features_in[features_in["feature"] == buddy].iloc[0] # transform buddy feature position if needed for positioning in z2/y2/x2 space # MAY be redundant with what is done just below here diff --git a/tobac/utils/periodic_boundaries.py b/tobac/utils/periodic_boundaries.py index 18453465..9e4e7fdc 100644 --- a/tobac/utils/periodic_boundaries.py +++ b/tobac/utils/periodic_boundaries.py @@ -297,7 +297,10 @@ def weighted_circmean( angle_average = np.arctan2(sin_average, cos_average) % (2 * np.pi) rescaled_average = (angle_average * scaling_factor) + low # Round return value to try and supress rounding errors - return np.round(rescaled_average, 12) + rescaled_average = np.round(rescaled_average, 12) + if rescaled_average == high: + rescaled_average = low + return rescaled_average def transfm_pbc_point(in_dim, dim_min, dim_max):