=========================================================================
 CVAL

 @param:  NCON
 @return: Array of CVAL
=========================================================================
322948
def get_cvals(ncon)
      pos = Const::KSIZE * Const::RECL
      recl = 8

      begin
        return (0..ncon - 1).map do |i|
          File.binread(@bin_path, recl, pos + recl * i).unpack("d*")[0]
        end
      rescue => e
        raise
      end
    end
444057
public function generateDry($layer_name, $primitive_name, FQCN $qcn): array
    {
        $primitive = $this->getPrimitiveByName($primitive_name);
        $layer     = $this->getLayerByName($layer_name);
        
        $this->updatePlaceholders(
            [
                // default for given layer
                "/*<BASE_TEST_NAMESPACE>*/" => $layer->getTestsFqcn()->getFqcn(),
                "/*<BASE_SRC_NAMESPACE>*/" => $layer->getSrcFqcn()->getFqcn(),
                
                "/*<LAYER>*/" => $layer->getName(),
                "/*<PRIMITIVE>*/" => $primitive_name,
                
                "/*<PSR4_NAMESPACE>*/" => $qcn->getFqcn(),
                "/*<PSR4_NAMESPACE_BASE>*/" => $qcn->getBasePart(),
                "/*<PSR4_NAMESPACE_LAST>*/" => $qcn->getLastPart(),
            
            ]);
        $generated_stubs = $this->generateStubs($primitive, $layer, $qcn);
        
        return $generated_stubs;
    }
1192000
function(mCons, vCons, k){
            var nCons = {}; // the final nested constraints
            
            // if there are per-key constraints for k, add them all
            if(validate.isObject(mCons[k])){
                nCons = validateParams.extendObject({}, mCons[k]);
            }
            
            // loop through each universal constraint and merge as appropraite
            if(vCons){
                Object.keys(vCons).forEach(function(vn){
                    // only add non-clashing universal constraints
                    if(!nCons[vn]){
                        nCons[vn] = vCons[vn];
                    }
                });
            }
            
            // return the merged constraints
            return nCons;
        }
799433
def subset_by_supported(input_file, get_coords, calls_by_name, work_dir, data,
                        headers=("#",)):
    
    support_files = [(c, tz.get_in([c, "vrn_file"], calls_by_name))
                     for c in convert.SUBSET_BY_SUPPORT["cnvkit"]]
    support_files = [(c, f) for (c, f) in support_files if f and vcfutils.vcf_has_variants(f)]
    if len(support_files) == 0:
        return input_file
    else:
        out_file = os.path.join(work_dir, "%s-havesupport%s" %
                                utils.splitext_plus(os.path.basename(input_file)))
        if not utils.file_uptodate(out_file, input_file):
            input_bed = _input_to_bed(input_file, work_dir, get_coords, headers)
            pass_coords = set([])
            with file_transaction(data, out_file) as tx_out_file:
                support_beds = " ".join([_sv_vcf_to_bed(f, c, out_file) for c, f in support_files])
                tmp_cmp_bed = "%s-intersectwith.bed" % utils.splitext_plus(tx_out_file)[0]
                cmd = "bedtools intersect -wa -f 0.5 -r -a {input_bed} -b {support_beds} > {tmp_cmp_bed}"
                do.run(cmd.format(**locals()), "Intersect CNVs with support files")
                for r in pybedtools.BedTool(tmp_cmp_bed):
                    pass_coords.add((str(r.chrom), str(r.start), str(r.stop)))
                with open(input_file) as in_handle:
                    with open(tx_out_file, "w") as out_handle:
                        for line in in_handle:
                            passes = True
                            if not line.startswith(headers):
                                passes = get_coords(line) in pass_coords
                            if passes:
                                out_handle.write(line)
        return out_file
1095694
def GetCBVs(campaign, model='nPLD', clobber=False, **kwargs):
    '''
    

    '''

    # Initialize logging?
    if len(logging.getLogger().handlers) == 0:
        InitLog(file_name=None, screen_level=logging.DEBUG)
    log.info('Computing CBVs for campaign %d...' % (campaign))

    # Output path
    path = os.path.join(EVEREST_DAT, 'k2', 'cbv', 'c%02d' % campaign)
    if not os.path.exists(path):
        os.makedirs(path)

    # Get the design matrix
    xfile = os.path.join(path, 'X.npz')
    if clobber or not os.path.exists(xfile):

        log.info('Obtaining light curves...')
        time = None
        for module in range(2, 25):

            # Get the light curves
            lcfile = os.path.join(path, '%d.npz' % module)
            if clobber or not os.path.exists(lcfile):
                try:
                    time, breakpoints, fluxes, errors, kpars = GetStars(
                        campaign, module, model=model, **kwargs)
                except AssertionError:
                    continue
                np.savez(lcfile, time=time, breakpoints=breakpoints,
                         fluxes=fluxes, errors=errors, kpars=kpars)

            # Load the light curves
            lcs = np.load(lcfile)
            if time is None:
                time = lcs['time']
                breakpoints = lcs['breakpoints']
                fluxes = lcs['fluxes']
                errors = lcs['errors']
                kpars = lcs['kpars']
            else:
                fluxes = np.vstack([fluxes, lcs['fluxes']])
                errors = np.vstack([errors, lcs['errors']])
                kpars = np.vstack([kpars, lcs['kpars']])

        # Compute the design matrix
        log.info('Running SysRem...')
        X = np.ones((len(time), 1 + kwargs.get('ncbv', 5)))

        # Loop over the segments
        new_fluxes = np.zeros_like(fluxes)
        for b in range(len(breakpoints)):

            # Get the current segment's indices
            inds = GetChunk(time, breakpoints, b)

            # Update the error arrays with the white GP component
            for j in range(len(errors)):
                errors[j] = np.sqrt(errors[j] ** 2 + kpars[j][0] ** 2)

            # Get de-trended fluxes
            X[inds, 1:] = SysRem(time[inds], fluxes[:, inds],
                                 errors[:, inds], **kwargs).T

        # Save
        np.savez(xfile, X=X, time=time, breakpoints=breakpoints)

    else:

        # Load from disk
        data = np.load(xfile)
        X = data['X'][()]
        time = data['time'][()]
        breakpoints = data['breakpoints'][()]

    # Plot
    plotfile = os.path.join(path, 'X.pdf')
    if clobber or not os.path.exists(plotfile):
        fig, ax = pl.subplots(2, 3, figsize=(12, 8))
        fig.subplots_adjust(left=0.05, right=0.95)
        ax = ax.flatten()
        for axis in ax:
            axis.set_xticks([])
            axis.set_yticks([])
        for b in range(len(breakpoints)):
            inds = GetChunk(time, breakpoints, b)
            for n in range(min(6, X.shape[1])):
                ax[n].plot(time[inds], X[inds, n])
                ax[n].set_title(n, fontsize=14)
        fig.savefig(plotfile, bbox_inches='tight')

    return X
313873
function (cpon, obj) {
  if (typeof cpon !== 'string')
    throw new Error('expected CPON string');

  if (obj === undefined)
    obj = {};

  var caret = cpon.indexOf('^');
  if (caret < 0)
    throw new Error('caret (^) not found in garden');

  var key = left(cpon, caret);
  var value = cpon.substring(caret + 1);
  var pipe = value.indexOf('|');
  if (pipe > -1) {
    obj = (value.substring(pipe + 1),obj);
    value = left(value,pipe);
  }
  obj[key] = value;
  return obj;
}
108750
def getColumnsClasses(self, view=None):
        

        plone_view = getMultiAdapter(
            (self.context, self.request), name=u'plone')
        portal_state = getMultiAdapter(
            (self.context, self.request), name=u'plone_portal_state')

        sl = plone_view.have_portlets('plone.leftcolumn', view=view)
        sr = plone_view.have_portlets('plone.rightcolumn', view=view)

        isRTL = portal_state.is_rtl()

        # pre-fill dictionary
        columns = dict(one="", content="", two="")

        if not sl and not sr:
            # we don't have columns, thus conten takes the whole width
            columns['content'] = "col-md-12"

        elif sl and sr:
            # In case we have both columns, content takes 50% of the whole
            # width and the rest 50% is spread between the columns
            columns['one'] = "col-xs-12 col-md-2"
            columns['content'] = "col-xs-12 col-md-8"
            columns['two'] = "col-xs-12 col-md-2"

        elif (sr and not sl) and not isRTL:
            # We have right column and we are NOT in RTL language
            columns['content'] = "col-xs-12 col-md-10"
            columns['two'] = "col-xs-12 col-md-2"

        elif (sl and not sr) and isRTL:
            # We have left column and we are in RTL language
            columns['one'] = "col-xs-12 col-md-2"
            columns['content'] = "col-xs-12 col-md-10"

        elif (sl and not sr) and not isRTL:
            # We have left column and we are in NOT RTL language
            columns['one'] = "col-xs-12 col-md-2"
            columns['content'] = "col-xs-12 col-md-10"

        # # append cell to each css-string
        # for key, value in columns.items():
        #     columns[key] = "cell " + value

        return columns
680258
def lmpool(cvals):
    
    lenvals = ctypes.c_int(len(max(cvals, key=len)) + 1)
    n = ctypes.c_int(len(cvals))
    cvals = stypes.listToCharArrayPtr(cvals, xLen=lenvals, yLen=n)
    libspice.lmpool_c(cvals, lenvals, n)
629552
def array(self):
        
        return np.eye(self.M, self.N, self.k)
1253658
def macro_network():
    
    tpm = np.array([[0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 1.0, 1.0],
                    [0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 1.0, 1.0],
                    [0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 0.3, 0.3],
                    [0.3, 0.3, 1.0, 1.0],
                    [1.0, 1.0, 0.3, 0.3],
                    [1.0, 1.0, 0.3, 0.3],
                    [1.0, 1.0, 0.3, 0.3],
                    [1.0, 1.0, 1.0, 1.0]])
    return Network(tpm, node_labels=LABELS[:tpm.shape[1]])
381704
def array(arr, *args, **kwargs):
    '''
    
    '''
    return weldarray(np.array(arr, *args, **kwargs))
433757
def build_constraint_matrix(constrs)
      cbeg = []
      cind = []
      cval = []
      constrs.each.map do |constr|
        cbeg << cind.length
        constr.expression.terms.each do |var, coeff|
          cind << var.index
          cval << coeff
        end
      end

      [cbeg, cind, cval]
    end
1194379
def get_cfn_parameters(self):
        
        variables = self.get_variables()
        output = {}
        for key, value in variables.items():
            if hasattr(value, "to_parameter_value"):
                output[key] = value.to_parameter_value()
        return output
865336
def as_dict(self):
        
        bson_nb_voro_list2 = self.to_bson_voronoi_list2()
        return {"@module": self.__class__.__module__,
                "@class": self.__class__.__name__,
                "bson_nb_voro_list2": bson_nb_voro_list2,
                # "neighbors_lists": self.neighbors_lists,
                "structure": self.structure.as_dict(),
                "normalized_angle_tolerance": self.normalized_angle_tolerance,
                "normalized_distance_tolerance": self.normalized_distance_tolerance,
                "additional_conditions": self.additional_conditions,
                "valences": self.valences,
                "maximum_distance_factor": self.maximum_distance_factor,
                "minimum_angle_factor": self.minimum_angle_factor}
1049776
def to_bson(options = {})
      options = { :root => Rabl.configuration.include_bson_root }.merge(options)
      result = to_dumpable(options)

      if !collection_root_name && is_collection?(root_object) && root_object.is_a?(Array)
        result = { root_name => result }
      end

      Rabl.configuration.bson_engine.serialize(result).to_s
    end
1228047
def _get_indexers_coords_and_indexes(self, indexers):
        
        from .dataarray import DataArray

        coord_list = []
        indexes = OrderedDict()
        for k, v in indexers.items():
            if isinstance(v, DataArray):
                v_coords = v.coords
                if v.dtype.kind == 'b':
                    if v.ndim != 1:  # we only support 1-d boolean array
                        raise ValueError(
                            '{:d}d-boolean array is used for indexing along '
                            'dimension {!r}, but only 1d boolean arrays are '
                            'supported.'.format(v.ndim, k))
                    # Make sure in case of boolean DataArray, its
                    # coordinate also should be indexed.
                    v_coords = v[v.values.nonzero()[0]].coords

                coord_list.append({d: v_coords[d].variable for d in v.coords})
                indexes.update(v.indexes)

        # we don't need to call align() explicitly or check indexes for
        # alignment, because merge_variables already checks for exact alignment
        # between dimension coordinates
        coords = merge_variables(coord_list)
        assert_coordinate_consistent(self, coords)

        # silently drop the conflicted variables.
        attached_coords = OrderedDict(
            (k, v) for k, v in coords.items() if k not in self._variables
        )
        attached_indexes = OrderedDict(
            (k, v) for k, v in indexes.items() if k not in self._variables
        )
        return attached_coords, attached_indexes
1207632
function GetAssoc($force_array = false, $first2cols = false)
	{
		$records = $this->_numOfRows;
		$results = array();
		for ( $i=0; $i < $records; $i++ ) {
			foreach ( $this->fields as $k=>$v ) {
				if ( is_array( $v ) ) {
					if ( $v['count'] == 1 ) {
						$results[$i][$k] = $v[0];
					} else {
						array_shift( $v );
						$results[$i][$k] = $v;
					}
				}
			}
		}

		return $results;
	}