This file is indexed.

/usr/share/pyshared/PyMca/OpusDPTMap.py is in pymca 4.5.0-4.

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
import DataObject
import numpy
import specfilewrapper as specfile

DEBUG = 0
SOURCE_TYPE="SpecFileStack"

class OpusDPTMap(DataObject.DataObject):
    def __init__(self, filename):
        DataObject.DataObject.__init__(self)
        sf = specfile.Specfile(filename)
        scan = sf[1]
        data = scan.data()
        nMca, nchannels = data.shape
        nMca = nMca - 1
        xValues = data[0,:] * 1
        xValues.shape = -1
        if 0:
            self.data = numpy.zeros((nMca, nchannels),numpy.float32)
            self.data[:,:] = data[1:,:]
            self.data.shape = 1, nMca, nchannels
        else:
            self.data = data[1:,:]
            self.data.shape = 1, nMca, nchannels
        data = None
        
        #perform a least squares adjustment to a line
        x = numpy.arange(nchannels).astype(numpy.float32)
        Sxy = numpy.dot(x, xValues.T)
        Sxx = numpy.dot(x, x.T)
        Sx  = x.sum()
        Sy  = xValues.sum()
        d = nchannels * Sxx - Sx * Sx
        zero = (Sxx * Sy - Sx * Sxy)/d
        gain = (nchannels * Sxy - Sx * Sy)/d

        #and fill the requested information to be identified as a stack
        self.info['SourceName'] = [filename]
        self.info["SourceType"] = "SpecFileStack"
        self.info["Size"]       = 1, nMca, nchannels
        self.info["NumberOfFiles"] = 1
        self.info["FileIndex"] = 0
        self.info["McaCalib"] = [zero, gain, 0.0]
        self.info["Channel0"] = 0.0
        
if __name__ == "__main__":
    import sys
    filename = None
    if len(sys.argv) > 1:
        filename = sys.argv[1]
    if filename is not None:
        DEBUG = 1
        w = OpusDPTMap(filename)
    else:
        print("Please supply input filename")