Skip to content

Commit

Permalink
Run poetry run pre-commit run --all-files
Browse files Browse the repository at this point in the history
  • Loading branch information
tcompa committed Jun 21, 2024
1 parent bbae063 commit 8548573
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 7 additions & 9 deletions fractal_tasks_core/tasks/_registration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ def apply_registration_to_single_ROI_table(
return roi_table



def chi2_shift_out(img_ref, img_cycle_x):
"""
Helper function to get the output of chi2_shift into the same format as
Expand All @@ -252,17 +251,16 @@ def chi2_shift_out(img_ref, img_cycle_x):
Returns:
list: list of tuple of shift in y and x direction.
"""
x, y, a, b = chi2_shift(np.squeeze(img_ref),
np.squeeze(img_cycle_x))
x, y, a, b = chi2_shift(np.squeeze(img_ref), np.squeeze(img_cycle_x))

'''
"""
running into issues when using direct float output for fractal.
When rounding to integer and using integer dtype, it typically works
When rounding to integer and using integer dtype, it typically works
but for some reasons fails when run over a whole 384 well plate (but
the well where it fails works fine when run alone). The original verison
works fine however. Trying to round to integer, but still use float64
works fine however. Trying to round to integer, but still use float64
dtype like original version.
'''
shifts = np.array([-int(np.round(y)), -int(np.round(x))], dtype='float64')
"""
shifts = np.array([-int(np.round(y)), -int(np.round(x))], dtype="float64")

return [shifts]
return [shifts]
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
from fractal_tasks_core.tables import write_table
from fractal_tasks_core.tasks._registration_utils import (
calculate_physical_shifts,
)
from fractal_tasks_core.tasks._registration_utils import chi2_shift_out
from fractal_tasks_core.tasks._registration_utils import (
get_ROI_table_with_translation,
chi2_shift_out,
)
from fractal_tasks_core.tasks.io_models import InitArgsRegistration

Expand All @@ -59,7 +61,7 @@ def calculate_registration_image_based(
init_args: InitArgsRegistration,
# Core parameters
wavelength_id: str,
method: Literal[tuple([key for key,value in REG_METHODS.items()])],
method: Literal[tuple([key for key, value in REG_METHODS.items()])],
roi_table: str = "FOV_ROI_table",
level: int = 2,
) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ def patched_segment_ROI(

return mask.astype(label_dtype)

@pytest.mark.parametrize("method", ["phase_cross_correlation",
"chi2_shift"])

@pytest.mark.parametrize("method", ["phase_cross_correlation", "chi2_shift"])
def test_multiplexing_registration(
zenodo_images_multiplex_shifted: list[str],
tmp_path,
Expand Down

0 comments on commit 8548573

Please sign in to comment.