Skip to main content

Routines for converting to and from vax single-precision floating-point values

Project description

GitHub release; latest by date GitHub Release Date Test Status Documentation Status Code coverage
PyPI - Version PyPI - Format PyPI - Downloads PyPI - Python Version
GitHub commits since latest release GitHub commit activity GitHub last commit
Number of GitHub open issues Number of GitHub closed issues Number of GitHub open pull requests Number of GitHub closed pull requests
GitHub License Number of GitHub stars GitHub forks

Introduction

vax is a set of routines for converting between NumPy floating point and complex scalars/arrays and VAX-format single- and double-precision floats.

vax is a product of the PDS Ring-Moon Systems Node.

Installation

The vax module is available via the rms-vax package on PyPI and can be installed with:

pip install rms-vax

Getting Started

The vax module provides two functions for converting from VAX-format floats:

  • from_vax32: Interpret a series of bytes or NumPy array as one or more VAX single-precision floats and convert them to a NumPy float or complex scalar or array.
  • from_vax64: Interpret a series of bytes NumPy array as one or more VAX double-precision floats and convert them to a NumPy float or complex scalar or array.

and two functions for converting to VAX-format floats::

  • to_vax32: Convert a NumPy float or complex scalar or array to a NumPy array containing the binary representation of VAX single-precision floats. Such an array can not be used for arithmetic operations since it is not in IEEE 754 format.
  • to_vax32_bytes: Convert a NumPy float or complex scalar or array to a Python bytes object containing the binary representation of VAX single-precision floats.

Note that there are no functions to convert a NumPy array to VAX double-precision format.

Details of each function are available in the module documentation.

Basic operation is as follows:

import vax
b = vax.to_vax32([1., 2., 3.])
print(f'b = {b!r}')
ba = vax.to_vax32_bytes([1., 2., 3.])
print(f'ba = {ba!r}')
v = vax.from_vax32(b)
print(f'v = {v!r}')
va = vax.from_vax32(ba)
print(f'va = {va!r}')

yields:

b = array([2.3138e-41, 2.3318e-41, 2.3407e-41], dtype=float32)
ba = b'\x80@\x00\x00\x00A\x00\x00@A\x00\x00'
v = array([1., 2., 3.], dtype=float32)
va = array([1., 2., 3.], dtype=float32)

As NASA data products stored as VAX-format floats are often provided in JPL's VICAR file format, you may also be interested in the rms-vicar package (documentation).

Contributing

Information on contributing to this package can be found in the Contributing Guide.

Links

Licensing

This code is licensed under the Apache License v2.0.

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

rms_vax-1.0.5.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rms_vax-1.0.5-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file rms_vax-1.0.5.tar.gz.

File metadata

  • Download URL: rms_vax-1.0.5.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for rms_vax-1.0.5.tar.gz
Algorithm Hash digest
SHA256 7e83e7461e5a7d5d765225220bfd8e27242b5f20838d930bf3665d9ef66211b0
MD5 2cd78c622e4d2faadc13b933c07a6e4e
BLAKE2b-256 ca2069ed9131f7677790c9f1b51f0b69656575ab4b93090a45201527a55b2bbd

See more details on using hashes here.

File details

Details for the file rms_vax-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: rms_vax-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for rms_vax-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cf81320d3b0adb85d881a1f5e2a348c3e42aaec3b34f090b16d84e91d0a8f57a
MD5 a23b6387a3b16c00d62143062e249865
BLAKE2b-256 78f9407a90f936fa3fbfea576845e18798f05398c832e3055207e68a24eda432

See more details on using hashes here.

Supported by

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