Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed bugs in points models #322

Merged
merged 3 commits into from
Jul 14, 2023
Merged

fixed bugs in points models #322

merged 3 commits into from
Jul 14, 2023

Conversation

LucaMarconato
Copy link
Member

Fixed bugs and added tests:

  • fixed bug (appearing with MERSCOPE data and described also here). In the case in which a dataframe is passed to PointsModel.parse() and the dataframe contains both x and another_x, and coordinates[x] = 'another_x, then the final parsed dataframe would contain the original column x and not another_x as expected. Added tests.
  • fixed bug where if coordinates.keys() are x and y, but the dataframe contains a z column, the z column is added to the metadata and the get_axis_names() would return x, y, z instead of x, y. Now the z column is not added. Added tests.
  • fixed bug same as above, but the parser gets a np.ndarray instead. I.e. if the parser receives a 2D array but the annotation dataframe contains z, now z is not added. Added tests.
  • PointsModels.parse() for dataframes now takes the paramter coordinates as optional. In such a case, if x, y, or x, y, z, are in the dataframe, it is assumed, respectively that coordinates is {'x': 'x', 'y': 'y'} and {'x': 'x', 'y': 'y, 'z', 'z''}. This improves the ergonomics of the parser and closes PointsModel default argument for coordinates #228. Added tests.

@LucaMarconato LucaMarconato requested a review from giovp July 14, 2023 16:17
@codecov
Copy link

codecov bot commented Jul 14, 2023

Codecov Report

Merging #322 (fc923be) into main (cdddb8b) will decrease coverage by 0.03%.
The diff coverage is 81.81%.

❗ Current head fc923be differs from pull request most recent head 4d6de6e. Consider uploading reports for the commit 4d6de6e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #322      +/-   ##
==========================================
- Coverage   90.75%   90.72%   -0.03%     
==========================================
  Files          36       36              
  Lines        4630     4638       +8     
==========================================
+ Hits         4202     4208       +6     
- Misses        428      430       +2     
Impacted Files Coverage Δ
src/spatialdata/models/models.py 86.14% <81.81%> (-0.21%) ⬇️

... and 2 files with indirect coverage changes

@LucaMarconato LucaMarconato merged commit 2028062 into main Jul 14, 2023
5 checks passed
@LucaMarconato LucaMarconato deleted the fix/points_model branch July 14, 2023 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PointsModel default argument for coordinates
2 participants