<commit_before>import fpformat

import numpy as N
import pylab
from neuroimaging import traits

from neuroimaging.ui.visualization.cmap import cmap, interpolation, getcmap

class Montage(traits.HasTraits):
    
    slices = traits.Dict()

    ncol = traits.Int()
    nrow = traits.Int()

    interpolation = interpolation
    origin = traits.Trait('lower', 'upper')

    ybuf = traits.Float(0.05)
    xlbuf = traits.Float(0.01)
    xrbuf = traits.Float(0.09)
    AR = traits.Float(1.0)
    width = traits.Float(8)
    ndecimal = traits.Int(1)

    # for colorbar

    vmin = traits.Float()
    vmax = traits.Float()
    colormap = cmap

    def __init__(self, **keywords):

        traits.HasTraits.__init__(self, **keywords)
        if self.slices is None:
            raise ValueError, 'need slices for a Montage'

        if self.ncol == 0:
            self.ncol = N.array([key[1] for key in self.slices.keys()]).max() + 1

        if self.nrow == 0:
            self.nrow = N.array([key[0] for key in self.slices.keys()]).max() + 1

        print self.slices.values()
        self.shape = self.slices.values()[0].grid.shape
        test = []
        for _slice in self.slices.values():
            if _slice:
                test.append((_slice.grid.shape != self.shape))
        if N.sum(test) > 0:
            raise ValueError, 'all slices have to have the same shape in Montage'

        AR = self.AR * self.nrow / self.ncol
        self.figure = pylab.figure(figsize=(self.width,
                                            AR*self.width))

    def draw(self, redraw=False):
        pylab.figure(num=self.figure.number)

        data = {}<commit_msg>remove unneeded print statement<commit_after>import fpformat

import numpy as N
import pylab
from neuroimaging import traits

from neuroimaging.ui.visualization.cmap import cmap, interpolation, getcmap

class Montage(traits.HasTraits):
    
    slices = traits.Dict()

    ncol = traits.Int()
    nrow = traits.Int()

    interpolation = interpolation
    origin = traits.Trait('lower', 'upper')

    ybuf = traits.Float(0.05)
    xlbuf = traits.Float(0.01)
    xrbuf = traits.Float(0.09)
    AR = traits.Float(1.0)
    width = traits.Float(8)
    ndecimal = traits.Int(1)

    # for colorbar

    vmin = traits.Float()
    vmax = traits.Float()
    colormap = cmap

    def __init__(self, **keywords):

        traits.HasTraits.__init__(self, **keywords)
        if self.slices is None:
            raise ValueError, 'need slices for a Montage'

        if self.ncol == 0:
            self.ncol = N.array([key[1] for key in self.slices.keys()]).max() + 1

        if self.nrow == 0:
            self.nrow = N.array([key[0] for key in self.slices.keys()]).max() + 1

        self.shape = self.slices.values()[0].grid.shape
        test = []
        for _slice in self.slices.values():
            if _slice:
                test.append((_slice.grid.shape != self.shape))
        if N.sum(test) > 0:
            raise ValueError, 'all slices have to have the same shape in Montage'

        AR = self.AR * self.nrow / self.ncol
        self.figure = pylab.figure(figsize=(self.width,
                                            AR*self.width))

    def draw(self, redraw=False):
        pylab.figure(num=self.figure.number)

        data = {}
{'fraction_non_alphanumeric': 0.12306759624128524, 'fraction_numerical': 0.012731130645650197, 'mean_word_length': 2.130929791271347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6805694', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1051, 'n_words': 255}