def rotate_to_fieldframe(mdf, yaw=None, pitch=None, roll=None):
    """ Rotates a mdf taken in the sensor basis (x', y', z') to another basis (x, y, z)
        by rotating the fields and the gradients accordingly """
    mdf_rot = mdf.deepcopy()
    mdf_rot.rotate_fields(yaw, pitch, roll)
    mdf_rot.rotate_grads_sensorframe(yaw, pitch, roll)
    return mdf_rot
