## Handling the derotator

If the subscan has no derotator table, the current pixel (obviously the unique pixel) is left centered on the current position (reference + position offset) computed in the section . On the other hand, if a derotator table is present, MRTCAL will apply a per-pixel offset.

First of all, MRTCAL tries to guess the actual derotator angle on sky. The strategy is the following:

- angle on sky will be chosen from the column sAct (“sky Actual”), as opposed to fAct (“frame Actual”) and hAct (“horizontal Actual”). This assumes sAct values are reliable even if the current derotator mode is not sky.
- if the column sAct is empty (this can happen around midnight), a warning is raised and the returned value is the commanded value as found in the frontend table header. In this case, the derotator mode must be sky.
- if the column sAct provides no value within the subscan range, a warning is raised.
- if the column sAct has a single row, or if the chunk MJD is beyond the table limits, the unique/nearest value is used.
- if the chunk MJD lies within the column sAct limits, the derotator angle is interpolated according the associated MJD column and to the chunk MJD computed earlier.
- if the chunk MJD is further than 5 seconds3.3 from the nearest point in the column sAct, an additional warning is raised.
- finally, if the actual angle is more than 0.5 degrees away from the commanded value (e.g. derotator has reached its rotating limit), a warning is raised.