[SciPy-Dev] SciPy Dev Wiki bug Trac broken - how to report bug?

Pundurs Mark (Nokia-LC/Chicago) mark.pundurs at nokia.com
Mon Apr 30 11:51:54 EDT 2012


http://projects.scipy.org/scipy/newticket returns an error - with only the unhelpful suggestion to open a ticket:

**************
Oops...
Trac detected an internal error:
OperationalError: database is locked
There was an internal error in Trac. It is recommended that you inform your local Trac administrator and give him all the information he needs to reproduce the issue.

To that end, you could Create a ticket.

The action that triggered the error was:
POST: /newticket
**************

Is there any other means to register the following bug report?

scipy.cluster.hierarchy.ClusterNode.pre_order returns IndexError for non-root node

0.9.0

To reproduce the error, run the following script:

import random, numpy
from scipy.cluster.hierarchy import linkage, to_tree

datalist = []
for i in range(8000):
    datalist.append(random.random())
datalist = numpy.array(datalist)
datalist = numpy.reshape(datalist, (datalist.shape[0], 1))
Z = linkage(datalist)
root_node_ref = to_tree(Z)
left_root_node_ref = root_node_ref.left
left_root_node_ref.pre_order()

The result is:

Traceback (most recent call last):
  File "C:\ReproduceError-pre_order.py", line 12, in <module>
    left_root_node_ref.pre_order()
  File "C:\Python27\lib\site-packages\scipy\cluster\hierarchy.py", line 732, in pre_order
    if not lvisited[ndid]:
IndexError: index out of bounds

One possible solution (successfully tested with preceding script) is to change pre_order in hierarchy.py as follows:

        n = self.count

        curNode = [None] * (2 * n)
        #following two lines changed: dictionaries instead of lists
        lvisited = {}
        rvisited = {}
        curNode[0] = self
        k = 0
        preorder = []
        while k >= 0:
            nd = curNode[k]
            ndid = nd.id
            if nd.is_leaf():
                preorder.append(func(nd))
                k = k - 1
            else:
                #following line changed: check existence of dictionary key rather than value of list item
                if ndid not in lvisited.keys():
                    curNode[k + 1] = nd.left
                    lvisited[ndid] = True
                    k = k + 1
                #following line changed: check existence of dictionary key rather than value of list item
                elif ndid not in rvisited.keys():
                    curNode[k + 1] = nd.right
                    rvisited[ndid] = True
                    k = k + 1
                else:
                    k = k - 1

        return preorder

Mark Pundurs
Data Analyst - Traffic
Location & Commerce
Chicago



The information contained in this communication may be CONFIDENTIAL and is intended only for the use of the recipient(s) named above.  If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited.  If you have received this communication in error, please notify the sender and delete/destroy the original message and any copy of it from your computer or paper files.



More information about the SciPy-Dev mailing list