This file is indexed.

/usr/share/pyshared/guiqwt/tests/image.py is in python-guiqwt 2.3.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)

"""ImageDialog test"""

#FIXME: unexpected behavior when changing the xmin/xmax/ymin/ymax values in 
#       the image parameters (2nd tab: "Axes")

from __future__ import print_function

SHOW = True # Show test in GUI-based test launcher

import numpy as np

from guiqwt.plot import ImageDialog
from guiqwt.builder import make

def imshow( data ):
    win = ImageDialog(edit=False, toolbar=True, wintitle="ImageDialog test",
                      options=dict(xlabel='Concentration', xunit='ppm'))
    item = make.image(data)
    plot = win.get_plot()
    plot.add_item(item)
    win.show()
    win.exec_()

def compute_image(N=2000, grid=True):
    T = np.float32
    x = np.array(np.linspace(-5, 5, N), T)
    img = np.zeros( (N, N), T )
    x.shape = (1, N)
    img += x**2
    x.shape = (N, 1)
    img += x**2
    np.cos(img, img) # inplace cosine
    if not grid:
        return img
    x.shape = (N,)
    for k in range( -5, 5 ):
        i = x.searchsorted(k)
        if k < 0 :
            v = -1.1
        else:
            v = 1.1
        img[i,:] = v
        img[:, i] = v
    m1, m2, m3, m4 = -1.1, -0.3, 0.3, 1.1
    K = 100
    img[:K, :K] = m1     # (0,0)
    img[:K, -K:] = m2    # (0,N)
    img[-K:, -K:] = m3   # (N,N)
    img[-K:, :K] = m4    # (N,0)
    #img = array( 30000*(img+1.1), uint16 )
    print(img.dtype)
    return img


def compute_image_2():
    N = 1000
    T = np.uint16
    TMAX = 32000
    TMIN = 32000
    S=5.
    x = np.array(np.linspace(-5*S, 5*S, N), float)
    img = np.zeros( (N, N), T )
    x.shape = (1, N)
    img += x**2
    x.shape = (N, 1)
    img += x**2
    img = TMAX*np.cos(img/S)+TMIN
    x.shape = (N,)
#    dx = dy = x[1]-x[0]    
    for k in range( -5, 5 ):
        i = x.searchsorted(k)
        if k < 0 :
            v = -1.1
        else:
            v = 1.1
        img[i,:] = v
        img[:, i] = v
    m1, m2, m3, m4 = -1.1, -0.3, 0.3, 1.1
    K = 100
    img[:K, :K] = TMAX*m1+TMIN     # (0,0)
    img[:K, -K:] = TMAX*m2+TMIN    # (0,N)
    img[-K:, -K:] = TMAX*m3+TMIN   # (N,N)
    img[-K:, :K] = TMAX*m4+TMIN    # (N,0)
    #img = array( 30000*(img+1.1), uint16 )
    return img

def compute_image_3():
    """Produces horizontal and vertical ramps"""
    N = 1000
    NK = 20
    T = float
    img = np.zeros( (N, N), T )
    x = np.arange(N, dtype=float)
    x.shape = (1, N)
    DK = N/NK
    for i in range(NK):
        S = i+1
        y = S*(x//S)
        img[DK*i:DK*(i+1),:] = y
    return img

def test():
    """Test"""
    # -- Create QApplication
    import guidata
    _app = guidata.qapplication()
    # --    
    imshow(compute_image())

if __name__ == "__main__":
    test()