<commit_before>import pySPM
import numpy as np
from pySPM_data import get_data
import matplotlib.pyplot as plt

def test_ITA_loading():
    TOF = pySPM.ITA(get_data("BigSmiley.ita"))
    assert len(TOF.get_masses()) == 27
    assert TOF.Nscan == 100

def test_SI_image():
    TOF = pySPM.ITA(get_data("BigSmiley.ita"))
    assert TOF.img.shape == (512, 512)
    assert TOF.img.shape[0] == TOF.size['pixels']['y']
    assert TOF.img.shape[1] == TOF.size['pixels']['x']

def test_getAddedChannel():
    TOF = pySPM.ITA(get_data("BigSmiley.ita"))
    img1 = TOF.getAddedImageByMass(197)
    assert type(img1) is pySPM.SPM_image
    img2, CH = TOF.getAddedImageByName('Au')
    assert type(img2) is pySPM.SPM_image
    assert len(CH) == 1
    assert CH[0]['assign'] == 'Au-'
    assert np.all(img1.pixels == img2.pixels)


<commit_msg>Fix test for python2.7<commit_after>import pySPM
import numpy as np
from pySPM_data import get_data
import matplotlib.pyplot as plt

def test_ITA_loading():
    TOF = pySPM.ITA(get_data("BigSmiley.ita"))
    assert len(TOF.get_masses()) == 27
    assert TOF.Nscan == 100

def test_SI_image():
    TOF = pySPM.ITA(get_data("BigSmiley.ita"))
    assert TOF.img.shape == (512, 512)
    assert TOF.img.shape[0] == TOF.size['pixels']['y']
    assert TOF.img.shape[1] == TOF.size['pixels']['x']

def test_getAddedChannel():
    TOF = pySPM.ITA(get_data("BigSmiley.ita"))
    img1 = TOF.getAddedImageByMass(197)
    img2, CH = TOF.getAddedImageByName('Au')
    assert len(CH) == 1
    assert CH[0]['assign'] == 'Au-'
    assert np.all(img1.pixels == img2.pixels)



{'fraction_non_alphanumeric': 0.1554436752674638, 'fraction_numerical': 0.030207677784770296, 'mean_word_length': 3.953271028037383, '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': '2438453', 'n_tokens_mistral': 663, 'n_tokens_neox': 615, 'n_words': 123}