Process the impurity matrix so that it can be used to correct
        observed reporter intensities.
556631
def _processImpurityMatrix(self):
        
        processedMatrix = _normalizeImpurityMatrix(self.impurityMatrix)
        processedMatrix = _padImpurityMatrix(
            processedMatrix, self.matrixPreChannels, self.matrixPostChannels
            )
        processedMatrix = _transposeMatrix(processedMatrix)
        return processedMatrix
622682
private void makeSingularPositive() {
        numSingular = qralg.getNumberOfSingularValues();
        singularValues = qralg.getSingularValues();

        for( int i = 0; i < numSingular; i++ ) {
            double val = singularValues[i];

            if( val < 0 ) {
                singularValues[i] = -val;

                if( computeU ) {
                    // compute the results of multiplying it by an element of -1 at this location in
                    // a diagonal matrix.
                    int start = i* Ut.numCols;
                    int stop = start+ Ut.numCols;

                    for( int j = start; j < stop; j++ ) {
                        Ut.data[j] = -Ut.data[j];
                    }
                }
            }
        }
    }
1012440
def process(self, input_data, topic=None):
        
        for handler in self.handlers:
            output = handler.handle(input_data)
            input_data = output

        self.publish(input_data)
428758
private void makeSingularPositive() {
        numSingular = qralg.getNumberOfSingularValues();
        singularValues = qralg.getSingularValues();

        for( int i = 0; i < numSingular; i++ ) {
            double val = qralg.getSingularValue(i);

            if( val < 0 ) {
                singularValues[i] = 0.0 - val;

                if( computeU ) {
                    // compute the results of multiplying it by an element of -1 at this location in
                    // a diagonal matrix.
                    int start = i* Ut.numCols;
                    int stop = start+ Ut.numCols;

                    for( int j = start; j < stop; j++ ) {
                        Ut.set(j, 0.0 - Ut.get(j));
                    }
                }
            } else {
                singularValues[i] = val;
            }
        }
    }
1021529
def _prepare_output(topics_with_wrong_rf, verbose):
    """"""
    out = {}
    topics_count = len(topics_with_wrong_rf)
    out['raw'] = {
        'topics_with_wrong_replication_factor_count': topics_count,
    }

    if topics_count == 0:
        out['message'] = 'All topics have proper replication factor.'
    else:
        out['message'] = (
            "{0} topic(s) have replication factor lower than specified min ISR + 1."
        ).format(topics_count)

        if verbose:
            lines = (
                "replication_factor={replication_factor} is lower than min_isr={min_isr} + 1 for {topic}"
                .format(
                    min_isr=topic['min_isr'],
                    topic=topic['topic'],
                    replication_factor=topic['replication_factor'],
                )
                for topic in topics_with_wrong_rf
            )
            out['verbose'] = "Topics:\n" + "\n".join(lines)
    if verbose:
        out['raw']['topics'] = topics_with_wrong_rf

    return out
202380
def process(self):
        ''''''
        for tag_proc in self.tag_procs:
            before_count = self.entry_count
            self.run_tag_processor(tag_proc)
            after_count = self.entry_count

            if self.verbose:
                print('Inserted %d entries for "%s" tag processor' % (
                    after_count - before_count, tag_proc), file=sys.stderr)

        if self.verbose:
            print('Inserted %d entries overall' % self.entry_count,
                  file=sys.stderr)
991305
private void recomputeLoadSums() {
        loadsHaveChanged.set(false);
        for (int d = 0; d < nbDims; d++) {
            int sli = 0;
            int sls = 0;
            for (int b = 0; b < nbBins; b++) {
                sli += loads[d][b].getLB();
                sls += loads[d][b].getUB();
            }
            this.sumLoadInf[d].set(sli);
            this.sumLoadSup[d].set(sls);
        }
    }
285143
def update_values(self):
        """"""
        self.method = self.idx_method.currentText()
        spin_det = DetectSpindle(method=self.method)
        
        self.index['f1'].set_value(spin_det.frequency[0])
        self.index['f2'].set_value(spin_det.frequency[1])
        self.index['tolerance'].set_value(spin_det.tolerance)
        self.index['min_dur'].set_value(spin_det.duration[0])
        self.index['max_dur'].set_value(spin_det.duration[1])        
        self.index['interval'].set_value(spin_det.min_interval)

        if spin_det.rolloff:
            self.index['rolloff'].set_value(spin_det.rolloff)
            self.index['rolloff'].setEnabled(True)
        else:
            self.index['rolloff'].set_value('N/A')
            self.index['rolloff'].setEnabled(False)

        if self.method == 'Ferrarelli2007':
            self.label[0].setText('Detection threshold')
            self.label[1].setText('Selection threshold')
            self.label[2].setText('')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.det_thresh)
            self.index['1'].set_value(spin_det.sel_thresh)        
        
        if self.method == 'Nir2011':
            self.label[0].setText('Gaussian smoothing sigma (sec)')
            self.label[1].setText('Detection threshold (SD)')
            self.label[2].setText('Selection threshold (SD)')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.smooth['dur'])
            self.index['1'].set_value(spin_det.det_thresh)
            self.index['2'].set_value(spin_det.sel_thresh)            
        
        if self.method == 'Moelle2011':
            self.label[0].setText('RMS window length (sec)')
            self.label[1].setText('Smoothing window length (sec)')
            self.label[2].setText('Detection threshold (SD)')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.moving_rms['dur'])
            self.index['1'].set_value(spin_det.smooth['dur'])
            self.index['2'].set_value(spin_det.det_thresh)

        if self.method == 'Wamsley2012':
            self.label[0].setText('Wavelet window length (sec)')
            self.label[1].setText('Wavelet sigma (sec)')
            self.label[2].setText('Smoothing window length (sec)')
            self.label[3].setText('Detection threshold')
            self.label[4].setText('')
            self.label[5].setText('')
            
            self.index['0'].set_value(spin_det.det_wavelet['dur'])
            self.index['1'].set_value(spin_det.det_wavelet['sd'])
            self.index['2'].set_value(spin_det.smooth['dur'])
            self.index['3'].set_value(spin_det.det_thresh)

        if self.method == 'Martin2013':
            self.label[0].setText('RMS window length (sec)')
            self.label[1].setText('RMS window step (sec)')
            self.label[2].setText('Detection threshold (percentile)')
            
            self.index['0'].set_value(spin_det.moving_rms['dur'])
            self.index['1'].set_value(spin_det.moving_rms['step'])
            self.index['2'].set_value(spin_det.det_thresh)
        
        if self.method == 'Ray2015':
            self.label[0].setText('Smoothing window length (sec)')
            self.label[1].setText('z-score window length (sec)')
            self.label[2].setText('Detection threshold (z)')
            self.label[3].setText('Selection threshold (z)')
            self.label[4].setText('')
            self.label[5].setText('')
            
            self.index['0'].set_value(spin_det.smooth['dur'])
            self.index['1'].set_value(spin_det.zscore['step'])
            self.index['2'].set_value(spin_det.det_thresh)
            self.index['3'].set_value(spin_det.sel_thresh)

        if self.method == 'Lacourse2018':
            self.label[0].setText('Window length (sec)')
            self.label[1].setText('Window step (sec)')
            self.label[2].setText('Absolute power threshold')
            self.label[3].setText('Relative power threshold')
            self.label[4].setText('Covariance threshold')
            self.label[5].setText('Correlation threshold')
            
            self.index['0'].set_value(spin_det.windowing['dur'])
            self.index['1'].set_value(spin_det.windowing['step'])
            self.index['2'].set_value(spin_det.abs_pow_thresh)
            self.index['3'].set_value(spin_det.rel_pow_thresh)
            self.index['4'].set_value(spin_det.covar_thresh)
            self.index['5'].set_value(spin_det.corr_thresh)

        if self.method == 'FASST':
            self.label[0].setText('Detection threshold (percentile)')
            self.label[1].setText('Smoothing window length (sec)')
            self.label[2].setText('')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.det_thresh)
            self.index['1'].set_value(spin_det.smooth['dur'])
            
        if self.method == 'FASST2':
            self.label[0].setText('Detection threshold (percentile)')
            self.label[1].setText('RMS window length (sec)')
            self.label[2].setText('Smoothing window length (sec)')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.det_thresh)
            self.index['1'].set_value(spin_det.moving_rms['dur'])
            self.index['2'].set_value(spin_det.smooth['dur'])
            
        if 'UCSD' in self.method:
            self.label[0].setText('Wavelet duration (sec)')
            self.label[1].setText('Wavelet width (sec)')
            self.label[2].setText('Smoothing window length (sec)')
            self.label[3].setText('Detection threshold (SD)')
            self.label[4].setText('Selection threshold (SD)')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.det_wavelet['dur'])
            self.index['1'].set_value(spin_det.det_wavelet['width'])
            self.index['2'].set_value(spin_det.det_wavelet['win'])
            self.index['3'].set_value(spin_det.det_thresh)
            self.index['4'].set_value(spin_det.sel_thresh)

        if 'Concordia' in self.method:
            self.label[0].setText('RMS window length (sec)')
            self.label[1].setText('Smoothing window length (sec)')
            self.label[2].setText('Detection threshold, low (SD)')
            self.label[3].setText('Detection threshold, high (SD)')
            self.label[4].setText('Tolerance (sec)')
            self.label[5].setText('Selection threshold (SD)')

            self.index['0'].set_value(spin_det.moving_rms['dur'])
            self.index['1'].set_value(spin_det.smooth['dur'])
            self.index['2'].set_value(spin_det.det_thresh)
            self.index['3'].set_value(spin_det.det_thresh_hi)
            self.index['4'].set_value(spin_det.tolerance)
            self.index['5'].set_value(spin_det.sel_thresh)
        
        for i, j in enumerate(self.label):
            one_param = self.index[str(i)]
            if j.text() == '':
                one_param.set_value('')
                one_param.setEnabled(False)
            else:
                one_param.setEnabled(True)
61555
private void fixTrans() {
        matrix.getValues(m);
        float transX = m[Matrix.MTRANS_X];
        float transY = m[Matrix.MTRANS_Y];

        float fixTransX = getFixTrans(transX, viewWidth, getImageWidth());
        float fixTransY = getFixTrans(transY, viewHeight, getImageHeight());

        if (fixTransX != 0 || fixTransY != 0) {
            matrix.postTranslate(fixTransX, fixTransY);
        }
    }
655001
def run(self):
        """"""

        # Create a set of excluded reactions
        exclude = set(self._args.exclude)
        count = 0
        unbalanced = 0
        unchecked = 0
        for reaction, result in formula_balance(self._model):
            count += 1

            if reaction.id in exclude or reaction.equation is None:
                continue

            if result is None:
                unchecked += 1
                continue

            left_form, right_form = result
            if right_form != left_form:
                unbalanced += 1
                right_missing, left_missing = Formula.balance(
                    right_form, left_form)

                print('{}\t{}\t{}\t{}\t{}'.format(
                    reaction.id, left_form, right_form,
                    left_missing, right_missing))

        logger.info('Unbalanced reactions: {}/{}'.format(unbalanced, count))
        logger.info('Unchecked reactions due to missing formula: {}/{}'.format(
            unchecked, count))
        logger.info('Reactions excluded from check: {}/{}'.format(
            len(exclude), count))
364590
def process(self, buff):
        '''
            
        '''
        (self._stack, self._memory, scstateidx, self._state, 
            tmpevents, self._waitingforprop, self._parentismap) = process( buff, self.create_parser_info(), self._deserializers);
        self._scstate = self.scstatelist[scstateidx-1]
        
        self._events = tmpevents
754142
private function preprocess()
    {
        $this->do_action('afw_options_pre_process');
        Notifier::reset();
        State::set('errors', array());
        $this->update();
        $this->do_action('afw_options_post_process');
    }
896575
@SuppressWarnings("all")
  public void normalize() {
    // Start on samples
    int samplesPerFrame = (int) ((float) getSamplesPerSecond() / (float) getFramesPerSecond());
    setFrames(getFrames() + (int) (getSamples() * (1.0f / samplesPerFrame)));
    setSamples(getSamples() % samplesPerFrame);

    setSeconds(getSeconds() + (int) ((float) getFrames() / getFramesPerSecond()));
    setFrames((int) (getFrames() % getFramesPerSecond()));

    while (getSeconds() >= 60) {
      setSeconds(getSeconds() - 60);
      setMinutes(getMinutes() + 1);
    }
    while (getMinutes() >= 60) {
      setMinutes(getMinutes() - 60);
      setHours(getHours() + 1);
    }
  }
918776
def run(self, data):
        
        if self.normalize_data:
            data = cell_normalize(data)
        M, W, ll = poisson_estimate_state(data, **self.params)
        outputs = []
        if self.return_w:
            outputs.append(W)
        if self.return_m:
            outputs.append(M)
        if self.return_mw:
            outputs.append(M.dot(W))
        if self.return_mds:
            X = dim_reduce(M, W, 2)
            outputs.append(X.T.dot(W))
        return outputs, ll
791900
def handler(self):
        """"""
        printtime('Creating and populating objects', self.start)
        self.populate()
        printtime('Populating {} sequence profiles'.format(self.analysistype), self.start)
        self.profiler()
        # Annotate sequences with prokka
        self.annotatethreads()
        # Run the analyses
        self.cdsthreads()
        # Find core coding features
        self.cdssequencethreads()
        # Extract the sequence for each coding feature
        self.allelematchthreads()
        # Determine sequence types from the analyses
        printtime('Determining {} sequence types'.format(self.analysistype), self.start)
        self.sequencetyper()
        # Create reports
        printtime('Creating {} reports'.format(self.analysistype), self.start)
        self.reporter()
666806
def doUnitConversions(self):
        
         # Image information
        _handle = fileutil.openImage(self._filename, mode='readonly', memmap=False)

        # Now convert the SCI array(s) units
        for det in range(1,self._numchips+1):
            chip=self._image[self.scienceExt,det]
            conversionFactor = 1.0
            # add D2IMFILE to outputNames for removal by 'clean()' method later
            if 'D2IMFILE' in _handle[0].header and _handle[0].header['D2IMFILE'] not in ["","N/A"]:
                chip.outputNames['d2imfile'] = _handle[0].header['D2IMFILE']

            if chip._gain is not None:
                """
                # Multiply the values of the sci extension pixels by the gain.
                print "Converting %s[%d] from COUNTS to ELECTRONS"%(self._filename,det)

                # If the exptime is 0 the science image will be zeroed out.
                np.multiply(_handle[self.scienceExt,det].data,chip._gain,_handle[self.scienceExt,det].data)
                chip.data=_handle[self.scienceExt,det].data

                # Set the BUNIT keyword to 'electrons'
                chip._bunit = 'ELECTRONS'
                chip.header.update('BUNIT','ELECTRONS')
                _handle[self.scienceExt,det].header.update('BUNIT','ELECTRONS')

                # Update the PHOTFLAM value
                photflam = _handle[self.scienceExt,det].header['PHOTFLAM']
                _handle[self.scienceExt,det].header.update('PHOTFLAM',(photflam/chip._gain))
                """
                conversionFactor = chip._gain
                chip._effGain = chip._gain #1.
                chip._conversionFactor = conversionFactor #1.

            else:
                msg = "Invalid gain value for data, no conversion done"
                print(msg)
                raise ValueError(msg)

        # Close the files and clean-up
        _handle.close()
        self._effGain = conversionFactor
977204
public static void inplaceAdjustCameraMatrix( double sx , double sy , double tx , double ty , DMatrixRMaj P ) {
		// multiply each column one at a time. Because of the zeros everything is decoupled
		for (int col = 0; col < 4; col++) {
			int row0 = col;
			int row1 = 4 + row0;
			int row2 = 4 + row1;
			P.data[row0] = P.data[row0]*sx + tx*P.data[row2];
			P.data[row1] = P.data[row1]*sy + ty*P.data[row2];
		}
	}