Skip to content

Commit

Permalink
Fix bug in test_estimate_stabilization (#148)
Browse files Browse the repository at this point in the history
fix bug in non-integer z_idx
  • Loading branch information
ieivanov authored Jul 11, 2024
1 parent 7c7f964 commit 570ccfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 1 addition & 3 deletions mantis/cli/deskew.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import multiprocessing as mp

from pathlib import Path
from typing import List

Expand All @@ -21,7 +19,7 @@
@click.option(
"--num-processes",
"-j",
default=mp.cpu_count(),
default=1,
help="Number of cores",
required=False,
type=int,
Expand Down
6 changes: 5 additions & 1 deletion mantis/cli/estimate_stabilization.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ def estimate_xy_stabilization(
if (output_folder_path / "positions_focus.csv").exists():
df = pd.read_csv(output_folder_path / "positions_focus.csv")
pos_idx = str(Path(*input_data_path.parts[-3:]))
z_idx = list(df[df["position"] == pos_idx]["focus_idx"].replace(0, np.nan).ffill())
focus_idx = df[df["position"] == pos_idx]["focus_idx"]
# forward fill 0 values, when replace remaining NaN with the mean
focus_idx = focus_idx.replace(0, np.nan).ffill()
focus_idx = focus_idx.fillna(focus_idx.mean())
z_idx = focus_idx.astype(int).to_list()
else:
z_idx = [
focus_from_transverse_band(
Expand Down

0 comments on commit 570ccfd

Please sign in to comment.