def calcMeanComparison_multirad(self,ccdGain=1):
        """
        Take the regression-weighted mean of some of the comparison stars
        to produce one comparison star flux to compare to the target to
        produce a light curve.

        The comparison stars used are those whose :math:`$\chi^2$`s calculated by
        `calcChiSq()` are less than :math:`$2\sigma$` away from the other :math:`$\chi^2$`s.
        This condition removes outlier comparison stars, which can be caused by intrinsic
        variability, tracking inaccuracies, or other effects.
        """
        self.meanComparisonStars = []
        self.meanComparisonStarErrors = []
        self.comparisonStarWeights = []

        for apertureRadiusIndex in range(len(self.apertureRadii)):
            ## Check whether chi-squared has been calculated already. If not, compute it.
            chisq = []
            for star in self.allStarsDict: chisq.append(self.allStarsDict[star]['chisq'])
            chisq = np.array(chisq)
            #if all(chisq == 0): self.calcChiSq_multirad(apertureRadiusIndex)
            if (chisq==0).all(): self.calcChiSq_multirad(apertureRadiusIndex)
            ## Begin regression technique
            numCompStars =  len(self.allStarsDict) - 1
            targetFullLength = len(self.getScaledFluxes_multirad(self.targetKey,apertureRadiusIndex))
            print "Aperture rad:", apertureRadiusIndex
            print "Target raw flux:",self.getFluxes_multirad(self.targetKey,apertureRadiusIndex)
            print "Target scaled flux:",self.getScaledFluxes_multirad(self.targetKey,apertureRadiusIndex)
            target = self.getFluxes_multirad(self.targetKey,apertureRadiusIndex)[self.outOfTransit()]
            compStars = np.zeros([targetFullLength,numCompStars])
            compStarsOOT = np.zeros([len(target),numCompStars])
            compErrors = np.copy(compStars)
            columnCounter = 0
            acceptedCompStarKeys = []
            compStarKeys = []
            for star in self.allStarsDict:
                if star != self.targetKey and (np.abs(self.meanChisq - self.allStarsDict[star]['chisq']) < 2*self.stdChisq).any():
                    compStars[:,columnCounter] = self.getScaledFluxes_multirad(star,apertureRadiusIndex).astype(np.float64)
                    compStarsOOT[:,columnCounter] = self.getScaledFluxes_multirad(star,apertureRadiusIndex)[self.outOfTransit()].astype(np.float64)
                    compErrors[:,columnCounter] = self.getScaledErrors_multirad(star,apertureRadiusIndex).astype(np.float64)
                    compStarKeys.append(int(star))
                    columnCounter += 1
                elif star != self.targetKey and (np.abs(self.meanChisq - self.allStarsDict[star]['chisq']) > 2*self.stdChisq):
                    print 'Star '+str(star)+' excluded from regression'
                    compStarKeys.append(int(star))
                    columnCounter += 1
            initP = np.zeros([numCompStars])+ numCompStars/1.
            def errfunc(p,target):
                if all(p >=0.0): return np.dot(p,compStarsOOT.T) - target ## Find only positive coefficients
            #return np.dot(p,compStarsOOT.T) - target

            bestFitP = optimize.leastsq(errfunc,initP[:],args=(target.astype(np.float64)),maxfev=10000000,epsfcn=np.finfo(np.float32).eps)[0]
            print '\nBest fit regression coefficients:',bestFitP
            print 'Default weight:',1./numCompStars

            self.comparisonStarWeights_i = np.vstack([compStarKeys,bestFitP])
            self.meanComparisonStar = np.dot(bestFitP,compStars.T)
            self.meanComparisonStarError = np.sqrt(np.dot(bestFitP**2,compErrors.T**2))
            self.meanComparisonStars.append(self.meanComparisonStar)
            self.meanComparisonStarErrors.append(self.meanComparisonStarError)
            self.comparisonStarWeights.append(self.comparisonStarWeights_i)
        return self.meanComparisonStars, self.meanComparisonStarErrors
dataset/ETHPy150Open OSCAAR/OSCAAR/oscaar/dataBank.py/dataBank.calcMeanComparison_multirad/swapped operands of `/`