DelFileGenerator ================ .. py:class:: pride.io.DelFileGenerator(del_file: str | pathlib.Path) Generate a DEL file with estimated delays The SFXC correlator reads estimated delays from binary files with .del extension. This class provides an interface to create such files with the outputs of a delay estimation. :param file: Path to the DEL file to be created :param max_size_id: Maximum allowed size of an ID (scan, source...) :param station_id_size: Size of the station ID in bytes :param header_size: Size of the header in bytes .. py:method:: add_header(station_id: str, trailing_padding: int = 1) -> None Add header to DEL file The header is a set of 4 + header_size bytes. The first 4 bytes are an integer with the size of the remaining part of the header (header_size). The remaining bytes are occupied by a two-character station ID, and padding. After checking that the file is empty, the function initializes it by adding the header. :param station_id: Station ID :param trailing_padding: Size of the padding after the station ID .. py:method:: validate_scan_contents(scan_id: str, source: str, mjd_ref: int, data: numpy.ndarray) -> None Validate scan contents before writing to the DEL file Performs the following checks: - `scan_id` and `source` are strings with a maximum of 80 characters - `mjd_ref` is an integer - `data` is a 2D numpy array with shape (N, 7) The function terminates with an error if any of the checks fail. :param scan_id: Scan ID :param source: Source name :param mjd_ref: Modified Julian Date reference :param data: Data array with shape (N, 7) .. py:method:: pack_id(id: str) -> bytes Generate bytes object for ID Generates a bytes object for an ID with a maximum size of 80 characters by filling the unused space with padding bytes. A padding byte is always added after the ID. :param id: ID to be packed :return: Packed bytes object .. py:method:: pack_scan_contents(scan_id: str, source_name: str, mjd_reference: int, scan_data: numpy.ndarray) -> bytes Pack scan contents into an array of bytes The function turns the scan contents into an array of bytes with the correct format and padding. An internal state flag is used to ensure that the scan data has been validated before calling this function. :param scan_id: Scan ID :param source: Source name :param mjd_ref: Modified Julian Date reference :param data: Data array with shape (N, 7) :return: Packed bytes object .. py:method:: add_scan(scan_id: str, source_name: str, mjd_reference: int, scan_data: numpy.ndarray) -> None Add scan data to pre-initialized DEL file After checking that the file has a header, and that the scan data has the correct format, the function packs the information into byte objects and appends it to the DEL file. An internal state flag is used to ensure that the scan data is validated before packing. :param scan_id: Scan ID [Maximum size: 80 characters] :param source_name: Source name [Maximum size: 80 characters] :param mjd_reference: MJD reference :param scan_data: Data to be added to the DEL file