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
IFitsHeaderBeforeinterface 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
IFitsHeaderBeforeinterface providing aget_fits_header_before(namespace)method.namespace (str | None) – Optional namespace identifier forwarded to
get_fits_header_beforeto 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.headerin 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
Input:
pyobs.images.Image.Output:
pyobs.images.Image(copied) with additional or updated FITS header entries provided by the external modules.
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
sendernames; later senders overwrite earlier values for duplicate keys.The modules must implement the
IFitsHeaderBeforeinterface and be reachable via theproxymechanism 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.