Refactor how integer expansion is performed in FITS keywords

Merged
#25 · Created  · Last updated

Merged pull request

Merged in refactor_expansion (pull request #25)

8628346·Author: ·Closed by: ·2023-02-01

Description

The keyword expansion API (or lack of it) came about as a result of adding new expansions one by one as required. Let’s change that to a pattern where adding a new expansion means defining it as an instance of an expansion class and adding it to the list of desired expansions.

  • Addition of a <> to many keywords, used as escape characters to recognise expansion candidates

  • Addition of the ExpansionIndex dataclass and the expand_schema method to provide an API that defines a collection of valid expansions and performs them

  • Modification of existing unit tests and new tests for the expansion API

  • Removal of old methods that supported the expansion of FITS keywords

The new expansion API can handle single or multi character index definitions, zero-padded expansion into a size that is different from the index, and multiple expansions within a single keyword.

It also ensures that the resulting keywords are 8 characters or less (by FITS convention) and that there cannot be an expansion that takes up more characters than the given size.

0 attachments

0 comments

Loading commits...