pywoc


Namepywoc JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttps://github.com/csabiu/woc
Summary2-D comparison
upload_time2025-08-19 01:42:26
maintainerNone
docs_urlNone
authorCristiano Sabiu
requires_python>=3.8
licenseGNU GPL v3 License
keywords woc spatial statistics statistics python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            WOC - Weighted Overlap Coefficient

Python code to calculate the weighted overlap coefficient between
2 fields 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 ``numpy.ndarray`` representing the reference map. The
  array shape defines the pixel grid and all values should be finite and
  non‑negative.

- **map2** -- second map 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 and ``0`` masks them.
    - ``pixelsize`` -- conversion factor from pixel units to physical units.
    - ``rbins`` -- number of radial bins for the radial profile.
    - ``maxr`` -- maximum radius of the profile in **pixel units**.
    - ``centre`` -- profile centre. ``None`` uses the brightest pixel of
      ``map1``; ``"mid"`` uses the geometric centre; ``[x, y]`` specifies explicit
      coordinates.
    - ``plot`` -- if ``True`` show diagnostic plots.
    - ``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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/csabiu/woc",
    "name": "pywoc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "woc, spatial statistics, statistics, python",
    "author": "Cristiano Sabiu",
    "author_email": "csabiu@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fc/36/184a815c904a4afc2608008f3a0a5d005ad476b7342c65a6ffadf3216420/pywoc-0.4.2.tar.gz",
    "platform": null,
    "description": "WOC - Weighted Overlap Coefficient\n\nPython code to calculate the weighted overlap coefficient between\n2 fields while considering masking.\n\nPlease cite J. Yoo et.al., (ApJS, Vol 261, Issue 2, 2022)\narXiv:2205.08161\n\nInstall\n-------\n\nBase (runtime only):\n\n    pip install pywoc\n\nOptional extras:\n\n- Plotting support: `pip install pywoc[plot]`\n- Examples/tutorial deps (Astropy/Scipy/Matplotlib): `pip install pywoc[examples]`\n\nFrom source:\n\n    python -m pip install git+https://github.com/csabiu/WOC.git\n\nRunning\n-------\n\nfrom pywoc import woc\n\nwoc(map1, map2, radii, mask=None, centre=None, pixelsize=1,\n    plot=False, savefig=None, rbins=20, maxr=None):\n\n- **map1** -- 2\u2011D ``numpy.ndarray`` representing the reference map. The\n  array shape defines the pixel grid and all values should be finite and\n  non\u2011negative.\n\n- **map2** -- second map with the **same shape** as ``map1``. Its units\n  should match those of ``map1``. Any ``NaN`` entries are ignored when the\n  coefficient is calculated.\n\n- **radii** -- sequence of radius values used to define contours in ``map1``.\n  The values are interpreted in units of ``pixelsize`` (pixels if\n  ``pixelsize`` is ``1``). For example ``[100, 200, 300]`` means 100, 200 and\n  300 pixels or, when ``pixelsize`` gives the physical pixel size, distances in\n  those physical units.\n\n- **optional parameters**\n    - ``mask`` -- boolean array with the same shape as the maps. ``1`` marks\n      valid pixels and ``0`` masks them.\n    - ``pixelsize`` -- conversion factor from pixel units to physical units.\n    - ``rbins`` -- number of radial bins for the radial profile.\n    - ``maxr`` -- maximum radius of the profile in **pixel units**.\n    - ``centre`` -- profile centre. ``None`` uses the brightest pixel of\n      ``map1``; ``\"mid\"`` uses the geometric centre; ``[x, y]`` specifies explicit\n      coordinates.\n    - ``plot`` -- if ``True`` show diagnostic plots.\n    - ``savefig`` -- filename for plots when ``plot`` is ``True``.\n\nThe call returns a single floating point value containing the weighted\noverlap coefficient between ``map1`` and ``map2``.\n\t\t    \nrevision history\n----------------\n\n0.0.1\ninitial code release\n\n0.1.0\nadded python notebook tutorial under /nb\nimproved documentation\n\n0.2.0\nadded a dynamic calculation of radial profile\nfixed some installation problems\n\n0.3.0\nadded extra parameters to control the radial profile calculation\n\n0.4.0\nadded some numba support\n\n0.4.1\nadded radial profile vectorization and regression tests\n",
    "bugtrack_url": null,
    "license": "GNU GPL v3 License",
    "summary": "2-D comparison",
    "version": "0.4.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/csabiu/WOC/issues",
        "Documentation": "https://github.com/csabiu/WOC#readme",
        "Homepage": "https://github.com/csabiu/woc",
        "Source": "https://github.com/csabiu/WOC"
    },
    "split_keywords": [
        "woc",
        " spatial statistics",
        " statistics",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fc36184a815c904a4afc2608008f3a0a5d005ad476b7342c65a6ffadf3216420",
                "md5": "7ce2db60874dc53073c92da75c169434",
                "sha256": "ff2f0fb1bc19447c15e566bf20746e29d0f702fb66d4ae1f6e30fa52eabbcec5"
            },
            "downloads": -1,
            "filename": "pywoc-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7ce2db60874dc53073c92da75c169434",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 18878,
            "upload_time": "2025-08-19T01:42:26",
            "upload_time_iso_8601": "2025-08-19T01:42:26.498596Z",
            "url": "https://files.pythonhosted.org/packages/fc/36/184a815c904a4afc2608008f3a0a5d005ad476b7342c65a6ffadf3216420/pywoc-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 01:42:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "csabiu",
    "github_project": "woc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pywoc"
}
        
Elapsed time: 3.93357s