Work with Elekta Linac Agility Head TRFs Union[BinaryIO, os.PathLike[Any]])Tuple[pandas.core.frame.DataFrame, pandas.core.frame.DataFrame]

Read an Elekta Linac Agility Head TRF into a Pandas DataFrame.


trf (Union[BinaryIO, os.PathLike[Any]]) – Either a file-like object or a pathlike object pointing to either the file location on disk, or the binary contents of a given TRF.


Two DataFrames, the first being the TRF header information, the second being the TRF table content.

Return type

Tuple[pd.DataFrame, pd.DataFrame]

pymedphys.trf.identify(connection: pymedphys._mosaiq.connect.Connection, filepath: pathlib.Path, timezone: str)

Query a Mosaiq database to associate a TRF with its corresponding delivery and therefore its patient information.

  • connection (pymedphys.mosaiq.Connection) – A connection instance to the Mosaiq MSSQL database. Only requirement is that it is a PEP-0249 compliant connection object.

  • filepath (pathlib.Path) – Path to the TRF

  • timezone (str) – The timezone that matches the Mosaiq MSSQL instance being queried. This is utilised internally to convert the TRF’s UTC timestamp to a timestamp that matches the time of delivery in Mosaiq. The conversion happens utilising tz_convert within the Pandas library. So anything that its tz parameter accepts can be provided here.


An attrs class that has the following attributes:

  • patient_id

  • field_id

  • last_name

  • first_name

  • qa_mode

  • field_type

  • beam_completed

Return type