fitsiochunked
Package to sequentially efficiently read large fits arrays in object by object
Free software: MIT license
Features
Sequentially read in large fits files, within a given fixed memory limit
Quick usage
The following example shows an example of reading in a large fits hdu within a memory limit of 2048MB, assuming light curves are stored in rows:
import numpy as np
import fitsio
import fitsiochunked as fc
with fitsio.FITS(filename) as infile:
hdu = infile['flux']
napertures = hdu.get_info()['ndim'][0]
mean_flux = np.zeros(napertures)
for chunk in fc.chunks(hdu, memory_limit_mb=2048):
# `chunk` is a namedtuple with `.data` and `.slice` properties
chunk_data = chunk.data
print('Data shape:', chunk_data.shape)
print('Data dtype:', chunk_data.dtype)
chunk_slice = chunk.slice
print('Chunk starting from aperture:', chunk_slice.start)
print('Chunk up to:', chunk_slice.stop)
chunk_mean = np.average(chunk_data, axis=1)
mean_flux[chunk_slice] = chunk_mean
Installation
Install with pip:
pip install git+https://github.com/mindriot101/fitsiochunked
or download and run the setup file:
git clone https://github.com/mindriot101/fitsiochunked
cd fitsiochunked
python setup.py install
When this code matures, it will be put up on pip.
Details
The high level interface is the chunks function, which builds a ChunkedAdapter object wrapping a fitsio.ImageHDU object.
The ChunkedAdapter wraps a fitsio HDU object. When constructed, it becomes a callable which yields the image data in that hdu in chunks.
The chunksize can be set either with with the parameter chunksize which simply yields chunksize rows each time, or with memory_limit_mb which tries (no promises!) to automatically calculate the number of lightcurves that will fit into memory_limit_mb megabytes of memory.
Metadata
Release files for fitsiochunked 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fitsiochunked-0.0.2.tar.gz | 5.2 kB | Without provenance | Details for fitsiochunked-0.0.2.tar.gz | |
| fitsiochunked-0.0.2.macosx-10.5-x86_64.tar.gz | 4.1 kB | Without provenance | Details for fitsiochunked-0.0.2.macosx-10.5-x86_64.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fitsiochunked-0.0.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for fitsiochunked-0.0.2-py2.py3-none-any.whl |
Total release size: 14.4 kB
Release files / fitsiochunked-0.0.2.tar.gz
| Download URL | fitsiochunked-0.0.2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0708ef8642c08dcc364eea88ccff4b6d91dd8cc1c8432019c0a2b798f7793c8
|
|
BLAKE2b-256 checksum How to use checksums |
6a31ef8199a070eaa50035e1da036ef7a1d11e2f76026e169663b794bd960784
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / fitsiochunked-0.0.2.macosx-10.5-x86_64.tar.gz
| Download URL | fitsiochunked-0.0.2.macosx-10.5-x86_64.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6239a95f6e2da03e2a9810b6487167df1c97bd4e883b51de0a7bc1ab2d0455ac
|
|
BLAKE2b-256 checksum How to use checksums |
9a5e5b49b13642cd5fd78c2edcbb89a98ec3f22ec1e40aba00605f70fce53bb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / fitsiochunked-0.0.2-py2.py3-none-any.whl
| Download URL | fitsiochunked-0.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5eb649b3dc6778a79b3a9cdae10f45c8ec54c2e5c8ca0112f7356988dc214089
|
|
BLAKE2b-256 checksum How to use checksums |
afbda84b4c408c5c3cbfcd27acc63c7721b0139c5b1c09207007a4c078e89050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for fitsiochunked 0.0.2
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.