Table Of Contents

Previous topic

Differs

Next topic

Verification options

This Page

Schemas

Schema

class pyfits.Schema

Base class for all schemas. This schema does not validate any keywords and is for all intents and purposes a no-op schema. New schemas should be created by subclassing this class, or other schemas which have this class as a base.

If a subclass of this schema contains invalid or unrecognized keyword properties a SchemaDefinitionError is raised as soon as the class is created (typically at import time if the class is hard-coded in a Python module). The only exception to this is callable properties which can only be evaluated in the context of a specific Header. In this case a SchemaDefinitionError may be raised as well.

classmethod validate(header)

Validate a given Header against this schema. Returns True if the validation succeeds. Otherwise raises a SchemaValidationError.

This may also raise a SchemaDefinitionError if a context-dependent keyword property returns an invalid result for that property. See the FITS Header Schemas section in the PyFITS documentation for more details on context-dependent properties.

SchemaDefinitionError

class pyfits.SchemaDefinitionError(name, message)

Exception raised when a FITS Schema definition is not valid.

SchemaValidationError

class pyfits.SchemaValidationError(name, message)

Exception raised when a Schema does not validate a FITS header.

validate_fits_datetime()

pyfits.validate_fits_datetime(**ctx)

Validate date/time values in FITS headers according to the format given for the DATE keyword in Section 4.4.2.1 of the FITS Standard version 3.0 (July 10, 2008).

This function can be used in the 'value' keyword property in a schema to validate a string value against the FITS datetime format.

Inheritance diagram of Schema

BaseSchema

class pyfits.BaseSchema

Bases: pyfits.schema.Schema

Minimal header schema that all valid HDUs must match according to the FITS Standard version 3.0 (July 10, 2008).

This excludes the PRIMARY and XTENSION keywords each of which are handled by relevant extensions to this schema.

ChecksumSchema

class pyfits.ChecksumSchema

Bases: pyfits.schema.Schema

Schema for the latest version of the FITS Checksum convention (Seaman, Pence, Rots 2002).

PyFITS supports this convention, but the keywords its defines are kept in its own schema to emphasize that they are not part of the FITS Standard. This class can basically be used as a mix-in to support the convention and reserve the keywords defined in the convention.

PrimarySchema

class pyfits.PrimarySchema

Bases: pyfits.hdu.base.BaseSchema, pyfits.hdu.base.ChecksumSchema

Base schema for all primary HDU headers conforming to the FITS Standard version 3.0 (July 10, 2008).

ExtensionSchema

class pyfits.ExtensionSchema

Bases: pyfits.hdu.base.BaseSchema, pyfits.hdu.base.ChecksumSchema

Base schema for extension HDU headers conforming to the FITS Standard version 3.0 (July 10, 2008), including extension types not otherwise defined by the standard.

In other words, these are the minimal keywords required to conform to the FITS Standard even for extensions not defined by the standard.

StandardExtensionSchema

class pyfits.StandardExtensionSchema

Bases: pyfits.hdu.base.ExtensionSchema

Base schema for headers of all extension HDU types that are fully specified in the FITS Standard version 3.0 (July 10, 2008).

CompImageSchema

class pyfits.CompImageSchema

Bases: pyfits.hdu.table.BinTableExtensionSchema

Schema for headers of compressed image binary tables as defined by the Tiled Image Convention version 2.3 (July 2, 2013).

RandomGroupsSchema

class pyfits.RandomGroupsSchema

Bases: pyfits.hdu.image.BaseArraySchema, pyfits.hdu.base.PrimarySchema

Schema for headers of random groups primary HDUs as described in Section 6 of the FITS Standard version 3.0 (July 10, 2008).

This is a little like a normal primary array, but with a little additional structure and restrictions.

BaseArraySchema

class pyfits.BaseArraySchema

Bases: pyfits.hdu.base.BaseSchema

Schema for headers of image HDUs (really HDUs containing single arrays) as detailed from Section 4.4 through Section 5 of the FITS Standard version 3.0 (July 10, 2008).

The only thing specific about array-like HDUs is that the keywords listed in this schema are enabled. Section 4.4.2.5 defines these keywords as reserved in all conforming FITS headers, but they are only valid in either a primary HDU (include random groups HDUs) or an IMAGE extension.

PrimaryArraySchema

class pyfits.PrimaryArraySchema

Bases: pyfits.hdu.image.BaseArraySchema, pyfits.hdu.base.PrimarySchema

Schema for primary headers in FITS HDUs conforming to the FITS Standard version 3.0 (July 10, 2008). This includes primary image arrays as well as random groups structures.

Note: Random groups structures require additional validation from the RandomGroupsSchema.

ImageExtensionSchema

class pyfits.ImageExtensionSchema

Bases: pyfits.hdu.image.BaseArraySchema, pyfits.hdu.base.ExtensionSchema

Schema for headers of IMAGE extension HDUs as described by Section 7.1 of the FITS Standard version 3.0 (July 10, 2008).

BaseTableSchema

class pyfits.BaseTableSchema

Bases: pyfits.hdu.base.ExtensionSchema

Common schema for headers for TABLE and BINTABLE extension HDUs as described in Sections 7.2 and 7.3 of the FITS Standard version 3.0 (July 10, 2008).

The validation of these keywors is common to both table types–extensions exist with specifics for TABLE and BINTABLE HDUs as TableExtensionSchema and BinTableExtensionSchema respectively.

TableExtensionSchema

class pyfits.TableExtensionSchema

Bases: pyfits.hdu.table.BaseTableSchema

Schema for headers of TABLE extension HDUs as described in Section 7.2 of the FITS Standard version 3.0 (July 10, 2008).

BinTableExtensionSchema

class pyfits.BinTableExtensionSchema

Bases: pyfits.hdu.table.BaseTableSchema

Schema for headers of BINTABLE extension HDUs as described in Section 7.3 of the FITS Standard version 3.0 (July 10, 2008).