Skip to main content

WOC - Weighted Overlap Coefficient

Python code to calculate the weighted overlap coefficient between 2 fields (2D or 3D) while considering masking.

Please cite J. Yoo et.al., (ApJS, Vol 261, Issue 2, 2022) arXiv:2205.08161

Install

Base (runtime only):

pip install pywoc

Optional extras:

  • Plotting support: pip install pywoc[plot]
  • Examples/tutorial deps (Astropy/Scipy/Matplotlib): pip install pywoc[examples]

From source:

python -m pip install git+https://github.com/csabiu/WOC.git

Running

from pywoc import woc

woc(map1, map2, radii, mask=None, centre=None, pixelsize=1, plot=False, savefig=None, rbins=20, maxr=None):

  • map1 -- 2‑D or 3-D numpy.ndarray representing the reference map/volume. The array shape defines the pixel/voxel grid and all values should be finite and non‑negative.

  • map2 -- second map/volume with the same shape as map1. Its units should match those of map1. Any NaN entries are ignored when the coefficient is calculated.

  • radii -- sequence of radius values used to define contours in map1. The values are interpreted in units of pixelsize (pixels if pixelsize is 1). For example [100, 200, 300] means 100, 200 and 300 pixels or, when pixelsize gives the physical pixel size, distances in those physical units.

  • optional parameters

    • mask -- boolean array with the same shape as the maps. 1 marks valid pixels/voxels and 0 masks them.
    • pixelsize -- conversion factor from pixel/voxel units to physical units.
    • rbins -- number of radial bins for the radial profile.
    • maxr -- maximum radius of the profile in pixel/voxel units.
    • centre -- profile centre. None uses the brightest pixel of map1; "mid" uses the geometric centre; [x, y] for 2D or [x, y, z] for 3D specifies explicit coordinates.
    • plot -- if True show diagnostic plots (only supported for 2D data).
    • savefig -- filename for plots when plot is True.

The call returns a single floating point value containing the weighted overlap coefficient between map1 and map2.

revision history

0.0.1 initial code release

0.1.0 added python notebook tutorial under /nb improved documentation

0.2.0 added a dynamic calculation of radial profile fixed some installation problems

0.3.0 added extra parameters to control the radial profile calculation

0.4.0 added some numba support

0.4.1 added radial profile vectorization and regression tests

0.4.2 bug fixes and performance improvements

0.5.0 extended to support 3D analysis

Metadata

Release files for pywoc 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywoc 0.5.0
File Size Uploaded Provenance Actions
pywoc-0.5.0.tar.gz 21.1 kB Without provenance Details for pywoc-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pywoc 0.5.0
File Interpreter ABI Platform Actions
pywoc-0.5.0-py3-none-any.whl Python 3 none any Details for pywoc-0.5.0-py3-none-any.whl

Total release size: 28.6 kB

Release files / pywoc-0.5.0.tar.gz

Download URL pywoc-0.5.0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fbccb5694325c3e8a52d24155cbf5722ead1d7c711b514a2a125ef18a5b304da
BLAKE2b-256 checksum
How to use checksums
1c71b697e45ffcde33fc117e9d300fbf9507181c683ffcdab48060b7ebe37a43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / pywoc-0.5.0-py3-none-any.whl

Download URL pywoc-0.5.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fa3b6fb62ccf5d839ca85092f5d7b039efc60fedd2e1e33a0c9b4badef621cf
BLAKE2b-256 checksum
How to use checksums
e40c067b592c6d44e9c4c10fb4656cbc1689d895bd37ace219c9b508852bbb20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for pywoc 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page