Ben, This analysis seems to work fine if the diagonalized form of the metric is the matrix identity = diag(1,1). But for S=diag(-1,1) it fails. To make it work one must introduce the additional matrix factor diag(i,1), where i=sqrt(-1).
Then, another question remains: assuming that you have...