<commit_before>import neuroimaging as ni
import numpy as N
import pylab

def mask_and_func(subject=0, run=1, offset=5):
    M = ni.image.Image('http://kff.stanford.edu/FIAC/fiac%d/fonc%d/fsl/mask.img' % (subject,run))    
    m = N.zeros(M.grid.shape)
    middle = [slice(i/2-offset, i/2+offset, 1) for i in m.shape]
    m[middle] = 1
    other = [slice(i/2-offset+1, i/2+offset+1, 1) for i in m.shape]
    m[other] = 2
    mm = ni.image.Image(m, grid=M.grid)
    f = ni.fmri.fMRIImage('http://kff.stanford.edu/FIAC/fiac%d/fonc%d/fsl/filtered_func_data.img' % (subject, run))
    return mm, f

m, f = mask_and_func()
f.grid.itertype = 'parcel'
f.grid.labels = m.readall()
f.grid.labelset = [1, 2]

means = {}
for d in f:
    means[f.label] = N.mean(d, axis=1)
<commit_msg>made two regions of different sizes<commit_after>import neuroimaging as ni
import numpy as N
import pylab

def mask_and_func(subject=0, run=1, offset=5):
    M = ni.image.Image('http://kff.stanford.edu/FIAC/fiac%d/fonc%d/fsl/mask.img' % (subject,run))    
    m = N.zeros(M.grid.shape)
    middle = [slice(i/2-offset, i/2+offset, 1) for i in m.shape]
    m[middle] = 1
    other = [slice(i/2-2*offset, i/2-offset, 1) for i in m.shape]
    m[other] = 2
    mm = ni.image.Image(m, grid=M.grid)
    f = ni.fmri.fMRIImage('http://kff.stanford.edu/FIAC/fiac%d/fonc%d/fsl/filtered_func_data.img' % (subject, run))
    return mm, f

m, f = mask_and_func()
f.grid.itertype = 'parcel'
f.grid.labels = m.readall()
f.grid.labelset = [1, 2]

means = {}
for d in f:
    print d.shape
    means[f.label] = N.mean(d, axis=1)

{'fraction_non_alphanumeric': 0.17699115044247787, 'fraction_numerical': 0.019595448798988623, 'mean_word_length': 3.2783783783783784, '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': '221824', 'n_tokens_mistral': 708, 'n_tokens_neox': 685, 'n_words': 141}