Skip to main content

Read functions for THEMIS ASI PGM raw files

Project description

THEMIS All-Sky Imager Raw PGM Data Readfile

Github Actions - Tests PyPI version MIT license PyPI Python versions

Python library for reading THEMIS All-Sky Imager (ASI) stream0 raw PGM-file data. The data can be found at https://data.phys.ucalgary.ca or http://themis.igpp.ucla.edu/index.shtml.

Supported Datasets

  • THEMIS ASI raw: stream0 PGM files

Installation

The themis-imager-readfile library is available on PyPI:

$ python3 -m pip install themis-imager-readfile

Supported Python Versions

themis-imager-readfile officially supports Python 3.8+.

Examples

Example Python notebooks can be found in the "examples" directory. Further, some examples can be found in the "Usage" section below.

Usage

Import the library using import themis_imager_readfile

Read a single file

>>> import themis_imager_readfile
>>> filename = "path/to/data/2020/01/01/atha_themis02/ut06/20200101_0600_atha_themis02_full.pgm.gz"
>>> img, meta, problematic_files = themis_imager_readfile.read(filename)

Read multiple files

>>> import themis_imager_readfile, glob
>>> file_list = glob.glob("path/to/files/2020/01/01/atha_themis02/ut06/*full.pgm*")
>>> img, meta, problematic_files = themis_imager_readfile.read(file_list)

Read using multiple worker processes

>>> import themis_imager_readfile, glob
>>> file_list = glob.glob("path/to/files/2020/01/01/atha_themis02/ut06/*full.pgm*")
>>> img, meta, problematic_files = themis_imager_readfile.read(file_list, workers=4)

Read with no output

>>> import themis_imager_readfile, glob
>>> file_list = glob.glob("path/to/files/2020/01/01/atha_themis02/ut06/*full.pgm*")
>>> img, meta, problematic_files = themis_imager_readfile.read(file_list, workers=4, quiet=True)

Read only the first frame of each file

>>> import themis_imager_readfile, glob
>>> file_list = glob.glob("path/to/files/2020/01/01/atha_themis02/ut06/*full.pgm*")
>>> img, meta, problematic_files = themis_imager_readfile.read(file_list, first_frame=True)

Exclude reading the metadata

>>> import themis_imager_readfile, glob
>>> file_list = glob.glob("path/to/files/2020/01/01/atha_themis02/ut06/*full.pgm*")
>>> img, meta, problematic_files = themis_imager_readfile.read(file_list, no_metadata=True)

Multiprocessing Notes

If you receive error messages about multiprocessing, be sure that your code is wrapped in a main() method. This usually resolves the issue. One example implementation is:

import themis_imager_readfile

def main():
    filename = "path/to/data/2020/01/01/atha_themis02/ut06/20200101_0600_atha_themis02_full.pgm.gz"
    img, meta, problematic_files = themis_imager_readfile.read(filename)

if (__name__ == "__main__"):
    main()

Development

Clone the repository and install dependencies using Poetry.

$ git clone https://github.com/ucalgary-aurora/themis-imager-readfile.git
$ cd themis-imager-readfile/python
$ make install

Testing

$ make test
[ or do each test separately ]
$ make test-flake8
$ make test-pylint
$ make test-pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

themis_imager_readfile-1.4.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

themis_imager_readfile-1.4.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file themis_imager_readfile-1.4.1.tar.gz.

File metadata

  • Download URL: themis_imager_readfile-1.4.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-39-generic

File hashes

Hashes for themis_imager_readfile-1.4.1.tar.gz
Algorithm Hash digest
SHA256 5b10eb26b9c334d1781c511bf55695266f7f86d199f9345e900a1ce2ccd94545
MD5 7b77c3c81137c9167369446de2819791
BLAKE2b-256 3d32d5eca14662068c92e6c93fd1d8159021584d6974a548b4f1deaf990fa9ce

See more details on using hashes here.

File details

Details for the file themis_imager_readfile-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for themis_imager_readfile-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02f49ef33727cdbc27c78b85e125337028994d05934243e2f15d4a7555ac7f16
MD5 bc87b4e5321f892eeaaf31a0c70ba087
BLAKE2b-256 7f13999f4c1f249891b94dd58cbbb7d210f4e858b062840b97d7759a264f907d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page