h5max


Nameh5max JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/jdcla/h5max
Summaryscipy.sparse support on h5py
upload_time2022-12-01 09:07:35
maintainer
docs_urlNone
authorJim Clauwaert
requires_python>=3.9
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
<h1>h5max</h1>

A utility package built upon `h5py` for easier data saving and loading of sparse data objects.

[![PyPi Version](https://img.shields.io/pypi/v/h5max.svg)](https://pypi.python.org/pypi/h5max/)
[![GitHub license](https://img.shields.io/github/license/jdcla/h5max)](https://github.com/jdcla/h5max/blob/main/LICENSE.md)
[![GitHub issues](https://img.shields.io/github/issues/jdcla/h5max)](https://github.com/jdcla/h5max/issues)
[![GitHub stars](https://img.shields.io/github/stars/jdcla/h5max)](https://github.com/jdcla/h5max/stargazers)
</div>

`h5max` handles storing and loading of `scipy.sparse` data structures in `h5py` file objects, which is not natively supported. It assumes a simple data structure where information of individual samples are stored according to the index they occupy within datasets.  

<div align="center">
<img src="https://github.com/jdcla/h5max/raw/main/h5max.png" width="600">
</div>

## Installation

```bash
pip install h5max
```

## Usage

```python
import h5py
import h5max
import numpy as np

fh = h5py.File('my_data.h5', 'w')

a = np.zeros((100,100))
b = np.zeros((1000,50))
a[7,1] = 1
b[1,0] = 10

Ms = [a, b]

# store both a, b
h5max.store_sparse(fh, Ms, format='csr')

# load only a (index 0)
a_out = h5max.load_sparse(fh, 0, format='csr')

# load [a,b]
Ms_out = h5max.load_sparse(fh, [0, 1], format='csr')

fh.close()
```

# Package features

- [x] Support for `csr`, `csc`, `coo` sparse types
- [ ] Support for `bsr`, `dia`, `dok`, `lil` sparse types
- [x] Support for overwriting
- [x] Flexible data loading and saving (both as sparse and numpy arrays.)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jdcla/h5max",
    "name": "h5max",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jim Clauwaert",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/f7/45/da33aa2b5b7ed8126b2dc8391d212ed8dc05275b8723b1d39c4dc524d3d6/h5max-0.3.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n<h1>h5max</h1>\n\nA utility package built upon `h5py` for easier data saving and loading of sparse data objects.\n\n[![PyPi Version](https://img.shields.io/pypi/v/h5max.svg)](https://pypi.python.org/pypi/h5max/)\n[![GitHub license](https://img.shields.io/github/license/jdcla/h5max)](https://github.com/jdcla/h5max/blob/main/LICENSE.md)\n[![GitHub issues](https://img.shields.io/github/issues/jdcla/h5max)](https://github.com/jdcla/h5max/issues)\n[![GitHub stars](https://img.shields.io/github/stars/jdcla/h5max)](https://github.com/jdcla/h5max/stargazers)\n</div>\n\n`h5max` handles storing and loading of `scipy.sparse` data structures in `h5py` file objects, which is not natively supported. It assumes a simple data structure where information of individual samples are stored according to the index they occupy within datasets.  \n\n<div align=\"center\">\n<img src=\"https://github.com/jdcla/h5max/raw/main/h5max.png\" width=\"600\">\n</div>\n\n## Installation\n\n```bash\npip install h5max\n```\n\n## Usage\n\n```python\nimport h5py\nimport h5max\nimport numpy as np\n\nfh = h5py.File('my_data.h5', 'w')\n\na = np.zeros((100,100))\nb = np.zeros((1000,50))\na[7,1] = 1\nb[1,0] = 10\n\nMs = [a, b]\n\n# store both a, b\nh5max.store_sparse(fh, Ms, format='csr')\n\n# load only a (index 0)\na_out = h5max.load_sparse(fh, 0, format='csr')\n\n# load [a,b]\nMs_out = h5max.load_sparse(fh, [0, 1], format='csr')\n\nfh.close()\n```\n\n# Package features\n\n- [x] Support for `csr`, `csc`, `coo` sparse types\n- [ ] Support for `bsr`, `dia`, `dok`, `lil` sparse types\n- [x] Support for overwriting\n- [x] Flexible data loading and saving (both as sparse and numpy arrays.)\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "scipy.sparse support on h5py",
    "version": "0.3.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "3017f82d6034247d396134b3b33ca116",
                "sha256": "4ba0b985990b4d1acfb410f883ecb99251fd5b48a09d8ef161c2c7419afbbb24"
            },
            "downloads": -1,
            "filename": "h5max-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3017f82d6034247d396134b3b33ca116",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 3694,
            "upload_time": "2022-12-01T09:07:33",
            "upload_time_iso_8601": "2022-12-01T09:07:33.427697Z",
            "url": "https://files.pythonhosted.org/packages/3d/43/e39cd96fc91bff06143c8be144057e744ba73782fc83efd13d0ce2659eab/h5max-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "c506b03864e45cab3b8a74c4611b825a",
                "sha256": "23224d81bed356227cd56ba46740b91ffcbbb9e954023b05039bc9b7b4ee1726"
            },
            "downloads": -1,
            "filename": "h5max-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c506b03864e45cab3b8a74c4611b825a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 47497,
            "upload_time": "2022-12-01T09:07:35",
            "upload_time_iso_8601": "2022-12-01T09:07:35.126472Z",
            "url": "https://files.pythonhosted.org/packages/f7/45/da33aa2b5b7ed8126b2dc8391d212ed8dc05275b8723b1d39c4dc524d3d6/h5max-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-01 09:07:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jdcla",
    "github_project": "h5max",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "h5max"
}
        
Elapsed time: 0.04739s