<commit_before>#!/usr/bin/env python3
import collections
import logging
import numpy

from PyQt4 import QtGui

# Importing PyQtGraph raises a warning on OSX about buggy behavior when
# the QApplication has already been started.  It appears to only occur
# under OSX so I'm not going to worry about it.
import pyqtgraph 

from vitables.vtapp import translate

from . import _defaults

# Define a named tuple for the ``dbt_leaf`` data.
DBTLeaf = collections.namedtuple(
    "DBTLeaf", ("filename",)
)

class ImageWidget(pyqtgraph.ImageView):
    """
    The widget to hold the image.
    """

    def __init__(self, node, parent=None):
        logger = logging.getLogger(__name__ +".ImageWidget")
        if node.ndim == 2:
            data = node.read()
        elif node.ndim == 3:
            data = node.read().transpose((2,0,1))
        else:
            msg = translate(
                _defaults["PLUGIN_CLASS"],
                "Node must be 2D or 3D.",
                "Plugin error message"
            )
            raise RuntimeError(msg)

        super(ImageWidget, self).__init__(parent)
        data[numpy.isnan(data)] = 0
        self.setImage(data)
        self.show()

        self.dbt_leaf = DBTLeaf(filename = node._v_file.filename)

<commit_msg>Image View widget doesn't need dbt_leaf<commit_after>#!/usr/bin/env python3
import logging
import numpy

from PyQt4 import QtGui

# Importing PyQtGraph raises a warning on OSX about buggy behavior when
# the QApplication has already been started.  It appears to only occur
# under OSX so I'm not going to worry about it.
import pyqtgraph 

from vitables.vtapp import translate

from . import _defaults

class ImageWidget(pyqtgraph.ImageView):
    """
    The widget to hold the image.
    """

    def __init__(self, node, parent=None):
        logger = logging.getLogger(__name__ +".ImageWidget")
        if node.ndim == 2:
            data = node.read()
        elif node.ndim == 3:
            data = node.read().transpose((2,0,1))
        else:
            msg = translate(
                _defaults["PLUGIN_CLASS"],
                "Node must be 2D or 3D.",
                "Plugin error message"
            )
            raise RuntimeError(msg)

        super(ImageWidget, self).__init__(parent)
        data[numpy.isnan(data)] = 0
        self.setImage(data)
        self.show()


{'fraction_non_alphanumeric': 0.09523809523809523, 'fraction_numerical': 0.008503401360544218, 'mean_word_length': 2.328147100424328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1038866', 'n_tokens_mistral': 713, 'n_tokens_neox': 683, 'n_words': 216}