Check for differing subsample factors.
336579
def _subsampling_sanity_check(self):
        
        dxs = np.array(self.codestream.segment[1].xrsiz)
        dys = np.array(self.codestream.segment[1].yrsiz)
        if np.any(dxs - dxs[0]) or np.any(dys - dys[0]):
            msg = ("The read_bands method should be used with the subsampling "
                   "factors are different. "
                   "\n\n{siz_segment}")
            msg = msg.format(siz_segment=str(self.codestream.segment[1]))
            raise IOError(msg)
628794
function calcCFFSubroutineBias(subrs) {
            var bias;
            if (subrs.length < 1240) {
                bias = 107;
            }
            else if (subrs.length < 33900) {
                bias = 1131;
            }
            else {
                bias = 32768;
            }

            return bias;
        }
5685
def check(self, feature):
        """"""
        mapper = feature.as_dataframe_mapper()
        mapper.fit(self.X, y=self.y)
387030
private void CheckCIELab(IfdTags metadata, int n) {
    // BitsPerSample
    if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) {
      validation.addErrorLoc("Missing BitsPerSample", "IFD" + n);
    } else {
      for (abstractTiffType vi : metadata.get(TiffTags.getTagId("BitsPerSample")).getValue()) {
        if (vi.toInt() != 8) {
          validation.addError("Invalid BitsPerSample", "IFD" + n, vi.toInt());
          break;
        }
      }
    }
  }
285235
def sample_alt_and_depth(rec, sample):
    
    if sample and "AD" in sample:
        all_counts = [int(x) for x in sample["AD"]]
        alt_counts = sum(all_counts[1:])
        depth = sum(all_counts)
    elif sample and "AO" in sample and sample.get("RO") is not None:
        alts = sample["AO"]
        if not isinstance(alts, (list, tuple)):
            alts = [alts]
        alt_counts = sum([int(x) for x in alts])
        depth = alt_counts + int(sample["RO"])
    elif "DP" in rec.info and "AF" in rec.info:
        af = rec.info["AF"][0] if isinstance(rec.info["AF"], (tuple, list)) else rec.info["AF"]
        return None, rec.info["DP"], af
    else:
        alt_counts = None
    if alt_counts is None or depth is None or depth == 0:
        return None, None, None
    else:
        freq = float(alt_counts) / float(depth)
        return alt_counts, depth, freq
264169
def check_with_uniform(uf, arg_shapes, dim=None, npuf=None, rmin=-10, type_list=[np.float32]):
    """"""
    if isinstance(arg_shapes, int):
        assert dim
        shape = tuple(np.random.randint(1, int(1000**(1.0/dim)), size=dim))
        arg_shapes = [shape] * arg_shapes
    for dtype in type_list:
        ndarray_arg = []
        numpy_arg = []
        for s in arg_shapes:
            npy = np.random.uniform(rmin, 10, s).astype(dtype)
            narr = mx.nd.array(npy, dtype=dtype)
            ndarray_arg.append(narr)
            numpy_arg.append(npy)
        out1 = uf(*ndarray_arg)
        if npuf is None:
            out2 = uf(*numpy_arg).astype(dtype)
        else:
            out2 = npuf(*numpy_arg).astype(dtype)

        assert out1.shape == out2.shape
        if isinstance(out1, mx.nd.NDArray):
            out1 = out1.asnumpy()
        if dtype == np.float16:
            assert reldiff(out1, out2) < 2e-3
        else:
            assert reldiff(out1, out2) < 1e-6
496977
def calculate_upsample_output_shapes(operator):
    '''
    
    '''
    check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1)
    check_input_and_output_types(operator, good_input_types=[FloatTensorType])

    scales = operator.raw_operator.upsample.scalingFactor

    output_shape = copy.deepcopy(operator.inputs[0].type.shape)
    output_shape[2] *= scales[0]
    output_shape[3] *= scales[1]

    operator.outputs[0].type = FloatTensorType(output_shape, doc_string=operator.outputs[0].type.doc_string)
926689
private int findSampleRate(int sampleIndex, int version)
	{
		int ind = -1;

		switch (version)
		{
			case MPEG_V_1:
				ind = 0;
				break;
			case MPEG_V_2:
				ind = 1;
				break;
			case MPEG_V_25:
				ind = 2;
		}

		if ((ind != -1) && (sampleIndex >= 0) && (sampleIndex <= 3))
		{
			return sampleTable[sampleIndex][ind];
		}
		return -1;
	}
1250131
def _split_coefficents(self, w):
        """"""
        if self._fit_intercept:
            bias = w[0]
            wf = w[1:]
        else:
            bias = 0.0
            wf = w
        return bias, wf
296049
def findDuplicates(tfam):
    
    uSamples = {}
    dSamples = defaultdict(list)
    for i, row in enumerate(tfam):
        sampleID = tuple(row[:2])
        if sampleID not in uSamples:
            # This is the first time we see this sample
            uSamples[sampleID] = i
        else:
            # We have seen this sample at least once...
            if sampleID not in dSamples:
                # This is the second time we see this sample...
                dSamples[sampleID].extend([uSamples[sampleID], i])
            else:
                # We have seen this sample multiple times
                dSamples[sampleID].append(i)

    # Removing the duplicates from the unique samples
    for sampleID in dSamples.iterkeys():
        if sampleID in uSamples:
            del uSamples[sampleID]

    return uSamples, dSamples
399471
def _capture(f, t, t0, factor):
    '''
    
    '''
    n_per_sec = len(t) / t[-1]

    # len of one split:
    n = int(t0 * factor * n_per_sec)
    s = len(f) // n
    m = s * n
    f = f[:m]
    ff = np.split(f, s)
    m = np.mean(ff, axis=1)

    return np.std(m)
1016141
def _mixup( self, ps ):
        """"""
        for i in range(len(ps) - 1, 0, -1):
            j = int(numpy.random.random() * i)
            temp = ps[i]
            ps[i] = ps[j]
            ps[j] = temp
        return ps
342838
def upsample(self, factor):
        """"""
        self.command.append("upsample")
        self.command.append(factor)
        return self
460731
def issubset(self, other):
        """"""
        self._binary_sanity_check(other)
        return set.issubset(self, other)
286421
def getNumberOfRegularSamples(self):
        
        analyses = self.getRegularAnalyses()
        samples = [a.getRequestUID() for a in analyses]
        # discarding any duplicate values
        return len(set(samples))
970520
@Override
    public void generate2Samples(long[] values, String label1, String label2, double dividingFactor) {
        if (oldValues.containsKey(label1) && oldValues.containsKey(label2)) {
            generateSample(((double) (values[0] - oldValues.get(label1))) / dividingFactor, label1);
            generateSample(((double) (values[1] - oldValues.get(label2))) / dividingFactor, label2);
        }
        oldValues.put(label1, values[0]);
        oldValues.put(label2, values[1]);
    }
836930
def has_multiple_timesteps(data):
    """"""
    if "timestep" in data.keys():
        if len(np.unique(data["timestep"])) > 1:
            return True
    return False