objscale 0.1.0__tar.gz

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.
objscale-0.1.0/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Thomas D. DeWitt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: objscale
3
+ Version: 0.1.0
4
+ Summary: Object-based analysis functions for fractal dimensions and size distributions
5
+ Author-email: Thomas DeWitt <thomas.dewitt@utah.edu>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/thomasdewitt/objscale
8
+ Project-URL: Repository, https://github.com/thomasdewitt/objscale
9
+ Project-URL: Documentation, https://objscale.readthedocs.io
10
+ Project-URL: Issues, https://github.com/thomasdewitt/objscale/issues
11
+ Keywords: fractal,dimensions,size-distributions,object-analysis,perimeter,area
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: numpy>=1.20.0
27
+ Requires-Dist: scipy>=1.7.0
28
+ Requires-Dist: scikit-image>=0.18.0
29
+ Requires-Dist: numba>=0.56.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=6.0; extra == "dev"
32
+ Requires-Dist: pytest-cov; extra == "dev"
33
+ Requires-Dist: black; extra == "dev"
34
+ Requires-Dist: flake8; extra == "dev"
35
+ Requires-Dist: mypy; extra == "dev"
36
+ Provides-Extra: docs
37
+ Requires-Dist: sphinx>=4.0; extra == "docs"
38
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
39
+ Requires-Dist: numpydoc; extra == "docs"
40
+ Dynamic: license-file
41
+
42
+ # objscale
43
+
44
+ Object-based analysis functions for fractal dimensions and size distributions in atmospheric sciences and beyond. Optimized for large datasets.
45
+
46
+ ## Description
47
+
48
+ `objscale` provides computational tools for analyzing the scaling properties of objects in 2D binary arrays. The package consolidates methods for calculating size distributions and fractal dimensions that account for finite domain effects and complex boundary conditions. Originally developed for atmospheric science applications, these methods apply broadly to any field where object scaling properties matter.
49
+
50
+ The package implements methods from two main papers:
51
+
52
+ - [DeWitt & Garrett (2024)](https://acp.copernicus.org/articles/24/8457/2024/) - finite domain effects in size distributions
53
+ - DeWitt et al. (in prep) - fractal dimensions for cloud field characterization
54
+
55
+ ## Key Functions
56
+
57
+ ### `finite_array_powerlaw_exponent`
58
+
59
+ Calculate power-law exponents for size distributions while accounting for finite domain truncation effects. Essential for accurate scaling analysis in bounded domains.
60
+
61
+ ### `individual_fractal_dimension`
62
+
63
+ Fractal dimension of individual objects using the perimeter-area relationship, with proper handling of interior holes and resolution effects.
64
+
65
+ ### `ensemble_correlation_dimension`
66
+
67
+ Correlation dimension for characterizing the collective scaling properties of object ensembles. Uses point-pair correlation analysis across multiple length scales.
68
+
69
+ ### `ensemble_box_dimension`
70
+
71
+ Box-counting dimension for object ensembles. New analyses should prefer `ensemble_correlation_dimension`. Counts boxes containing object boundaries at varying spatial scales.
72
+
73
+ ### `ensemble_coarsening_dimension`
74
+
75
+ Novel fractal dimension based on how total object perimeter changes under spatial coarsening operations. New analyses should prefer `ensemble_correlation_dimension`. Used in [Rees et. al., 2024](https://npg.copernicus.org/articles/31/497/2024/)
76
+
77
+ ## Installation
78
+
79
+ ```bash
80
+ pip install objscale
81
+ ```
82
+
83
+ ## Quick Example
84
+
85
+ ```python
86
+ import objscale
87
+ import numpy as np
88
+
89
+ # Create binary array (e.g., cloud mask, percolation lattice)
90
+ arrays = [(np.random.random((1000, 1000)) < 0.3).astype(int) for _ in range(4)]
91
+
92
+ # Size distribution with finite domain corrections
93
+ (exponent, error), (log10_sizes, log10_counts) = objscale.finite_array_powerlaw_exponent(
94
+ arrays, 'area', return_counts=True
95
+ )
96
+
97
+ # Ensemble fractal dimensions
98
+ corr_dim, corr_error = objscale.ensemble_correlation_dimension(arrays)
99
+ box_dim, box_error = objscale.ensemble_box_dimension(arrays)
100
+
101
+ # Individual object analysis
102
+ ind_dim, ind_error = objscale.individual_fractal_dimension(arrays)
103
+ ```
104
+
105
+ ## Features
106
+
107
+ - **Finite domain corrections**: Proper handling of truncation effects at domain boundaries as recommended by [DeWitt & Garrett (2024)]([ACP - Finite domains cause bias in measured and modeled distributions of cloud sizes](https://acp.copernicus.org/articles/24/8457/2024/))
108
+ - **Multiple size metrics**: Area, perimeter, width, height, nested perimeter
109
+ - **Arbitrary boundaries**: Support for NaN-demarcated non-rectangular domains
110
+ - **Individual and Ensemble methods**: Characterize both individual and collective properties of object fields
111
+ - **Performance optimized**: Numba acceleration for computational efficiency. Can handle billions of individual objects on a mid-range laptop.
112
+
113
+ ## Requirements
114
+
115
+ - Python ≥ 3.8
116
+ - NumPy ≥ 1.20.0
117
+ - SciPy ≥ 1.7.0
118
+ - scikit-image ≥ 0.18.0
119
+ - Numba ≥ 0.56.0
120
+
121
+ ## Support Statement
122
+
123
+ This package consolidates research code developed over several years. While functional and tested, it should be considered research software with limited ongoing support. Users are encouraged to understand the underlying methods through the referenced papers before applying to their data.
124
+
125
+ ## References
126
+
127
+ If you use this package, please cite:
128
+
129
+ DeWitt, T. D. and Garrett, T. J.: Finite domains cause bias in measured and modeled
130
+ distributions of cloud sizes, Atmos. Chem. Phys., 24, 8457–8472,
131
+ https://doi.org/10.5194/acp-24-8457-2024, 2024.
132
+
133
+ ## Author
134
+
135
+ Thomas D. DeWitt
136
+ University of Utah Department of Atmospheric Sciences
137
+ Sonnet 4 with Claude Code
138
+ Anthropic
139
+
140
+ ## License
141
+
142
+ MIT License
@@ -0,0 +1,101 @@
1
+ # objscale
2
+
3
+ Object-based analysis functions for fractal dimensions and size distributions in atmospheric sciences and beyond. Optimized for large datasets.
4
+
5
+ ## Description
6
+
7
+ `objscale` provides computational tools for analyzing the scaling properties of objects in 2D binary arrays. The package consolidates methods for calculating size distributions and fractal dimensions that account for finite domain effects and complex boundary conditions. Originally developed for atmospheric science applications, these methods apply broadly to any field where object scaling properties matter.
8
+
9
+ The package implements methods from two main papers:
10
+
11
+ - [DeWitt & Garrett (2024)](https://acp.copernicus.org/articles/24/8457/2024/) - finite domain effects in size distributions
12
+ - DeWitt et al. (in prep) - fractal dimensions for cloud field characterization
13
+
14
+ ## Key Functions
15
+
16
+ ### `finite_array_powerlaw_exponent`
17
+
18
+ Calculate power-law exponents for size distributions while accounting for finite domain truncation effects. Essential for accurate scaling analysis in bounded domains.
19
+
20
+ ### `individual_fractal_dimension`
21
+
22
+ Fractal dimension of individual objects using the perimeter-area relationship, with proper handling of interior holes and resolution effects.
23
+
24
+ ### `ensemble_correlation_dimension`
25
+
26
+ Correlation dimension for characterizing the collective scaling properties of object ensembles. Uses point-pair correlation analysis across multiple length scales.
27
+
28
+ ### `ensemble_box_dimension`
29
+
30
+ Box-counting dimension for object ensembles. New analyses should prefer `ensemble_correlation_dimension`. Counts boxes containing object boundaries at varying spatial scales.
31
+
32
+ ### `ensemble_coarsening_dimension`
33
+
34
+ Novel fractal dimension based on how total object perimeter changes under spatial coarsening operations. New analyses should prefer `ensemble_correlation_dimension`. Used in [Rees et. al., 2024](https://npg.copernicus.org/articles/31/497/2024/)
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pip install objscale
40
+ ```
41
+
42
+ ## Quick Example
43
+
44
+ ```python
45
+ import objscale
46
+ import numpy as np
47
+
48
+ # Create binary array (e.g., cloud mask, percolation lattice)
49
+ arrays = [(np.random.random((1000, 1000)) < 0.3).astype(int) for _ in range(4)]
50
+
51
+ # Size distribution with finite domain corrections
52
+ (exponent, error), (log10_sizes, log10_counts) = objscale.finite_array_powerlaw_exponent(
53
+ arrays, 'area', return_counts=True
54
+ )
55
+
56
+ # Ensemble fractal dimensions
57
+ corr_dim, corr_error = objscale.ensemble_correlation_dimension(arrays)
58
+ box_dim, box_error = objscale.ensemble_box_dimension(arrays)
59
+
60
+ # Individual object analysis
61
+ ind_dim, ind_error = objscale.individual_fractal_dimension(arrays)
62
+ ```
63
+
64
+ ## Features
65
+
66
+ - **Finite domain corrections**: Proper handling of truncation effects at domain boundaries as recommended by [DeWitt & Garrett (2024)]([ACP - Finite domains cause bias in measured and modeled distributions of cloud sizes](https://acp.copernicus.org/articles/24/8457/2024/))
67
+ - **Multiple size metrics**: Area, perimeter, width, height, nested perimeter
68
+ - **Arbitrary boundaries**: Support for NaN-demarcated non-rectangular domains
69
+ - **Individual and Ensemble methods**: Characterize both individual and collective properties of object fields
70
+ - **Performance optimized**: Numba acceleration for computational efficiency. Can handle billions of individual objects on a mid-range laptop.
71
+
72
+ ## Requirements
73
+
74
+ - Python ≥ 3.8
75
+ - NumPy ≥ 1.20.0
76
+ - SciPy ≥ 1.7.0
77
+ - scikit-image ≥ 0.18.0
78
+ - Numba ≥ 0.56.0
79
+
80
+ ## Support Statement
81
+
82
+ This package consolidates research code developed over several years. While functional and tested, it should be considered research software with limited ongoing support. Users are encouraged to understand the underlying methods through the referenced papers before applying to their data.
83
+
84
+ ## References
85
+
86
+ If you use this package, please cite:
87
+
88
+ DeWitt, T. D. and Garrett, T. J.: Finite domains cause bias in measured and modeled
89
+ distributions of cloud sizes, Atmos. Chem. Phys., 24, 8457–8472,
90
+ https://doi.org/10.5194/acp-24-8457-2024, 2024.
91
+
92
+ ## Author
93
+
94
+ Thomas D. DeWitt
95
+ University of Utah Department of Atmospheric Sciences
96
+ Sonnet 4 with Claude Code
97
+ Anthropic
98
+
99
+ ## License
100
+
101
+ MIT License
@@ -0,0 +1,56 @@
1
+ # objscale/__init__.py
2
+ from ._size_distributions import (
3
+ finite_array_size_distribution,
4
+ finite_array_powerlaw_exponent,
5
+ array_size_distribution,
6
+ )
7
+
8
+ from ._fractal_dimensions import (
9
+ individual_fractal_dimension,
10
+ ensemble_correlation_dimension,
11
+ ensemble_box_dimension,
12
+ ensemble_coarsening_dimension,
13
+ total_perimeter,
14
+ total_number,
15
+ isolate_largest_structure,
16
+ coarsen_array,
17
+ )
18
+
19
+ from ._object_analysis import (
20
+ get_structure_props,
21
+ remove_structures_touching_border_nan,
22
+ label_periodic_boundaries,
23
+ remove_structure_holes,
24
+ clear_border_adjacent,
25
+ )
26
+
27
+ from ._utils import (
28
+ linear_regression,
29
+ encase_in_value,
30
+ )
31
+
32
+ __all__ = [
33
+ 'finite_array_size_distribution',
34
+ 'finite_array_powerlaw_exponent',
35
+ 'array_size_distribution',
36
+ 'individual_fractal_dimension',
37
+ 'ensemble_correlation_dimension',
38
+ 'ensemble_box_dimension',
39
+ 'ensemble_coarsening_dimension',
40
+ 'total_perimeter',
41
+ 'total_number',
42
+ 'isolate_largest_structure',
43
+ 'coarsen_array',
44
+ 'get_structure_props',
45
+ 'remove_structures_touching_border_nan',
46
+ 'label_periodic_boundaries',
47
+ 'remove_structure_holes',
48
+ 'clear_border_adjacent',
49
+ 'linear_regression',
50
+ 'encase_in_value',
51
+ ]
52
+
53
+ __version__ = "0.1.0"
54
+ __author__ = "Thomas DeWitt"
55
+ __email__ = "thomas.dewitt@utah.edu"
56
+ __description__ = "Object-based analysis functions for fractal dimensions and size distributions"