# Converted from rate_estimation.mimportnumpyasnpimportosstoi=np.array([[0,1,0,-1,-1,1],[-1,1,1,-1,0,0],[1,0,-1,0,-1,1]],dtype=float)r=np.array([1.,2.])A=stoi[:2,:]R=A.T@r# Set seed for reproducible random numbersrng=np.random.RandomState(1)npoints=6Rmeas=np.zeros((6,npoints))foriinrange(npoints):Rmeas[:,i]=0.05*rng.randn(6)+Rrest=(np.linalg.inv(A@A.T)@A@Rmeas).Twithopen('rate_estimation.dat','w')asmyfile:forrowinrest:myfile.write(f'{row[0]:8.4f}{row[1]:8.4f}\n')