code: def optimizeTraitByTrait(self, G, verbose=False, n_times=10, factr=1e3):
          
          assert self.nullST is not None, 'fit null model beforehand'
          RV = {}
          self.infoOptST = {}
          for p in range(self.P):
              trait_id = self.traitID[p]
              self.stSet.Y = self.Y[:, p:p+1]
              self.stSet.setNull(self.nullST[trait_id])
              RV[trait_id] = self.stSet.optimize(G, n_times=n_times, factr=factr, verbose=verbose)
              self.infoOptST[trait_id] = self.stSet.getInfoOpt()
          return RV
docs: Optimize trait by trait