def _update_pi_vars(self):
minpi = self.PARAMLIMITS['<STR_LIT>'][<NUM_LIT:0>]<EOL>if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>assert not hasattr(self, '<STR_LIT>')<EOL>self.origpi = self.pi**self._origbeta<EOL>for r in range(self.nsites):<EOL><INDENT>self.origpi[r] /= self.origpi[r].sum()<EOL>self.origpi[r][self.origpi[r] < <NUM_LIT:2> * minpi] = <NUM_LIT:2> * minpi<EOL>self.origpi[r] /= self.origpi[r].sum()<EOL><DEDENT>self.pi = self.origpi.copy()<EOL>self.zeta = scipy.ndarray(self.nsites * (N_AA - <NUM_LIT:1>), dtype='<STR_LIT:float>')<EOL>self.tildeFrxy = scipy.zeros((self.nsites, N_CODON, N_CODON),<EOL>dtype='<STR_LIT:float>')<EOL>for r in range(self.nsites):<EOL><INDENT>zetaprod = <NUM_LIT:1.0><EOL>for i in range(N_AA - <NUM_LIT:1>):<EOL><INDENT>zetari = <NUM_LIT:1.0> - self.pi[r][i] / zetaprod<EOL>self.zeta.reshape(self.nsites, N_AA - <NUM_LIT:1>)[r][i] = zetari<EOL>zetaprod *= zetari<EOL><DEDENT><DEDENT>(minzeta, maxzeta) = self.PARAMLIMITS['<STR_LIT>']<EOL>self.zeta[self.zeta < minzeta] = minzeta<EOL>self.zeta[self.zeta > maxzeta] = maxzeta<EOL>_checkParam('<STR_LIT>', self.zeta, self.PARAMLIMITS, self.PARAMTYPES)<EOL><DEDENT>else:<EOL><INDENT>for r in range(self.nsites):<EOL><INDENT>zetaprod = <NUM_LIT:1.0><EOL>for i in range(N_AA - <NUM_LIT:1>):<EOL><INDENT>zetari = self.zeta.reshape(self.nsites, N_AA - <NUM_LIT:1>)[r][i]<EOL>self.pi[r][i] = zetaprod * (<NUM_LIT:1> - zetari)<EOL>zetaprod *= zetari<EOL><DEDENT>self.pi[r][N_AA - <NUM_LIT:1>] = zetaprod<EOL>self.pi[r][self.pi[r] < minpi] = minpi<EOL>self.pi[r] /= self.pi[r].sum()<EOL><DEDENT><DEDENT>super(ExpCM_fitprefs, self)._update_pi_vars()<EOL>with scipy.errstate(divide='<STR_LIT>', under='<STR_LIT>', over='<STR_LIT>',<EOL>invalid='<STR_LIT:ignore>'):<EOL><INDENT>scipy.copyto(self.tildeFrxy, self.omega * self.beta *<EOL>(self.piAx_piAy_beta * (self.ln_piAx_piAy_beta - <NUM_LIT:1>)<EOL>+ <NUM_LIT:1>) / (<NUM_LIT:1> - self.piAx_piAy_beta)**<NUM_LIT:2>,<EOL>where=CODON_NONSYN)<EOL><DEDENT>scipy.copyto(self.tildeFrxy, self.omega * self.beta / <NUM_LIT>,<EOL>where=scipy.logical_and(CODON_NONSYN, scipy.fabs(<NUM_LIT:1> -<EOL>self.piAx_piAy_beta) < ALMOST_ZERO))<EOL>self._logprior = <NUM_LIT:0.0><EOL>self._dlogprior = dict([(param, <NUM_LIT:0.0>) for param in self.freeparams])<EOL>if self.prior is None:<EOL><INDENT>pass<EOL><DEDENT>elif self.prior[<NUM_LIT:0>] == '<STR_LIT>':<EOL><INDENT>(priorstr, c1, c2) = self.prior<EOL>self._dlogprior = dict([(param, <NUM_LIT:0.0>) for param in self.freeparams])<EOL>self._dlogprior['<STR_LIT>'] = scipy.zeros(self.zeta.shape, dtype='<STR_LIT:float>')<EOL>j = <NUM_LIT:0><EOL>aaindex = scipy.arange(N_AA)<EOL>for r in range(self.nsites):<EOL><INDENT>pidiffr = self.pi[r] - self.origpi[r]<EOL>rlogprior = -c2 * scipy.log(<NUM_LIT:1> + c1 * pidiffr**<NUM_LIT:2>).sum()<EOL>self._logprior += rlogprior<EOL>for i in range(N_AA - <NUM_LIT:1>):<EOL><INDENT>zetari = self.zeta[j]<EOL>self._dlogprior['<STR_LIT>'][j] = -<NUM_LIT:2> * c1 * c2 * (<EOL>pidiffr[i : ] / (<NUM_LIT:1> + c1 * pidiffr[i : ]**<NUM_LIT:2>) *<EOL>self.pi[r][i : ] / (zetari - (aaindex == i).astype(<EOL>'<STR_LIT:float>')[i : ])).sum()<EOL>j += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(self.prior))<EOL><DEDENT>
Update variables that depend on `pi` from `zeta`.

        The updated variables are: `pi`, `pi_codon`, `ln_pi_codon`, `piAx_piAy`,
        `piAx_piAy_beta`, `ln_piAx_piAy_beta`, and `_logprior`.

        If `zeta` is undefined (as it will be on the first call), then create
        `zeta` and `origpi` from `pi` and `origbeta`.