Skip to content

Conversation

camisowers
Copy link
Contributor

@camisowers camisowers commented May 1, 2023

If you haven't already, please read through our contributing guidelines before opening your PR

What is the purpose of this PR?

Closes #975. Adds ability to account for multiple tiles in ark stitching.

How did you implement your changes

Adjust the output of alpineer.load_utils.load_tiled_img_data to be a list of tuples. Loop through the various tuples, since each should indicate an individual tiled grid.

Also angelolab/alpineer#25 changed the error message for empty lists in verify_in_list, so the spatial_lda_utils_test was adjusted.

Remaining issues

  • Add multiple tile testing

@camisowers camisowers added the bug Something isn't working label May 1, 2023
@camisowers camisowers self-assigned this May 1, 2023
@camisowers camisowers requested review from srivarra and alex-l-kong May 4, 2023 20:35
@camisowers camisowers marked this pull request as ready for review May 4, 2023 20:35
@camisowers
Copy link
Contributor Author

@srivarra Could use your input on how alpineer.misc_utils.verify_in_list now handles empty lists.

@srivarra
Copy link
Contributor

srivarra commented May 4, 2023

@camisowers If either list (or both) are none, it immediately returns True.

@camisowers
Copy link
Contributor Author

camisowers commented May 4, 2023

@camisowers If either list (or both) are none, it immediately returns True.

What was the reasoning there? Just curious because it looks like spatial_lda_utils_test.test_check_format_cell_table_args specifically tests empty lists to trigger an error.

Copy link
Contributor

@srivarra srivarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple of small comments.

@@ -51,11 +51,11 @@ def test_check_format_cell_table_args():
spu.check_format_cell_table_args(valid_df, invalid_markers1, None)
with pytest.raises(ValueError):
spu.check_format_cell_table_args(valid_df, invalid_markers2, None)
with pytest.raises(ValueError, match=r"List arguments cannot be empty"):
with pytest.raises(ValueError, match=r"empty"):
Copy link
Contributor

@srivarra srivarra May 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alpineer.misc_utils.verify_in_list will return True if the lists are empty, do you think it would be better to do something else? Here is the original PR for that change: angelolab/alpineer#25. Let me know your thoughts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can discuss at pipeline today. I think it really just depends on what we're using verify_in_lists for and if empty lists are considered something we would want to know about.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could handle this by setting a flag to override the default set behavior of empty lists. Something like fail_on_empty which defaults to True.

Since I'd imagine empty lists aren't the desired behavior for many users, we could also completely change verify_in_list and verify_same_elements to fail immediately on discovery of an empty list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srivarra @alex-l-kong For now, I'm going to check within the function for an empty list. We can make long term changes to alpineer later if needed.

@srivarra
Copy link
Contributor

srivarra commented May 4, 2023

@camisowers

What was the reasoning there?

I think the reasoning had something to do with the mathematics of sets, since that's what we are effectively doing. The empty Set is a member of the empty Set.

@srivarra
Copy link
Contributor

srivarra commented May 4, 2023

Looks like docs aren't building, there is a thread here with everyone experiencing the same issue: urllib3/urllib3#2168. One solution is to cap urllib3 with urllib3<2 in the rtd-requirements.txt.

@alex-l-kong
Copy link
Contributor

Looks like docs aren't building, there is a thread here with everyone experiencing the same issue: urllib3/urllib3#2168. One solution is to cap urllib3 with urllib3<2 in the rtd-requirements.txt.

Pinning requests==2.28.0 also worked for me.

Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more comment on top of @srivarra.

@@ -51,11 +51,11 @@ def test_check_format_cell_table_args():
spu.check_format_cell_table_args(valid_df, invalid_markers1, None)
with pytest.raises(ValueError):
spu.check_format_cell_table_args(valid_df, invalid_markers2, None)
with pytest.raises(ValueError, match=r"List arguments cannot be empty"):
with pytest.raises(ValueError, match=r"empty"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could handle this by setting a flag to override the default set behavior of empty lists. Something like fail_on_empty which defaults to True.

Since I'd imagine empty lists aren't the desired behavior for many users, we could also completely change verify_in_list and verify_same_elements to fail immediately on discovery of an empty list.

@camisowers camisowers requested review from alex-l-kong and srivarra May 4, 2023 23:39
Copy link
Contributor

@srivarra srivarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@camisowers camisowers requested a review from ngreenwald May 5, 2023 16:58
Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ngreenwald ngreenwald added this pull request to the merge queue May 5, 2023
@srivarra
Copy link
Contributor

srivarra commented May 5, 2023

@ngreenwald Looks like the Merge Queue issue relates to coveralls not being able to report back in merge queues. As such I've disabled the expected coveralls report for now.

@srivarra srivarra removed this pull request from the merge queue due to a manual request May 5, 2023
@srivarra srivarra added this pull request to the merge queue May 5, 2023
Merged via the queue into main with commit fb50d0f May 5, 2023
@srivarra srivarra deleted the multiple_tile_stitching branch May 5, 2023 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alpineer updates causing tiled stitching errors
4 participants