Python numpy.array_str() Examples

The following are 30 code examples for showing how to use numpy.array_str(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module numpy , or try the search function .

Example 1
Project: recruit   Author: Frank-qlu   File: arrayprint.py    License: Apache License 2.0 6 votes vote down vote up
def _array_str_implementation(
        a, max_line_width=None, precision=None, suppress_small=None,
        array2string=array2string):
    """Internal version of array_str() that allows overriding array2string."""
    if (_format_options['legacy'] == '1.13' and
            a.shape == () and not a.dtype.names):
        return str(a.item())

    # the str of 0d arrays is a special case: It should appear like a scalar,
    # so floats are not truncated by `precision`, and strings are not wrapped
    # in quotes. So we return the str of the scalar value.
    if a.shape == ():
        # obtain a scalar and call str on it, avoiding problems for subclasses
        # for which indexing with () returns a 0d instead of a scalar by using
        # ndarray's getindex. Also guard against recursive 0d object arrays.
        return _guarded_str(np.ndarray.__getitem__(a, ()))

    return array2string(a, max_line_width, precision, suppress_small, ' ', "") 
Example 2
Project: pytim   Author: Marcello-Sega   File: local_frame.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _():
        """ additional tests

        here we generate a paraboloid (x^2+y^2) and a hyperbolic paraboloid
        (x^2-y^2) to check that the curvature code gives the right answers for
        the Gaussian (4, -4) and mean (2, 0) curvatures

        >>> import pytim
        >>> x,y=np.mgrid[-5:5,-5:5.]/2.
        >>> p = np.asarray(list(zip(x.flatten(),y.flatten())))
        >>> z1 = p[:,0]**2+p[:,1]**2
        >>> z2 = p[:,0]**2-p[:,1]**2
        >>>
        >>> for z in [z1, z2]:
        ...     pp = np.asarray(list(zip(x.flatten()+5,y.flatten()+5,z)))
        ...     curv = pytim.observables.Curvature(cutoff=1.,warning=False).compute(pp)
        ...     val =  (curv[np.logical_and(p[:,0]==0,p[:,1]==0)])
        ...     # add and subtract 1e3 to be sure to have -0 -> 0
        ...     print(np.array_str((val+1e3)-1e3, precision=2, suppress_small=True))
        [[4. 2.]]
        [[-4.  0.]]


        """
# 
Example 3
Project: Mastering-Elasticsearch-7.0   Author: PacktPublishing   File: arrayprint.py    License: MIT License 6 votes vote down vote up
def _array_str_implementation(
        a, max_line_width=None, precision=None, suppress_small=None,
        array2string=array2string):
    """Internal version of array_str() that allows overriding array2string."""
    if (_format_options['legacy'] == '1.13' and
            a.shape == () and not a.dtype.names):
        return str(a.item())

    # the str of 0d arrays is a special case: It should appear like a scalar,
    # so floats are not truncated by `precision`, and strings are not wrapped
    # in quotes. So we return the str of the scalar value.
    if a.shape == ():
        # obtain a scalar and call str on it, avoiding problems for subclasses
        # for which indexing with () returns a 0d instead of a scalar by using
        # ndarray's getindex. Also guard against recursive 0d object arrays.
        return _guarded_str(np.ndarray.__getitem__(a, ()))

    return array2string(a, max_line_width, precision, suppress_small, ' ', "") 
Example 4
Project: ektelo   Author: ektelo   File: dataset.py    License: Apache License 2.0 6 votes vote down vote up
def __init__(self, hist, reduce_to_domain_shape=None, dist=None):
        """
            Any instances with equal key() values should have equal hash() values
            domain_shape will be result of regular grid partition
        """
        if isinstance(reduce_to_domain_shape, int): # allow for integers in 1D, instead of shape tuples
            reduce_to_domain_shape = (reduce_to_domain_shape, )

        if dist is not None:
            self._dist_str = numpy.array_str(numpy.array(dist))
        else:
            self._dist_str = ''

        self._hist = hist
        self._reduce_to_domain_shape = reduce_to_domain_shape if hist.shape != reduce_to_domain_shape else None
        self._dist = dist
        self._payload = None

        self._compiled = False 
Example 5
Project: ibeis   Author: Erotemic   File: query_request.py    License: Apache License 2.0 6 votes vote down vote up
def set_external_qaid_mask(qreq_, masked_qaid_list):
        r"""
        Args:
            qaid_list (list):

        CommandLine:
            python -m ibeis.algo.hots.query_request --test-set_external_qaid_mask

        Example:
            >>> # ENABLE_DOCTEST
            >>> from ibeis.algo.hots.query_request import *  # NOQA
            >>> import ibeis
            >>> ibs = ibeis.opendb(db='testdb1')
            >>> qaid_list = [1, 2, 3, 4, 5]
            >>> daid_list = [1, 2, 3, 4, 5]
            >>> qreq_ = ibs.new_query_request(qaid_list, daid_list)
            >>> masked_qaid_list = [2, 4, 5]
            >>> qreq_.set_external_qaid_mask(masked_qaid_list)
            >>> result = np.array_str(qreq_.qaids)
            >>> print(result)
            [1 3]
        """
        qreq_.set_internal_masked_qaids(masked_qaid_list)

    # --- Internal Annotation ID Masks ---- 
Example 6
Project: pyMHT   Author: erikliland   File: classDefinitions.py    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def predictAisMeasurements(self, scanTime, aisMeasurements):
        import pymht.models.pv as model
        import pymht.utils.kalman as kalman
        assert len(aisMeasurements) > 0
        aisPredictions = AisMessageList(scanTime)
        scanTimeString = datetime.datetime.fromtimestamp(scanTime).strftime("%H:%M:%S.%f")
        for measurement in aisMeasurements:
            aisTimeString = datetime.datetime.fromtimestamp(measurement.time).strftime("%H:%M:%S.%f")
            log.debug("Predicting AIS (" + str(measurement.mmsi) + ") from " + aisTimeString + " to " + scanTimeString)
            dT = scanTime - measurement.time
            assert dT >= 0
            state = measurement.state
            A = model.Phi(dT)
            Q = model.Q(dT)
            x_bar, P_bar = kalman.predict(A, Q, np.array(state, ndmin=2),
                                          np.array(measurement.covariance, ndmin=3))
            aisPredictions.measurements.append(
                AIS_prediction(model.C_RADAR.dot(x_bar[0]),
                               model.C_RADAR.dot(P_bar[0]).dot(model.C_RADAR.T), measurement.mmsi))
            log.debug(np.array_str(state) + "=>" + np.array_str(x_bar[0]))
            aisPredictions.aisMessages.append(measurement)
        assert len(aisPredictions.measurements) == len(aisMeasurements)
        return aisPredictions 
Example 7
Project: chainer   Author: chainer   File: variable.py    License: MIT License 6 votes vote down vote up
def variable_str(var):
    """Return the string representation of a variable.

    Args:
        var (~chainer.Variable): Input Variable.
    .. seealso:: numpy.array_str
    """
    arr = _cpu._to_cpu(var.array)

    if var.name:
        prefix = 'variable ' + var.name
    else:
        prefix = 'variable'

    if arr is None:
        lst = 'None'
    else:
        lst = numpy.array2string(arr, None, None, None, ' ', prefix + '(')

    return '%s(%s)' % (prefix, lst) 
Example 8
def _array_str_implementation(
        a, max_line_width=None, precision=None, suppress_small=None,
        array2string=array2string):
    """Internal version of array_str() that allows overriding array2string."""
    if (_format_options['legacy'] == '1.13' and
            a.shape == () and not a.dtype.names):
        return str(a.item())

    # the str of 0d arrays is a special case: It should appear like a scalar,
    # so floats are not truncated by `precision`, and strings are not wrapped
    # in quotes. So we return the str of the scalar value.
    if a.shape == ():
        # obtain a scalar and call str on it, avoiding problems for subclasses
        # for which indexing with () returns a 0d instead of a scalar by using
        # ndarray's getindex. Also guard against recursive 0d object arrays.
        return _guarded_str(np.ndarray.__getitem__(a, ()))

    return array2string(a, max_line_width, precision, suppress_small, ' ', "") 
Example 9
Project: cupy   Author: cupy   File: formatting.py    License: MIT License 6 votes vote down vote up
def array_str(arr, max_line_width=None, precision=None, suppress_small=None):
    """Returns the string representation of the content of an array.

    Args:
        arr (array_like): Input array. It should be able to feed to
            :func:`cupy.asnumpy`.
        max_line_width (int): The maximum number of line lengths.
        precision (int): Floating point precision. It uses the current printing
            precision of NumPy.
        suppress_small (bool): If ``True``, very small number are printed as
            zeros.

    .. seealso:: :func:`numpy.array_str`

    """
    return numpy.array_str(cupy.asnumpy(arr), max_line_width, precision,
                           suppress_small) 
Example 10
Project: uai-sdk   Author: ucloud   File: mnist_inference.py    License: Apache License 2.0 6 votes vote down vote up
def execute(self, data, batch_size):
        BATCH = namedtuple('BATCH', ['data', 'label'])
        self.model.bind(data_shapes=[('data', (batch_size, 1, 28, 28))],
                        label_shapes=[('softmax_label', (batch_size, 10))],
                        for_training=False)
        self.model.set_params(self.arg_params, self.aux_params)

        ret = []
        for i in range(batch_size):
            im = Image.open(data[i]).resize((28, 28))
            im = np.array(im) / 255.0
            im = im.reshape(-1, 1, 28, 28)
            self.model.forward(BATCH([mx.nd.array(im)], None))
            predict_values = self.model.get_outputs()[0].asnumpy()

            val = predict_values[0]
            ret_val = np.array_str(np.argmax(val)) + '\n'
            ret.append(ret_val)
        return ret 
Example 11
Project: uai-sdk   Author: ucloud   File: mnist_inference.py    License: Apache License 2.0 6 votes vote down vote up
def execute(self, data, batch_size):
    sess = self.output['sess']
    x = self.output['x']
    y_ = self.output['y_']

    imgs = []
    for i in range(batch_size):
      im = Image.open(data[i]).resize((28, 28)).convert('L')
      im = np.array(im)
      im = im.reshape(784)
      im = im.astype(np.float32)
      im = np.multiply(im, 1.0 / 255.0)
      imgs.append(im)

    imgs = np.array(imgs)
    predict_values = sess.run(y_, feed_dict={x: imgs})
    print(predict_values)

    ret = []
    for val in predict_values:
      ret_val = np.array_str(np.argmax(val)) + '\n'
      ret.append(ret_val)
    return ret 
Example 12
Project: me-trpo   Author: thanard   File: model_based_rl.py    License: MIT License 6 votes vote down vote up
def log_dictionary(mode_order, validation_costs, min_validation_costs, logger, first_n=5):
    for mode in mode_order:
        if mode in validation_costs:
            costs = validation_costs[mode]
            if hasattr(costs, '__iter__'):
                assert 'estimated' in mode
                msg = np.array_str(costs[:first_n], max_line_width=50, precision=2)
                logger.info('\t%.5s_validation_cost:\t%s' %
                            (mode, msg))
                logger.info('\t\tavg=%.2f, increase_ratio=%.2f' % (
                    np.mean(costs),
                    np.mean(costs > min_validation_costs[mode])
                ))
                logger.info('\t\tmode=%.2f, std=%.2f, min=%.2f, max=%.2f' %
                            (np.median(costs),
                             np.std(costs),
                             np.min(costs),
                             np.max(costs)))
            else:
                logger.info('\t%.5s_validation_cost:\t%.3f' %
                            (mode, costs)) 
Example 13
Project: yatsm   Author: ceholden   File: robust_fit.py    License: MIT License 5 votes vote down vote up
def __str__(self):
        return (("%s:\n"
                 " * Coefficients: %s\n"
                 " * Intercept = %.5f\n") %
                (self.__class__.__name__,
                 np.array_str(self.coef_, precision=4),
                 self.intercept_)) 
Example 14
Project: recruit   Author: Frank-qlu   File: arrayprint.py    License: Apache License 2.0 5 votes vote down vote up
def array_str(a, max_line_width=None, precision=None, suppress_small=None):
    """
    Return a string representation of the data in an array.

    The data in the array is returned as a single string.  This function is
    similar to `array_repr`, the difference being that `array_repr` also
    returns information on the kind of array and its data type.

    Parameters
    ----------
    a : ndarray
        Input array.
    max_line_width : int, optional
        Inserts newlines if text is longer than `max_line_width`.  The
        default is, indirectly, 75.
    precision : int, optional
        Floating point precision.  Default is the current printing precision
        (usually 8), which can be altered using `set_printoptions`.
    suppress_small : bool, optional
        Represent numbers "very close" to zero as zero; default is False.
        Very close is defined by precision: if the precision is 8, e.g.,
        numbers smaller (in absolute value) than 5e-9 are represented as
        zero.

    See Also
    --------
    array2string, array_repr, set_printoptions

    Examples
    --------
    >>> np.array_str(np.arange(3))
    '[0 1 2]'

    """
    return _array_str_implementation(
        a, max_line_width, precision, suppress_small)


# needed if __array_function__ is disabled 
Example 15
Project: recruit   Author: Frank-qlu   File: test_regression.py    License: Apache License 2.0 5 votes vote down vote up
def test_array_str_64bit(self):
        # Ticket #501
        s = np.array([1, np.nan], dtype=np.float64)
        with np.errstate(all='raise'):
            np.array_str(s)  # Should succeed 
Example 16
Project: wordvectors   Author: Kyubyong   File: make_wordvectors.py    License: MIT License 5 votes vote down vote up
def make_wordvectors():
    global lcode
    import gensim # In case you have difficulties installing gensim, you need to consider installing conda.
    import cPickle as pickle
     
    print "Making sentences as list..."
    sents = []
    with codecs.open('data/{}.txt'.format(lcode), 'r', 'utf-8') as fin:
        while 1:
            line = fin.readline()
            if not line: break
             
            words = line.split()
            sents.append(words)

    print "Making word vectors..."   
    min_count = get_min_count(sents)
    model = gensim.models.Word2Vec(sents, size=vector_size, min_count=min_count,
                                   negative=num_negative, 
                                   window=window_size)
    
    model.save('data/{}.bin'.format(lcode))
    
    # Save to file
    with codecs.open('data/{}.tsv'.format(lcode), 'w', 'utf-8') as fout:
        for i, word in enumerate(model.index2word):
            fout.write(u"{}\t{}\t{}\n".format(str(i), word.encode('utf8').decode('utf8'),
                                              np.array_str(model[word])
                                              )) 
Example 17
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_regression.py    License: MIT License 5 votes vote down vote up
def test_array_str_64bit(self, level=rlevel):
        # Ticket #501
        s = np.array([1, np.nan], dtype=np.float64)
        with np.errstate(all='raise'):
            np.array_str(s)  # Should succeed 
Example 18
Project: ocelot   Author: ocelot-collab   File: response_matrix.py    License: GNU General Public License v3.0 5 votes vote down vote up
def show(self, list_cor=None, list_bpm=None):
        print (" "*10,)
        for bpm in self.bpm_names:
            print (bpm,)
        print()
        for i in range(np.shape(self.matrix)[1]):
            print (self.cor_names[i] + " "*(10 - len(self.cor_names[i])),)
            #print np.array_str(self.matrix[:, i], precision=2, suppress_small=True)
            for j in range(np.shape(self.matrix)[0]):
                print ("%.2f" % self.matrix[j, i],)
            print() 
Example 19
Project: ocelot   Author: ocelot-collab   File: response_matrix.py    License: GNU General Public License v3.0 5 votes vote down vote up
def show(self, list_cor=None, list_bpm=None):
        print (" "*10,)
        for bpm in self.bpm_names:
            print (bpm,)
        print()
        for i in range(np.shape(self.matrix)[1]):
            print (self.cor_names[i] + " "*(10 - len(self.cor_names[i])),)
            #print np.array_str(self.matrix[:, i], precision=2, suppress_small=True)
            for j in range(np.shape(self.matrix)[0]):
                print ("%.2f" % self.matrix[j, i],)
            print() 
Example 20
Project: vnpy_crypto   Author: birforce   File: test_regression.py    License: MIT License 5 votes vote down vote up
def test_array_str_64bit(self):
        # Ticket #501
        s = np.array([1, np.nan], dtype=np.float64)
        with np.errstate(all='raise'):
            np.array_str(s)  # Should succeed 
Example 21
Project: vnpy_crypto   Author: birforce   File: contingency_tables.py    License: MIT License 5 votes vote down vote up
def __str__(self):
        s = "A %dx%d contingency table with counts:\n" % tuple(self.table.shape)
        s += np.array_str(self.table)
        return s 
Example 22
Project: Computable   Author: ktraunmueller   File: test_regression.py    License: MIT License 5 votes vote down vote up
def test_array_str_64bit(self, level=rlevel):
        """Ticket #501"""
        s = np.array([1, np.nan], dtype=np.float64)
        with np.errstate(all='raise'):
            sstr = np.array_str(s) 
Example 23
Project: Mastering-Elasticsearch-7.0   Author: PacktPublishing   File: arrayprint.py    License: MIT License 5 votes vote down vote up
def array_str(a, max_line_width=None, precision=None, suppress_small=None):
    """
    Return a string representation of the data in an array.

    The data in the array is returned as a single string.  This function is
    similar to `array_repr`, the difference being that `array_repr` also
    returns information on the kind of array and its data type.

    Parameters
    ----------
    a : ndarray
        Input array.
    max_line_width : int, optional
        Inserts newlines if text is longer than `max_line_width`.  The
        default is, indirectly, 75.
    precision : int, optional
        Floating point precision.  Default is the current printing precision
        (usually 8), which can be altered using `set_printoptions`.
    suppress_small : bool, optional
        Represent numbers "very close" to zero as zero; default is False.
        Very close is defined by precision: if the precision is 8, e.g.,
        numbers smaller (in absolute value) than 5e-9 are represented as
        zero.

    See Also
    --------
    array2string, array_repr, set_printoptions

    Examples
    --------
    >>> np.array_str(np.arange(3))
    '[0 1 2]'

    """
    return _array_str_implementation(
        a, max_line_width, precision, suppress_small)


# needed if __array_function__ is disabled 
Example 24
Project: Mastering-Elasticsearch-7.0   Author: PacktPublishing   File: test_regression.py    License: MIT License 5 votes vote down vote up
def test_array_str_64bit(self):
        # Ticket #501
        s = np.array([1, np.nan], dtype=np.float64)
        with np.errstate(all='raise'):
            np.array_str(s)  # Should succeed 
Example 25
Project: ibeis   Author: Erotemic   File: multi_index.py    License: Apache License 2.0 5 votes vote down vote up
def get_nn_aids(mxer, qfx2_imx):
        r"""
        Args:
            qfx2_imx (ndarray):

        Returns:
            ndarray: qfx2_aid

        CommandLine:
            python -m ibeis.algo.hots.multi_index --test-get_nn_aids

        Example:
            >>> # SLOW_DOCTEST
            >>> from ibeis.algo.hots.multi_index import *  # NOQA
            >>> import numpy as np
            >>> mxer, qreq_, ibs = testdata_mindexer()
            >>> K = 3
            >>> qaid = 1
            >>> qfx2_vec = ibs.get_annot_vecs(qaid, config2_=qreq_.get_internal_query_config2())
            >>> (qfx2_imx, qfx2_dist) = mxer.knn(qfx2_vec, K)
            >>> qfx2_aid = mxer.get_nn_aids(qfx2_imx)
            >>> gt_aids = ibs.get_annot_groundtruth(qaid)
            >>> result = np.array_str(qfx2_aid[0:2])
            >>> # Make sure there are lots (like 5%) of correct matches
            >>> mask_cover = vt.get_covered_mask(qfx2_aid, gt_aids)
            >>> num_correct   = mask_cover.sum()
            >>> num_incorrect = (~mask_cover).sum()
            >>> print('fraction correct = %r' % (num_correct / float(num_incorrect),))
            >>> ut.assert_inbounds(num_correct, 900, 1100,
            ...                    'not enough matches to groundtruth')
        """
        #qfx2_aid = -np.ones(qfx2_imx.shape, dtype=np.int32)
        qfx2_aid = np.empty(qfx2_imx.shape, dtype=np.int32)
        for nnindexer, idxs, mask in mxer.iter_subindexers(qfx2_imx):
            qfx2_aid[mask] = nnindexer.get_nn_aids(idxs)
        return qfx2_aid 
Example 26
Project: ibeis   Author: Erotemic   File: multi_index.py    License: Apache License 2.0 5 votes vote down vote up
def get_nn_featxs(mxer, qfx2_imx):
        r"""
        Args:
            qfx2_imx (ndarray):

        Returns:
            ndarray: qfx2_fx

        CommandLine:
            python -m ibeis.algo.hots.multi_index --test-get_nn_featxs

        Example:
            >>> # SLOW_DOCTEST
            >>> from ibeis.algo.hots.multi_index import *  # NOQA
            >>> import numpy as np
            >>> mxer, qreq_, ibs = testdata_mindexer()
            >>> K = 3
            >>> qfx2_vec = ibs.get_annot_vecs(1, config2_=qreq_.get_internal_query_config2())
            >>> (qfx2_imx, qfx2_dist) = mxer.knn(qfx2_vec, K)
            >>> qfx2_fgw = mxer.get_nn_featxs(qfx2_imx)
            >>> result = np.array_str(qfx2_fgw)
            >>> print(result)
        """
        #qfx2_fx = -np.ones(qfx2_imx.shape, dtype=np.int32)
        qfx2_fx = np.empty(qfx2_imx.shape, dtype=np.int32)
        for nnindexer, idxs, mask in mxer.iter_subindexers(qfx2_imx):
            qfx2_fx[mask] = nnindexer.get_nn_featxs(idxs)
        return qfx2_fx 
Example 27
Project: ibeis   Author: Erotemic   File: multi_index.py    License: Apache License 2.0 5 votes vote down vote up
def get_nn_fgws(mxer, qfx2_imx):
        r"""
        Args:
            qfx2_imx (ndarray):

        Returns:
            ndarray: qfx2_fgw

        CommandLine:
            python -m ibeis.algo.hots.multi_index --test-get_nn_fgws

        Example:
            >>> # SLOW_DOCTEST
            >>> from ibeis.algo.hots.multi_index import *  # NOQA
            >>> import numpy as np
            >>> mxer, qreq_, ibs = testdata_mindexer()
            >>> K = 3
            >>> qfx2_vec = ibs.get_annot_vecs(1, config2_=qreq_.get_internal_query_config2())
            >>> (qfx2_imx, qfx2_dist) = mxer.knn(qfx2_vec, K)
            >>> qfx2_fgw = mxer.get_nn_fgws(qfx2_imx)
            >>> result = np.array_str(qfx2_fgw)
            >>> print(result)
        """
        #qfx2_fgw = -np.ones(qfx2_imx.shape, dtype=np.float32)
        qfx2_fgw = np.empty(qfx2_imx.shape, dtype=hstypes.FS_DTYPE)
        for nnindexer, idxs, mask in mxer.iter_subindexers(qfx2_imx):
            qfx2_fgw[mask] = nnindexer.get_nn_fgws(idxs)
        return qfx2_fgw 
Example 28
Project: pyMHT   Author: erikliland   File: classDefinitions.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __str__(self):
        mmsiString = 'MMSI: ' + str(self.mmsi) if self.mmsi is not None else ""
        stateString = np.array_str(self.state, precision=1)
        covarianceString = 'Covariance diagonal: ' + np.array_str(np.diagonal(self.covariance),
                                                                  precision=1, suppress_small=True)
        return (stateString + " " + covarianceString + " " + mmsiString) 
Example 29
Project: pyMHT   Author: erikliland   File: tracker.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __analyzeTrackTermination(self):
        deadTracks = []
        for trackIndex, trackNode in enumerate(self.__trackNodes__):
            # Check outside radarRange
            if trackNode.isOutsideRange(self.position, self.radarRange):
                trackNode.status = outofrangeTag
                deadTracks.append(trackIndex)
                log.info("Terminating track {0:} at {1:} since it is out of radarRange".format(
                    trackIndex, np.array_str(self.__trackNodes__[trackIndex].x_0[0:2])))

            # Check if track is to insecure
            elif trackNode.getScore() / (self.N + 1) > self.scoreUpperLimit:
                trackNode.status = toolowscoreTag
                deadTracks.append(trackIndex)
                log.info("Terminating track {0:} at {1:} since its score is above the threshold ({2:.1f}>{3:.1f})".format(
                    trackIndex, np.array_str(self.__trackNodes__[trackIndex].x_0[0:2]),
                    trackNode.getScore() / (self.N + 1), self.scoreUpperLimit))
            elif trackNode.cumulativeNLLR > self.clnnrUpperLimit:
                trackNode.status = toolowscoreTag
                deadTracks.append(trackIndex)
                log.info(
                    "Terminating track {0:} at {1:} since its CNNLR is above the threshold ({2:.1f}>{3:.1f})".format(
                        trackIndex, np.array_str(
                            self.__trackNodes__[trackIndex].x_0[0:2]),
                        trackNode.cumulativeNLLR, self.clnnrUpperLimit))
        return deadTracks 
Example 30
Project: MDT   Author: robbert-harms   File: protocols.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def __str__(self):
        s = 'Column names: ' + ', '.join(self.column_names) + "\n"
        s += 'Data: ' + "\n"
        s += np.array_str(self.get_all_columns())
        return s