You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a repository containing implementations and utility functions for a variety of metrics that can be used to analyze the sharpness of meteorological image, as well as transform functions and a selection of synthetic and real data for use in examples. This is work conducted under the umbrella of [The NSF AI Institute for Research on Trustworthy AI in Weather, Climate, and Coastal Oceanography (AI2ES)](https://www.ai2es.org/). To find out more about the metrics included and how they can be used, see the [accompanying paper](https://www.ai2es.org/sharpness/), and if you make use of this repository, please cite that paper.
2
+
This is a repository containing implementations and utility functions for a variety of metrics that can be used to analyze the sharpness of meteorological image, as well as transform functions and a selection of synthetic and real data for use in examples. This is work conducted under the umbrella of [The NSF AI Institute for Research on Trustworthy AI in Weather, Climate, and Coastal Oceanography (AI2ES)](https://www.ai2es.org/). To find out more about the metrics included and how they can be used, see the [accompanying preprint](https://www.ai2es.org/sharpness/), and if you make use of this repository, please cite that paper. A peer-reviewed version is expected soon.
3
3
4
4
## Installation
5
5
@@ -11,118 +11,14 @@ To install with the specific versions used in the creation of this package, use
11
11
12
12
## Examples of use
13
13
14
-
There are a number of example notebooks in the [notebooks](/notebooks) folder, which serve as a set of examples for utilizing the low-level interface of this package. For a simple introduction to how to run experiments using transforms, see [experiment_demo.ipynb](/notebooks/experiment_demo.ipynb), and for more in-depth experiments see [experiments_imme_v2.ipynb](/notebooks/experiments_imme_v2.ipynb).
14
+
There are a number of example notebooks in the [notebooks](/notebooks) folder, which serve as a set of examples for utilizing the low-level interface of this package. For a simple introduction to how to run experiments using transforms, see [experiment_demo.ipynb](/notebooks/experiment_demo.ipynb), and for more in-depth experiments (including all those described in the accompanying paper,) see [paper_experiments.ipynb](/notebooks/paper_experiments.ipynb).
15
15
16
16
## Python interface
17
17
18
-
The principal utilities offered by this package can be found in [`src/__init__.py`](/src/__init__.py), and are the functions `compute_all_metrics_globally`, `compute_metric_globally`, `compute_all_metrics_locally`, `compute_metric_locally`, all of which take in a pair of images `X` and `T` and either compute all metrics, or just a specified single metric. In either case, computing "globally" means that the metric will be applied to the whole image (or pair of images) and a single number will be returned, while computing "locally" means that a heatmap of local metric values will be computed.
19
-
20
-
## Benchmark
21
-
22
-
This is a command line interface to compute and plot evaluations from different metrics and transformations on real or synthetic datasets.
18
+
The principal utilities offered by this package can be found in [`src/sharpness/high_level_functions.py`](/src/sharpness/high_level_functions.py) and made available as a base-level import with the sharpness package. These are the functions `compute_all_metrics_globally`, `compute_metric_globally`, `compute_all_metrics_locally`, `compute_metric_locally`, all of which take in a pair of images `X` and `T` and either compute all metrics, or just a specified single metric. In either case, computing "globally" means that the metric will be applied to the whole image (or pair of images) and a single number will be returned, while computing "locally" means that a heatmap of local metric values will be computed.
23
19
24
20
#### Input requirements
25
21
26
-
At this point, all functions (including the `benchmark.py` script) take as their input a single `n x m` grayscale image. If using these methods on multi-channel imagery, either convert the image to grayscale (if it is an RGB image) or loop over the channels and compute sharpness statistics individually.
27
-
28
-
Input data should be of float type; if the data are not already floats, certain metrics which require float type inputs will internally convert the data to floats.
--heatmap compute sharpness heatmap(s) rather than global metric
51
-
--visualize visualize and save the operations
52
-
--overlay only relevant if both heatmap and visualize are true; plots heatmaps on top of input data
53
-
-o OUTPUT, --output OUTPUT
54
-
name of output file visualization
55
-
```
56
-
57
-
Note that with the `--heatmap` option, each metric will be computed on small, overlapping tiles across the image; by default, these tiles will be square with side length equal to ~1/8th the width of the input image, and the stride forthese tiles will be 1/4 the side length of the tile. The image will also be padded using the "reflect" method by a number of pixels equal to ~1/16th the width of the input image. These parameters are adjustable by editing the appropriate functionin`__init__.py`.
58
-
59
-
#### Examples
60
-
61
-
Generate synthetic data, apply a blurring transformation, compute all metrics, and visualize/save the output.
Load the default data example, apply a vertical transformation, compute only the root-mean-square error, and visualize/save the output to the default name.
Heatmap will be computed with blocks of size 32, and has image padding of length 16
125
-
=> tv averages: (253952.0, 176779.0)
126
-
```
22
+
All functions take as their input a single `n x m` grayscale image. If using these methods on multi-channel imagery, either convert the image to grayscale (if it is an RGB image) or loop over the channels and compute sharpness statistics individually.
127
23
128
-

24
+
Input data should be of float type; if the data are not already floats, certain metrics which require float type inputs will internally convert the data to floats.
0 commit comments