ngio 0.2.8__py3-none-any.whl → 0.3.0a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  ngio/__init__.py,sha256=zce-RIfRhkiFyfKwO6s7A1-9ZCD3n6RuVuW3GeRj_VA,1309
2
- ngio/common/__init__.py,sha256=tMKp1eZzGfpdKDkpfHn0iVzSO11dmp-RZARpuxoGGQk,1351
2
+ ngio/common/__init__.py,sha256=BttXCAV2ks6_oXVDfapk1Lvlxp4J0ffX7-FXR3LL1BM,1834
3
3
  ngio/common/_array_pipe.py,sha256=we3gZLhgUsiPQwPQqg_XVkyG_9EpQ2xoe0L_nOALDho,7828
4
4
  ngio/common/_axes_transforms.py,sha256=kWU0M5erNmgWBXdu5LNv-tLW3jqkT00MMYX7cz-kyHs,2035
5
5
  ngio/common/_common_types.py,sha256=OkAYNSNjZkixL1MI-HPBVuXamheFBr862uJ4PvTxmhk,129
@@ -8,16 +8,17 @@ ngio/common/_masking_roi.py,sha256=-o6meGP17iTXEbkO9aGh1VX2drkc2laIcRJvCy_pRRM,4
8
8
  ngio/common/_pyramid.py,sha256=SJzPauuduuqcm9B7nFCJhMTzIg6Knjsnp4CY4lN61Is,7411
9
9
  ngio/common/_roi.py,sha256=dq1iVT8-G_zWuxcYWJeHfviBSbPgsyKUcDL3Vg6jx6I,5122
10
10
  ngio/common/_slicer.py,sha256=AKpwXRncOmF9nhjKYma0C_41WqAgSv860beKGx-aw-0,3075
11
+ ngio/common/_table_ops.py,sha256=oTjCcecBOG_GJoLgJLgag6yl_nznThOKBKANQJow0h8,15493
11
12
  ngio/common/_zoom.py,sha256=KsURa5VuixmpbAAY5-6obmuQV8vfiHKZqBxZDXvchpM,5473
12
13
  ngio/hcs/__init__.py,sha256=5oAYT_454WGhms97kxo8gS4_rKHtFf_x-9uu8M_VeVM,356
13
- ngio/hcs/plate.py,sha256=WmUw8qZgWUPBBTqtV8lh_7T0vtRzMkAmduM8b969Ni4,30082
14
+ ngio/hcs/plate.py,sha256=kGttwZu9JY5maRnfyO1RcOxoxi5OTk-uST5mRU5BJbY,43749
14
15
  ngio/images/__init__.py,sha256=DYbXAdBgPxyjBRdJrWvU0UnBRI0gUMmx9KaJ-Bucvz4,533
15
16
  ngio/images/abstract_image.py,sha256=8PNQPZjiDz-pcTFXSJAVw7nUr4yL_iRwqDEUTKkAnp0,10266
16
17
  ngio/images/create.py,sha256=XYn30m_2OSZeHHASYHc3eK9u_gZIYy9wo6mGdRGaq5c,9473
17
18
  ngio/images/image.py,sha256=mKLIR2DGQUWtQbf3my2fh0bEPkbbsabUoge_XJPhfWE,17824
18
19
  ngio/images/label.py,sha256=qgbBHFPGYpUR2fHf1OiXZh4sn0FgCeeWwH1F4SrOM1c,10460
19
20
  ngio/images/masked_image.py,sha256=IBo8x2jHyXBXn7ORo8fSiwBPjV_1JOTb_vatjKNxbJ0,8531
20
- ngio/images/ome_zarr_container.py,sha256=-9bbzNtsVAjU1X_h78Lr5LOV0JXtOiWVWqmt3DFpXus,28927
21
+ ngio/images/ome_zarr_container.py,sha256=a59d3AsKsANs7c7Ip7e734kSo4qV-Gsc_epxtGkS3Tk,30056
21
22
  ngio/ome_zarr_meta/__init__.py,sha256=oZ8PEsWM7U0KwzpsnvVfX9k4UfuTz5sZ8B6B9eY5hyY,1193
22
23
  ngio/ome_zarr_meta/_meta_handlers.py,sha256=BLvYt5PONYrWkEb2XgEiAXR_OX9rfeX_C0eEqen0jQA,25549
23
24
  ngio/ome_zarr_meta/ngio_specs/__init__.py,sha256=05NQukZG0nNvjzf8AKWGu7PhjhQcImGSAOK3D3Bg-Js,1786
@@ -30,28 +31,31 @@ ngio/ome_zarr_meta/ngio_specs/_pixel_size.py,sha256=5TT8250XdCKUnk3OwZeyXIMNFKOg
30
31
  ngio/ome_zarr_meta/v04/__init__.py,sha256=dJRzzxyYc81kf-0Hip_bqvbdManaM8XTdQX2meWyCSs,583
31
32
  ngio/ome_zarr_meta/v04/_custom_models.py,sha256=5GxiDERvLuvq4QvApcA6EiKLS6hLFX1R0R_9rSaa85A,530
32
33
  ngio/ome_zarr_meta/v04/_v04_spec_utils.py,sha256=05tEr2eEP_XVIfBMOAWLT7lzJV4KS5eYrpK8l94tn3w,15876
33
- ngio/tables/__init__.py,sha256=gxvNvAgLePgrngOm06H5qU50Axc6boeIs5iCfrmqTi0,609
34
- ngio/tables/_validators.py,sha256=7Eqln9j1tWmNakSCnryy2q39SbTuk6V31O2iMByTWWw,3363
35
- ngio/tables/tables_container.py,sha256=DFlz_6ts5p0lHkm6NMBtKZget30OicCYHrLbiG4xU1s,10188
36
- ngio/tables/backends/__init__.py,sha256=Y9MIFefwUaSmhhv5FDZFn7jBdYXDML2FovO-uK-vxgI,936
37
- ngio/tables/backends/_abstract_backend.py,sha256=--4qeVHs4YRo5i5XsREmDm6BxMsQ5tIqc6XZ810GJno,8776
34
+ ngio/tables/__init__.py,sha256=9-9atLClIQGkRFuECEg9AcmybHTAkQIpPg2jkL9hLyA,773
35
+ ngio/tables/abstract_table.py,sha256=pG0Yg4kbA4JDqhyNj1nMDAv3MqquJjKwFuD52jk-6-w,8210
36
+ ngio/tables/tables_container.py,sha256=FyuuRX7v0DCbTJ9a0vl0bMUM5cdjOC7Xhndp2JMweRo,12039
37
+ ngio/tables/backends/__init__.py,sha256=QhqvPvGX1pmEIQHoVNpRj6OMYzsoiAHFJiMbc87Z54c,1499
38
+ ngio/tables/backends/_abstract_backend.py,sha256=tsbHzSPTX88fiCbVc8khXv5aN68ck6HKG8r5OHkY3S8,7457
38
39
  ngio/tables/backends/_anndata_utils.py,sha256=DBWIcR0btnH-DIvDvzlcnMXoYhhtXc9DstryiOP0Qsg,3122
39
- ngio/tables/backends/_anndata_v1.py,sha256=5p_8pWUkYM4rEhm7g-b2yCXt2mmyd6lFisc1ubksAio,2469
40
- ngio/tables/backends/_csv_v1.py,sha256=o5AGlBH3UQdXx6MP2DtMm7zmXkOwnBBzu5TKk-QgQdI,5847
41
- ngio/tables/backends/_json_v1.py,sha256=7ALjB2thKTxPBeYOleqn2LNuAy6erp0Nzd-GZ9Xcd4Y,3079
42
- ngio/tables/backends/_table_backends.py,sha256=NXdH4pxo9XWZ_YxC5RVaw4PTOg-do30c3vlIy8KG4vQ,5831
43
- ngio/tables/backends/_utils.py,sha256=D0zI8_b6HEBZ2ER-80JvEEh_2-aCC1kpyKJGDPBPHco,14661
44
- ngio/tables/v1/__init__.py,sha256=XWi6f_KbjbX45Ku-7uymJRSTVWyFAPAAEp_TXDeZV4s,314
45
- ngio/tables/v1/_feature_table.py,sha256=2pZEENyZAmn_Awezu8VLGq90d-J7aXd6Ry8gNNR0wAQ,6104
46
- ngio/tables/v1/_generic_table.py,sha256=O2fu8k_TjhWEZtJxlU3Uj7ZTZnc75vLlvjw5lweSnd8,5710
47
- ngio/tables/v1/_roi_table.py,sha256=zGoISSC5q0UHyc0hcxfm2xpw2W6wUocoYctdi5nMmwg,11460
40
+ ngio/tables/backends/_anndata_v1.py,sha256=6WIF4r7fweENdoLamt_B-Y9NFDw7n3HAxZ65jrCS16Q,2590
41
+ ngio/tables/backends/_csv_v1.py,sha256=euWiqcvqaKhLuP_4ZiPPvOvWz3a3LKJdr00Nsh18ZEs,951
42
+ ngio/tables/backends/_json_v1.py,sha256=mQsi47g5pevQU9ElM176QNpmMDzRrZBEqiRd0k78-yI,3153
43
+ ngio/tables/backends/_non_zarr_backends_v1.py,sha256=SvPPhT6n5TrKUOyV1mNcdHQK49huZ5lwR8EVe9MdydM,7254
44
+ ngio/tables/backends/_parquet_v1.py,sha256=FGrcZKsNoYTaq_I49v2hNemy-My5HrlmRuawo0fPXEI,1417
45
+ ngio/tables/backends/_table_backends.py,sha256=Y_Hc-l4h3FixYf1MoaA1IoaojVWvefdHG7qP6Z1p4po,6492
46
+ ngio/tables/backends/_utils.py,sha256=tJBSWN6OhO_1ybxl4vT2l3ImB028Fb6h0vaitPRcr8A,19668
47
+ ngio/tables/v1/__init__.py,sha256=iFRO1oQKMJeSP2qOJiPkaySmqPnPvHSwrW30tPVYPuU,418
48
+ ngio/tables/v1/_condition_table.py,sha256=Dc06AB9-bu3pqjE6BypfJ5exuFEryevQ-W85lCLlaMc,1793
49
+ ngio/tables/v1/_feature_table.py,sha256=svQbCSfWSHlR2DQ8wPpb3yOJbCba9ywLpkb9N7S5CCw,3710
50
+ ngio/tables/v1/_generic_table.py,sha256=VlgvUpghmhAx0l2kLH6ngye_K7FkgefpbVJ9x02XIvw,998
51
+ ngio/tables/v1/_roi_table.py,sha256=3gXE60Uj1CJw04le9-QclCOCzv0w6UU9-PwUoaVNmpI,13490
48
52
  ngio/utils/__init__.py,sha256=r3nuLWgp6-cQlS4ODjYSBrfgdTLkCOVke9jKbn1NpkA,1129
49
53
  ngio/utils/_datasets.py,sha256=EdYJHIifpRou4f43dIuiKsdxe4K6FaeS4f1_e_EYrcI,1727
50
54
  ngio/utils/_errors.py,sha256=pKQ12LUjQLYE1nUawemA5h7HsgznjaSvV1n2PQU33N0,759
51
- ngio/utils/_fractal_fsspec_store.py,sha256=7qoGLiLi8JQFh9Ej_z5WNwQQuWrujb0f6p9nj8ocsS8,548
55
+ ngio/utils/_fractal_fsspec_store.py,sha256=0PMqPRCw7CYdLPxsNtp_vMLXfiQVwqs5EWrn2YVEuvA,1549
52
56
  ngio/utils/_logger.py,sha256=HIuqD_2ShfFGDswBddcouStbKfL0Vz_ah8cAIFGhbS8,888
53
57
  ngio/utils/_zarr_utils.py,sha256=qOI-HL2HsfFLCj_yxsTR-aq4oHpSqS9KR13aEIvhGDY,13593
54
- ngio-0.2.8.dist-info/METADATA,sha256=Rf7imDRysf67wo02l22A8DX2TjeWQLndDdzPp48YncY,5215
55
- ngio-0.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
- ngio-0.2.8.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
57
- ngio-0.2.8.dist-info/RECORD,,
58
+ ngio-0.3.0a0.dist-info/METADATA,sha256=FxmotsQBOZBxJrlxV9T9Ne_dcfd4apr2arZHV9OOixM,5241
59
+ ngio-0.3.0a0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
60
+ ngio-0.3.0a0.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
61
+ ngio-0.3.0a0.dist-info/RECORD,,
@@ -1,108 +0,0 @@
1
- from collections.abc import Iterable
2
- from typing import Protocol
3
-
4
- import pandas as pd
5
-
6
- from ngio.utils import NgioTableValidationError
7
-
8
-
9
- class TableValidator(Protocol):
10
- def __call__(self, table: pd.DataFrame) -> pd.DataFrame:
11
- """Validate the table DataFrame.
12
-
13
- A Validator is just a simple callable that takes a
14
- DataFrame and returns a DataFrame.
15
-
16
- If the DataFrame is valid, the same DataFrame is returned.
17
- If the DataFrame is invalid, the Validator can either modify the DataFrame
18
- to make it valid or raise a NgioTableValidationError.
19
-
20
- Args:
21
- table (pd.DataFrame): The DataFrame to validate.
22
-
23
- Returns:
24
- pd.DataFrame: The validated DataFrame.
25
-
26
- """
27
- ...
28
-
29
-
30
- def validate_table(
31
- table_df: pd.DataFrame,
32
- validators: Iterable[TableValidator] | None = None,
33
- ) -> pd.DataFrame:
34
- """Validate the table DataFrame.
35
-
36
- Args:
37
- table_df (pd.DataFrame): The DataFrame to validate.
38
- validators (Collection[Validator] | None): A collection of functions
39
- used to validate the table. Default is None.
40
-
41
- Returns:
42
- pd.DataFrame: The validated DataFrame.
43
- """
44
- validators = validators or []
45
-
46
- # Apply all provided validators
47
- for validator in validators:
48
- table_df = validator(table_df)
49
-
50
- return table_df
51
-
52
-
53
- ####################################################################################################
54
- #
55
- # Common table validators
56
- #
57
- ####################################################################################################
58
- def validate_columns(
59
- table_df: pd.DataFrame,
60
- required_columns: list[str],
61
- optional_columns: list[str] | None = None,
62
- ) -> pd.DataFrame:
63
- """Validate the columns headers of the table.
64
-
65
- If a required column is missing, a TableValidationError is raised.
66
- If a list of optional columns is provided, only required and optional columns are
67
- allowed in the table.
68
-
69
- Args:
70
- table_df (pd.DataFrame): The DataFrame to validate.
71
- required_columns (list[str]): A list of required columns.
72
- optional_columns (list[str] | None): A list of optional columns.
73
- Default is None.
74
-
75
- Returns:
76
- pd.DataFrame: The validated DataFrame.
77
- """
78
- table_header = table_df.columns
79
- for column in required_columns:
80
- if column not in table_header:
81
- raise NgioTableValidationError(
82
- f"Could not find required column: {column} in the table"
83
- )
84
-
85
- if optional_columns is None:
86
- return table_df
87
-
88
- possible_columns = [*required_columns, *optional_columns]
89
- for column in table_header:
90
- if column not in possible_columns:
91
- raise NgioTableValidationError(
92
- f"Could not find column: {column} in the list of possible columns. ",
93
- f"Possible columns are: {possible_columns}",
94
- )
95
-
96
- return table_df
97
-
98
-
99
- def validate_unique_index(table_df: pd.DataFrame) -> pd.DataFrame:
100
- """Validate that the index of the table is unique."""
101
- if table_df.index.is_unique:
102
- return table_df
103
-
104
- # Find the duplicates
105
- duplicates = table_df.index[table_df.index.duplicated()].tolist()
106
- raise NgioTableValidationError(
107
- f"Index of the table contains duplicates values. Duplicate: {duplicates}"
108
- )
File without changes