SiafDb

class jwst.lib.siafdb.SiafDb(source=None, prd=None)[source]

Bases: object

Use pysiaf as the source of SIAF information.

Parameters:
sourceNone, str, or a file-like object

If None, then the latest PRD version in pysiaf is used. Otherwise, it should be a string or Path-like object pointing to a folder containing the SIAF XML files.

prdNone or str

The PRD version to use from the pysiaf application. If source has also been specified, source will be used instead.

Methods Summary

get_aperture(aperture[, useafter])

Get the pysiaf.Aperture for an aperture.

get_wcs(aperture[, to_detector, useafter])

Query the SIAF database file and get WCS values.

get_xml_path(source, prd)

Determine the XML source to use.

Methods Documentation

get_aperture(aperture, useafter=None)[source]

Get the pysiaf.Aperture for an aperture.

Parameters:
aperturestr

The name of the aperture to retrieve.

useafterstr

The date of observation (model.meta.date).

Returns:
aperturepysiaf.Aperture

The aperture specification.

get_wcs(aperture, to_detector=False, useafter=None)[source]

Query the SIAF database file and get WCS values.

Given an APERTURE_NAME and a USEAFTER date query the SIAF database and extract the following keywords: V2Ref, V3Ref, V3IdlYAngle, VIdlParity, XSciRef, YSciRef, XSciScale, YSciScale, XIdlVert1, XIdlVert2, XIdlVert3, XIdlVert4, YIdlVert1, YIdlVert2, YIdlVert3, YIdlVert4

Parameters:
aperturestr

The name of the aperture to retrieve.

to_detectorbool

Convert all the pixel parameters to be relative to the detector.

useafterstr

The date of observation (model.meta.date).

Returns:
siafnamedtuple

The SIAF namedtuple with values from the PRD database.

get_xml_path(source, prd)[source]

Determine the XML source to use.

Parameters:
sourceNone, str, or a file-like object

If None, the environmental XML_DATA is queried. If None and no XML_DATA information, then the PRD version, as defined by prd, will be used. Otherwise, it should be a string or Path-like object pointing to a folder containing the SIAF XML files.

prdNone or str

The PRD version to use from the pysiaf application. If source has also been specified, source will be used instead.

Returns:
xml_pathPath

Either the Path to the XML files.

Raises:
ValueError

If source does not resolve to a folder or prd is not a valid PRD version.