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

transform and models #52

Merged
merged 168 commits into from
Dec 12, 2022
Merged

transform and models #52

merged 168 commits into from
Dec 12, 2022

Conversation

giovp
Copy link
Member

@giovp giovp commented Nov 29, 2022

This PR implements transforms (#22 and model validation and parsing (#40) for SpatialData.

giovp and others added 30 commits August 17, 2022 09:05
* add io test

* [pre-commit.ci] pre-commit autoupdate (#13)

updates:
- [github.com/asottile/yesqa: v1.3.0 → v1.4.0](asottile/yesqa@v1.3.0...v1.4.0)
- [github.com/PyCQA/flake8: 5.0.1 → 5.0.4](PyCQA/flake8@5.0.1...5.0.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@giovp
Copy link
Member Author

giovp commented Dec 10, 2022

ok all models test are now there. the table model is a bit flaky but I think fine for now, expecting changes as we play around with datasets. @LucaMarconato IMHO merge whenever you want

@LucaMarconato
Copy link
Member

Great @giovp, good for me. Please @kevinyamauchi or @ivirshup merge anytime

@LucaMarconato LucaMarconato self-requested a review December 10, 2022 17:00
Copy link
Collaborator

@kevinyamauchi kevinyamauchi left a comment

Choose a reason for hiding this comment

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

Thanks for this massive effort @giovp and @LucaMarconato ! This looks like a great start. I propose to optimistically merge this tonight.

I have made a few comments below that I will turn into issues so we can address them as the code base stabilizes.

Thanks again ! 🚀

  • There are a lot of commented out blocks of code. We should delete them.
  • Many functions are missing docstrings
  • The tests look fairly comprehensive, but it is difficult to tell what they are testing. I think we should both break them up into smaller tests and add comments/docstrings to explain what they are testing. Tests are an important form of documentation for contributors - especially contributors who are not part of writing the original code!

@@ -87,12 +87,12 @@ def name(self) -> Optional[str]:
return self._name

@property
def axes_names(self) -> List[str]:
return [ax.name for ax in self._axes]
def axes_names(self) -> Tuple[str, ...]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it makes more sense grammatically to all these axis_names/axis_types

Copy link
Collaborator

Choose a reason for hiding this comment

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

Made an issue #67



@singledispatch
def get_transform(e: SpatialElement) -> BaseTransformation:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should add a docstring here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Included this in issue #65

@@ -0,0 +1,578 @@
"""This file contains models and schema for SpatialData"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should split up the models into separate files so it is easier to read/navigate.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Made an issue #66

spatialdata/_core/transformations.py Show resolved Hide resolved
self.rotation = self._parse_list_into_array(rotation)

@classmethod
def _from_dict(cls, d: Transformation_t) -> Self: # type: ignore[valid-type]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this the correct type annotation?

Copy link
Member

Choose a reason for hiding this comment

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

Yes but mypy complains when it see Self. Maybe someone have a look please.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is indeed weird but I think Self might be valid in newer python versions?

This was referenced Dec 11, 2022
@giovp
Copy link
Member Author

giovp commented Dec 12, 2022

LGTM!

@giovp giovp merged commit ef9b92a into main Dec 12, 2022
@giovp giovp deleted the feature/transform_and_schema branch December 12, 2022 12:45
@kevinyamauchi kevinyamauchi mentioned this pull request Dec 13, 2022
3 tasks
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.

5 participants