Skip to main content

Adv2

This package provides a 'reader' for .adv (AstroDigitalVideo) Version 2 files.

It is the result of a collaborative effort involving Bob Anderson and Hristo Pavlov.

The specification for Astro Digital Video files can be found at: http://www.astrodigitalvideoformat.org/spec.html

To install this package on your system:

pip install Adv2

Then, sample usage from within your Python code is:

from pathlib import Path

from Adv2.Adv2File import Adv2reader

try:
    # Create a platform agnostic path to your .adv file (use forward slashes)
    file_path = str(Path('path/to/your/file.adv'))  # Python will make Windows version as needed

    # Create a 'reader' for the given file
    rdr = Adv2reader(file_path)

except AdvLibException as adverr:
    print(repr(adverr))
    exit()

except IOError as ioerr:
    print(repr(ioerr))
    exit()

Now that the file has been opened and a 'reader' (rdr) created for it, there are instance variables available that will be useful. Here is how to print some of those out (these give the image size and number of images in the file):

print(f'Width: {rdr.Width}  Height: {rdr.Height}  NumMainFrames: {rdr.CountMainFrames}')

There is also an composite instance variable called FileInfo which gives access to all of the values defined in the structure AdvFileInfo (there are 20 of them).

For example:

print(rdr.FileInfo.UtcTimestampAccuracyInNanoseconds)

To get (and show) the file metadata (returned as a Dict[str, str]):

print(f'\nADV_FILE_META_DATA:')
meta_data = rdr.getAdvFileMetaData()
for key in meta_data:
    print(f'    {key}: {meta_data[key]}')

The main thing that one will want to do is read image data, timestamps, and frame status information from image frames.

Continuing with the example and assuming that the adv file contains a MAIN stream (it might also contain a CALIBRATION stream):

for frame in range(rdr.CountMainFrames):

    # status is a Dict[str, str]
    err, image, frameInfo, status = rdr.getMainImageAndStatusData(frameNumber=frame)
    # To get frames from a CALIBRATION stream, use rdr.getCalibImageAndStatusData()

    if not err:
        # If timestamp info was not present in the file (highly unlikely),
        # the timestamp string returned will be empty (== '')
        if frameInfo.StartOfExposureTimestampString:
            print(frameInfo.DateString, frameInfo.StartOfExposureTimestampString)
        print(f'\nframe: {frame} STATUS:')
        for entry in status:
            print(f'    {entry}: {status[entry]}')
    else:
        print(err)

err is a string that will be empty if image bytes and metadata where successfully extracted. In that case, image will contain a numpy array of uint16 values. If err is not empty, it will contain a human-readable description of the error encountered.

The 'shape' of image will be image[Height, Width] for grayscale images. Color video files are not yet supported.

Finally, the file should closed as in the example below:

print(f'closeFile returned: {rdr.closeFile()}')
rdr = None

The value returned will be the version number (2) of the file closed or 0, which indicates an attempt to close a file that was already closed.

Metadata

Release files for Adv2 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Adv2 1.2.0
File Size Uploaded
Adv2-1.2.0.tar.gz 2.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for Adv2 1.2.0
File Interpreter ABI Platform
Adv2-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.9 MB

Release files / Adv2-1.2.0.tar.gz

Download URL Adv2-1.2.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
2f09159b3637582ec90c6ff4aa33cfc3f1988103b0e55fb274d3bf18a85a931a
BLAKE2b-256 checksum
How to use checksums
698ae4658e2cf77a7723c02070135b2df71388a3bb9a2f788671ca397e79608f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4

Release files / Adv2-1.2.0-py3-none-any.whl

Download URL Adv2-1.2.0-py3-none-any.whl
Size 2.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
af732ef1e6a1a5324facadcbe8a628cdadfca53d4783617e65f010b450d363b3
BLAKE2b-256 checksum
How to use checksums
5a536afa0afe1c2699fc1009b6e8905ab463559453c2cb0c386784307f1a74aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page