Modules (pyobs.images.processors.modules)

GetFitsHeaders

class GetFitsHeaders(sender: str | list[str], namespace: str | None = None, **kwargs: Any)

Retrieve and merge FITS header entries from one or more external modules.

This processor requests FITS header key–value pairs from modules implementing the IFitsHeaderBefore interface and merges them into a copy of the input image’s header. Requests are issued concurrently to all configured senders; results are applied in the order the senders are listed. If multiple modules provide the same header key, later modules overwrite earlier ones. Pixel data are not modified.

Parameters:
  • sender (str | list[str]) – Name or list of names of modules to query. Each module must implement the IFitsHeaderBefore interface providing a get_fits_header_before(namespace) method.

  • namespace (str | None) – Optional namespace identifier forwarded to get_fits_header_before to allow modules to return context-specific headers (e.g., per pipeline stage). Default: None.

  • kwargs – Additional keyword arguments forwarded to pyobs.images.processor.ImageProcessor.

Behavior

  • For each sender, obtains a proxy and calls proxy.get_fits_header_before(namespace) concurrently.

  • Creates a copy of the input image and merges returned headers into out.header in sender-list order.

  • Values that are lists (but not strings) are converted to tuples before insertion, ensuring FITS-header-friendly types. All other values are inserted as-is.

  • Returns the modified copy; pixel data and catalog are unchanged.

Input/Output

Configuration (YAML)

Single sender:

class: pyobs.images.processors.modules.GetFitsHeaders
sender: "HeaderProviderA"

Multiple senders with a namespace:

class: pyobs.images.processors.modules.GetFitsHeaders
sender: ["HeaderProviderA", "HeaderProviderB"]
namespace: "preproc"

Notes

  • Merging order follows the list of sender names; later senders overwrite earlier values for duplicate keys.

  • The modules must implement the IFitsHeaderBefore interface and be reachable via the proxy mechanism in this environment.

  • Converting lists to tuples helps store composite values in FITS headers; if a module encodes a value/comment pair as a list, it will become a tuple on insert.