Get significant results.
170025
def get_results_sig(self):
        """"""
        # Only print results when uncorrected p-value < this value.
        print("{N:7,} of {M:,} results have uncorrected P-values <= {PVAL}=pval\n".format(
            N=sum(1 for r in self.results_all if r.p_uncorrected < self.args.pval),
            M=len(self.results_all),
            PVAL=self.args.pval))
        pval_fld = self.get_pval_field()
        results = [r for r in self.results_all if getattr(r, pval_fld) <= self.args.pval]
        return results
731296
def evaluate(self, batchsize):
        """"""
        sum_loss, sum_accuracy = 0, 0
        for i in range(0, self.testsize, batchsize):
            x = Variable(self.x_test[i: i + batchsize])
            y = Variable(self.y_test[i: i + batchsize])
            loss = self.model(x, y)
            sum_loss += loss.data * batchsize
            sum_accuracy += self.model.accuracy.data * batchsize
        return sum_loss / self.testsize, sum_accuracy / self.testsize
132364
def _handle_results(options):
    """"""
    results_processor = options.get('_process_results')
    if not results_processor:
        results_processor = _process_results

    processor_result = results_processor()
    if isinstance(processor_result, (Async, Context)):
        processor_result.start()
843768
public void process() {

		// compute match intensities
		if( mask == null )
			match.process(template);
		else
			match.process(template,mask);

		GrayF32 intensity = match.getIntensity();
		int offsetX = 0;
		int offsetY = 0;

		// adjust intensity image size depending on if there is a border or not
		if (!match.isBorderProcessed()) {
			int x0 = match.getBorderX0();
			int x1 = imageWidth - (template.width - x0);
			int y0 = match.getBorderY0();
			int y1 = imageHeight - (template.height - y0);
			intensity = intensity.subimage(x0, y0, x1, y1, null);
		} else {
			offsetX = match.getBorderX0();
			offsetY = match.getBorderY0();
		}

		// find local peaks in intensity image
		candidates.reset();
		extractor.process(intensity, null,null,null, candidates);

		// select the best matches
		if (scores.length < candidates.size) {
			scores = new float[candidates.size];
			indexes = new int[candidates.size];
		}

		for (int i = 0; i < candidates.size; i++) {
			Point2D_I16 p = candidates.get(i);

			scores[i] = -intensity.get(p.x, p.y);
		}

		int N = Math.min(maxMatches, candidates.size);

		QuickSelect.selectIndex(scores, N, candidates.size, indexes);

		// save the results
		results.reset();
		for (int i = 0; i < N; i++) {
			Point2D_I16 p = candidates.get(indexes[i]);

			Match m = results.grow();
			m.score = -scores[indexes[i]];
			m.set(p.x - offsetX, p.y - offsetY);
		}
	}
188412
def _run(self):
        """"""
        success = self.initialize()
        while success is None:
            success = self.propagate()
        return success
699021
def run_study(self, study, **kws):
        """"""
        if not study:
            return []
        # Key-word arguments:
        methods = Methods(kws['methods']) if 'methods' in kws else self.methods
        alpha = kws['alpha'] if 'alpha' in kws else self.alpha
        log = kws['log'] if 'log' in kws else self.log
        # Calculate uncorrected pvalues
        results = self.get_pval_uncorr(study, log)
        if not results:
            return []

        if log is not None:
            log.write("  {MSG}\n".format(MSG="\n  ".join(self.get_results_msg(results, study))))

        # Do multipletest corrections on uncorrected pvalues and update results
        self._run_multitest_corr(results, methods, alpha, study, log)

        for rec in results:
            # get go term for name and level
            rec.set_goterm(self.obo_dag)

        # 'keep_if' can be used to keep only significant GO terms. Example:
        #     >>> keep_if = lambda nt: nt.p_fdr_bh < 0.05 # if results are significant
        #     >>> goea_results = goeaobj.run_study(geneids_study, keep_if=keep_if)
        if 'keep_if' in kws:
            keep_if = kws['keep_if']
            results = [r for r in results if keep_if(r)]

        # Default sort order:
        results.sort(key=lambda r: [r.enrichment, r.NS, r.p_uncorrected])
        return results
53850
def results(self):
        """"""

        # Add all saved samples to the results.
        if self.save_samples:
            with warnings.catch_warnings():
                warnings.simplefilter("ignore")
                results = [('nlive', self.nlive),
                           ('niter', self.it - 1),
                           ('ncall', np.array(self.saved_nc)),
                           ('eff', self.eff),
                           ('samples', np.array(self.saved_v)),
                           ('samples_id', np.array(self.saved_id)),
                           ('samples_it', np.array(self.saved_it)),
                           ('samples_u', np.array(self.saved_u)),
                           ('logwt', np.array(self.saved_logwt)),
                           ('logl', np.array(self.saved_logl)),
                           ('logvol', np.array(self.saved_logvol)),
                           ('logz', np.array(self.saved_logz)),
                           ('logzerr', np.sqrt(np.array(self.saved_logzvar))),
                           ('information', np.array(self.saved_h))]
        else:
            raise ValueError("You didn't save any samples!")

        # Add any saved bounds (and ancillary quantities) to the results.
        if self.save_bounds:
            results.append(('bound', copy.deepcopy(self.bound)))
            results.append(('bound_iter',
                            np.array(self.saved_bounditer, dtype='int')))
            results.append(('samples_bound',
                            np.array(self.saved_boundidx, dtype='int')))
            results.append(('scale', np.array(self.saved_scale)))

        return Results(results)
1024416
def process_result_value(self, value, dialect):
        """"""
        if value is not None:
            value = simplejson.loads(value)
        return value
394740
def build_result(data):
    """"""
    more = {}
    for key, value  in data.items():
        if key != 'elements':
            newnode = value
        else:
            newnode = {}
            for el in value:
                nkey, nvalue = process_node(el)
                newnode[nkey] = nvalue

        more[key] = newnode

    return more
193010
def combine_results(self, results):
        """"""
        result = {}
        for key in results[0]:
            result[key] = numpy.concatenate([r[key] for r in results])
        return result
241361
def ratable_result(value, name, msgs):
    """"""
    return lambda w: Result(w, value, name, msgs)
726460
def run(self):
        """"""
        self._assure_output_dir(self.output)
        companies = self.read()
        print '%s CNPJs found' % len(companies)

        pbar = ProgressBar(
            widgets=[Counter(), ' ', Percentage(), ' ', Bar(), ' ', Timer()],
            maxval=len(companies)).start()

        resolved = 0
        runner = Runner(companies, self.days, self.token)

        try:
            for data in runner:
                self.write(data)
                resolved = resolved + 1
                pbar.update(resolved)
        except KeyboardInterrupt:
            print '\naborted: waiting current requests to finish.'
            runner.stop()
            return

        pbar.finish()
277837
def build_results(self, results):
        """"""
        self.add_result_subsection(
            'Exploit mitigation techniques',
            {
                'level': results.get('Plugins', {}).get('mitigation', {}).get('level', None),
                'summary': results.get('Plugins', {}).get('mitigation', {}).get('summary', None),
                'content': results.get('Plugins', {}).get('mitigation', {}).get('plugin_output', None)
            }
        )
        self.add_result_subsection(
            'Suspicious strings',
            {
                'level': results.get('Plugins', {}).get('strings', {}).get('level', None),
                'summary': results.get('Plugins', {}).get('strings', {}).get('summary', None),
                'content': results.get('Plugins', {}).get('strings', {}).get('plugin_output', None)
            }
        )
        self.add_result_subsection(
            'Suspicious imports',
            {
                'level': results.get('Plugins', {}).get('imports', {}).get('level', None),
                'summary': results.get('Plugins', {}).get('imports', {}).get('summary', None),
                'content': results.get('Plugins', {}).get('imports', {}).get('plugin_output', None)
            }
        )
        self.add_result_subsection(
            'Packer',
            {
                'level': results.get('Plugins', {}).get('packer', {}).get('level', None),
                'summary': results.get('Plugins', {}).get('packer', {}).get('summary', None),
                'content': results.get('Plugins', {}).get('packer', {}).get('plugin_output', None)
            }
        )
        self.add_result_subsection(
            'Clamav',
            {
                'level': results.get('Plugins', {}).get('clamav', {}).get('level', None),
                'summary': results.get('Plugins', {}).get('clamav', {}).get('summary', None),
                'content': results.get('Plugins', {}).get('clamav', {}).get('plugin_output', None)
            }
        )
        self.add_result_subsection('Manalyze raw output', json.dumps(results, indent=4))
1017518
def results( self ):
        """"""
        rs = []
        for k in self._results.keys():
            # filter out pending job ids, which can be anything except dicts
            ars = [ res for res in self._results[k] if isinstance(res, dict) ]
            rs.extend(ars)
        return rs
400560
def process_results(self, paragraph):
        """"""
        if 'editorMode' in paragraph['config']:
            mode = paragraph['config']['editorMode'].split('/')[-1]
            if 'results' in paragraph and paragraph['results']['msg']:
                msg = paragraph['results']['msg'][0]
                if mode not in ('text', 'markdown'):
                    self.output_options[msg['type']](msg['data'])
1231492
def run
      results = { }
      keyboards.each do |keyboard|
        # set up container vars
        prev_hand = nil
        alternation_effort = 0
        reach_effort = 0
        open_and_process(filename,'r') do |file|
          while line = file.gets
            line.each_char do |char|
              if effort = keyboard::MAP[char]

                # measure alternation efficiency
                hand = keyboard::LEFT_KEYS.include?(char) ? 'l' : 'r'
                if prev_hand
                  alternation_effort += (hand == prev_hand) ? 1 : 0
                end
                prev_hand = hand

                # measure reach efficiency
                reach_effort += effort
              end

            end
          end
        end

        results[keyboard::NAME.to_sym] = {
          :alternation_effort => alternation_effort,
          :reach_effort => reach_effort,
          :raw_score => (alternation_effort + reach_effort)
        }
      end
      results
    end
1111783
def _process_results():
    """"""
    async = get_current_async()
    callbacks = async.get_callbacks()

    if not isinstance(async.result.payload, AsyncException):
        callback = callbacks.get('success')
    else:
        callback = callbacks.get('error')

        if not callback:
            raise async.result.payload.exception, None, \
                async.result.payload.traceback[2]

    return _execute_callback(async, callback)