teamtomo / cryotypes

Super-simple data structures for cryo-electron tomography data
Other
4 stars 2 forks source link

Stronger validation #7

Closed brisvag closed 2 years ago

brisvag commented 2 years ago

First of all, sorry for the big blob of changes, at this stage it's aways easier to refactor a lot of things than splitting in small atomic changes... In summary:

validation was not quite there yet; especially ndim guessing was failing regularly (reshape(-1, 2) was working for any array with even number of elements :P). I added a bunch of checks for data types and values that hopefully should ensure the object is indeed complying.

In here, we currently intermix 2 types of validation without distinction, which is probably bad: checking if thigns are correct (validate_cryopose) and enforcing correct things as much as possible (validate_positions). We should probably formalize this, because I can see cases where someone wants the positions in 3D no matter what (just pad it if 2D)

brisvag commented 2 years ago

Objeying to pre-commit made me do some more changes... weirdly, pre-commit *really insisted on 2 things:

No clue why.