Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

codecov

An interface containing a validator and a spec translator for DKIST FITS specs SPEC122 and SPEC214:

  • SPEC-0122: Data received from the summit

  • SPEC-0214 l0: Data ingested and parsed by the Data Center

  • SPEC-0214: Data published by the Data Center (incomplete)

The validator references a machine readable version of the DKIST Header Specifications which are defined here in the dkist-fits-specifications package. Unless otherwise specified, the latest version of dkist-fits-specifications package is installed along with the validator. Data can be validated against past revisions of the DKIST Header Specifications if a previous version of the dkist-fits-specifications package is installed. If you are receiving validation errors, please reference the version of the DKIST Header Specifications identified in the dkist-fits-specifications package to make sure that your headers are expected to be compliant with that version.

Features

  • Uses voluptuous schemas to validate a given input header against dkist specifications

  • 3 keyword validations: type validation, required-ness validation, and value validation

  • Failure exceptions include a dictionary of validation failure causes

  • SPEC-0122 to SPEC-0214 l0 translation

Installation

pip install dkist-header-validator

Usage

Currently, this package can be used to validate SPEC122 data or SPEC214 data. Please import the corresponding methods (spec122_validator and Spec122ValidationException, or spec214_validator and Spec214ValidationException, or spec214_l0_validator and Spec214ValidationException).

Input data can be one of:

  • fits.Header object

  • fits.PrimaryHDU or fits.ImageHDU or fits.CompImageHDU object

  • HDUList object

  • File path to an HDUList object

To validate an object in memory:

>>> from dkist_header_validator import spec122_validator, Spec122ValidationException
>>> from astropy.io import fits
>>> hdul = fits.open('dkist_rosa0181200000_observation.fits')
>>> validated_hdul = spec122_validator.validate(hdul)
>>> # or
>>> validated_hdu = spec122_validator.validate(hdul[1])
>>> # or
>>> validated_header = spec122_validator.validate(hdul[1].header)

Or, validate an object on disk directly:

>>> from dkist_header_validator import spec122_validator, Spec122ValidationException
>>> filepath = spec122_validator.validate('dkist_rosa0181200000_observation.fits')

Note that the return is just the input. If no errors or exceptions are raised, the header is valid. The validate method also accepts the boolean flag extra, which determines if extra keywords are allowed in the validation schema. Default value is extra=True.

The CLI can also be used to validate files:

$ dkist-header-validator validate122 "path/to/file.fits"
$ dkist-header-validator validate214 "path/to/file.fits"

In addition, this package can be used to translate headers from SPEC122 to SPEC214 l0:

>>> from dkist_header_validator import translate_spec122_to_spec214_l0
>>> translated_hdul = translate_spec122_to_spec214_l0('dkist_rosa0181200000_observation.fits')

The return in this case is the an HDUList with a translated header and the original data.

This project is Copyright (c) AURA/NSO.

Download files

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

Source Distribution

dkist_header_validator-5.4.1rc2.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

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

dkist_header_validator-5.4.1rc2-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file dkist_header_validator-5.4.1rc2.tar.gz.

File metadata

File hashes

Hashes for dkist_header_validator-5.4.1rc2.tar.gz
Algorithm Hash digest
SHA256 54fe402d3dc346de8e6f8b1cc48fc4d6c4b987996051bf0924252ecd54de61c6
MD5 3cc1970a4a928afd179aae7132472987
BLAKE2b-256 46804cb80f54912fb51e97739322799b069a5c5edd2d9156058382a711c7afac

See more details on using hashes here.

File details

Details for the file dkist_header_validator-5.4.1rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for dkist_header_validator-5.4.1rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f0b4e175d1380024d1e524688f04b39d582a9d5364a51e17af45bcfcfd48357
MD5 f5e799127c5f3cce8f716829b9253f73
BLAKE2b-256 5af8021943770df158abd360d350799da1db306ad2a6ffccec91e9d8b6d3ff26

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

5.4.1rc2 This release

2 files

5.4.0

2 files

5.3.1

2 files

5.3.0

2 files

5.2.1

2 files

5.2.0

2 files

5.1.1

1 file

5.1.0

1 file

5.0.0

1 file

4.1.0

1 file

4.0.0

1 file

3.0.5

1 file

3.0.4

1 file

3.0.3

1 file

3.0.2

1 file

3.0.0

1 file

2.1.0

1 file

2.0.13

1 file

2.0.12

1 file

2.0.11

1 file

2.0.10

1 file

2.0.9

1 file

2.0.8

1 file

2.0.7

1 file

2.0.6

1 file

2.0.5

1 file

2.0.4

1 file

2.0.3

1 file

2.0.2

1 file

2.0.1

1 file

2.0.0

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.7

1 file

1.0.6

1 file

1.0.5

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

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