(* Testing with odd and three  even. *)

n=1;

sigmax = {{0,1},{1,0}};

sigmay = {{0,-I},{I,0}};

sigmaz = {{1,0},{0,-1}};

I2 = IdentityMatrix[2];

AA= 2*KroneckerProduct[sigmaz,sigmax];

MatrixForm[AA]

BB= {{0,-I,0,0},{I,0,0,0},{0,0,0,I},{0,0,-I,0}};

MatrixForm[BB]

CC= KroneckerProduct[sigmaz,sigmaz];

MatrixForm[CC]

DD =  {{0,0,1,0},{0,0,0,1},{1,0,0,0},{0,1,0,0}};

MatrixForm[DD]

loclzrHalf=KroneckerProduct[I*sigmax,AA -  w*IdentityMatrix[4]] +KroneckerProduct[I*sigmay,BB - x*IdentityMatrix[4]] +KroneckerProduct[I*sigmaz,CC -  y*IdentityMatrix[4]]+KroneckerProduct[I2,DD -  z*IdentityMatrix[4]];

charpoly=FullSimplify[Det[loclzrHalf]]

charpolyReduce = ReplaceAll[charpoly,{x^2 + y^2 + z^2 -> R^2}]

charpolyReduce =Factor[charpolyReduce]

charpolyReduceRotate =  FullSimplify[ReplaceAll[charpolyReduce,{R^2->x^2+y^2+z^2}]]

shouldBeZero = FullSimplify[charpolyReduceRotate  - charpoly]

localizerHalfAtZero = ReplaceAll[loclzrHalf,z->0];

gma = KroneckerProduct[IdentityMatrix[2],KroneckerProduct[sigmaz,IdentityMatrix[2]]];

MatrixForm[gma];

madeHermitian = ExpandAll[I *localizerHalfAtZero.gma];

MatrixForm[madeHermitian]

kTheory =FullSimplify[Det[madeHermitian]]

(1/2)*Total[Sign[Eigenvalues[N[ReplaceAll[madeHermitian,{w->0,x->0,y->0}]]]]]

(1/2)*Total[Sign[Eigenvalues[N[ReplaceAll[madeHermitian,{w->0.1,x->0,y->0}]]]]]

(1/2)*Total[Sign[Eigenvalues[N[ReplaceAll[madeHermitian,{w->0,x->2,y->0}]]]]]

(1/2)*Total[Sign[Eigenvalues[N[ReplaceAll[madeHermitian,{w->2,x->0,y->2}]]]]]