This file is indexed.

/usr/share/cain/state/HistogramFrames.py is in cain 1.10+dfsg-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
"""Records sets of histograms."""

import numpy

from Histogram import Histogram
from SimulationOutput import SimulationOutput, isSorted

class HistogramFrames(SimulationOutput):
    """A set of histograms."""
    
    def __init__(self, numberOfBins, multiplicity, recordedSpecies=[]):
        """Construct an empty data structure."""
        SimulationOutput.__init__(self, recordedSpecies, [])
        self.numberOfBins = numberOfBins
        self.multiplicity = multiplicity
        self.numberOfTrajectories = 0
        self.frameTimes = None
        self.histograms = None

    def setFrameTimes(self, frameTimes):
        self.frameTimes = numpy.array(frameTimes, numpy.float64)
        # If both the frame times and the recorded species have been defined
        # initialize the data structure.
        if self.recordedSpecies:
            self.initialize()

    def setRecordedSpecies(self, recordedSpecies):
        self.recordedSpecies = recordedSpecies
        # If both the frame times and the recorded species have been defined
        # initialize the data structure.
        if self.frameTimes is not None:
            self.initialize()

    def initialize(self):
        """Construct histograms for each frame and recorded species."""
        assert self.frameTimes is not None and self.recordedSpecies
        self.histograms = []
        for t in self.frameTimes:
            f = []
            for s in self.recordedSpecies:
                f.append(Histogram(self.numberOfBins, self.multiplicity))
            self.histograms.append(f)

    def setCurrentToMinimum(self):
        """Set the current histogram to the one with the minimum sum."""
        index = self.histograms[0][0].findMinimum()
        for frame in self.histograms:
            for histogram in frame:
                histogram.setCurrent(index)

    def empty(self):
        """Return true if there are no trajectories."""
        return self.numberOfTrajectories == 0

    def size(self):
        """Return the number of trajectories."""
        return self.numberOfTrajectories

    def hasErrors(self):
        """Return None if data structure is valid. Otherwise return an error
        message."""
        error = SimulationOutput.hasErrors(self)
        if error:
            return error
        if self.frameTimes is None or len(self.frameTimes) <= 0:
            return 'There are no frame times.'
        if not isSorted(self.frameTimes):
            return 'The frame times are not in order.'
        if not len(self.histograms) == len(self.frameTimes):
            return 'The list of frames is incomplete.'
        for x in self.histograms:
            if not len(x) == len(self.recordedSpecies):
                return 'The list of histograms is incomplete.'
        # CONTINUE: Check the histograms.
        return None

    def writeXml(self, writer, model, method):
        writer.beginElement('histogramFrames',
                            {'model':model, 'method':method,
                             'multiplicity':str(self.multiplicity),
                             'numberOfTrajectories':
                                 repr(self.numberOfTrajectories)})
        writer.beginElement('frameTimes')
        writer.writeData(' '.join([repr(x) for x in self.frameTimes]))
        writer.endElement() # frameTimes
        writer.beginElement('recordedSpecies')
        writer.writeData(' '.join([repr(x) for x in self.recordedSpecies]))
        writer.endElement() # recordedSpecies
        for frame in range(len(self.histograms)):
            for species in range(len(self.histograms[frame])):
                self.histograms[frame][species].writeXml(writer, frame, species)
        writer.endElement() # histogramFrames