This file is indexed.

/usr/share/doc/pyxplot/html/sect0025.html is in pyxplot-doc 0.8.4-3.

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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: Time Intervals</title>

<link href="ch-numerics.html" title="Working with Data" rel="next" />
<link href="sec-time_series.html" title="Working with Time-Series Data" rel="prev" />
<link href="sec-time_series.html" title="Working with Time-Series Data" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>

<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-time_series.html" title="Working with Time-Series Data"><img alt="Previous: Working with Time-Series Data" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="sec-time_series.html" title="Working with Time-Series Data"><img alt="Up: Working with Time-Series Data" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="ch-numerics.html" title="Working with Data"><img alt="Next: Working with Data" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0001.html">Introduction to PyXPlot</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0019.html">Performing Calculations</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sec-time_series.html">Working with Time-Series Data</a> <b>:</b>
</span>

</span><span>

<span>
<b class="current">Time Intervals</b>
</span>
</span>
<hr />
</div>

<div><h2 id="a0000000026">4.11.1 Time Intervals</h2>
<p>Two functions are provided for measuring the time intervals elapsed between pairs of Julian Day numbers. These are useful when an experiment is started at some time <img src="images/img-0019.png" alt="$x$" style="vertical-align:0px; 
                                     width:10px; 
                                     height:8px" class="math gen" />, and datapoints are to be labelled with the times elapsed since the beginning of the experiment. The <tt class="tt">time_diff()</tt> function<a name="a0000000496" id="a0000000496"></a> returns the time interval, with physical dimensions of time, between two Julian Day numbers. This function is actually very simple, and is entirely equivalent to the algebraic expression <tt class="tt">(y-x)*unit(day)</tt>. The following example, demonstrates its use to calculate the time elapsed between the traditional date for the foundation of Rome by Romulus and Remus in 753 <small class="footnotesize">BC</small> and that of the deposition of the last Emperor of the Western Empire in <small class="footnotesize">AD</small> 476: </p><p> <tt class="tt">pyxplot&gt; <b class="bf">x = time_julianday(-752,4,21,12,0,0)</b></tt><br /><tt class="tt">pyxplot&gt; <b class="bf">y = time_julianday( 476,9, 4,12,0,0)</b></tt><br /><tt class="tt">pyxplot&gt; <b class="bf">print time_diff(x,y)</b></tt><br /><tt class="tt">3.8764483e+10 s</tt><br /><tt class="tt">pyxplot&gt; <b class="bf">print time_diff(x,y)/unit(year)</b></tt><br /><tt class="tt">1228.3723</tt>  </p><p>The function <tt class="tt">time_diff_string()</tt><a name="a0000000497" id="a0000000497"></a> is similar, but returns a textual representation of the time interval, and is useful for producing textual axis labels representing the time elapsed since the beginning of an experiment. As with the <tt class="tt">time_string()</tt> function, it takes an optional third parameter which specifies the textual format in which the time interval should be represented. If no format is supplied, then the following verbose format is used:<br /><tt class="tt">"%Y years %d days %h hours %m minutes and %s seconds"</tt><br />Table <a href="sect0025.html#ex:timeseries">4.4</a> lists the tokens which are substituted for various parts of the time interval. The following examples demonstrate the use of the function: </p><div id="ex:timeseries" class="table"><center> <table cellspacing="0" class="tabular">
<tr>

    
    <td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> Token </p></td>

    
    <td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-right:1px solid black"><p> Substitution value </p></td>

</tr><tr>

    
    <td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p><tt class="tt">%%</tt> </p></td>

    
    <td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-right:1px solid black"><p> A literal % sign.</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">%d</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> The number of days elapsed, modulo 365.</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">%D</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> The number of days elapsed. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">%h</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> The number of hours elapsed, modulo 24.</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">%H</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> The number of hours elapsed.</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">%m</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> The number of minutes elapsed, modulo 60.</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">%M</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> The number of minutes elapsed.</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">%s</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> The number of seconds elapsed, modulo 60.</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">%S</tt> </p></td>

    
    <td style="text-align:left; border-right:1px solid black"><p> The number of seconds elapsed.</p></td>

</tr><tr>

    
    <td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"><p><tt class="tt">%Y</tt> </p></td>

    
    <td style="border-bottom-color:black; border-bottom-width:1px; text-align:left; border-bottom-style:solid; border-right:1px solid black"><p> The number of years elapsed.</p></td>

</tr>
</table> </center><div class="caption"><b>Table 4.4</b>: <span>Tokens which are substituted for various components of the time interval by the <tt class="tt">time_diff_string</tt> function.</span></div></div><p> <tt class="tt">pyxplot&gt; <b class="bf">x = time_julianday(-752,4,21,12,0,0)</b></tt><br /><tt class="tt">pyxplot&gt; <b class="bf">y = time_julianday( 476,9, 4,12,0,0)</b></tt><br /><tt class="tt">pyxplot&gt; <b class="bf">print time_diff_string(x,y)</b></tt><br /><tt class="tt">1229 years 78 days 0 hours 0 minutes and 0 seconds</tt><br /><tt class="tt">pyxplot&gt; <b class="bf">print time_diff_string(x,y,"$%Y<img src="images/img-0024.png" alt="\^{}" style="vertical-align:9px; width:5px; height:4px" class="accent gen" /><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />mathrm{y}%d<img src="images/img-0024.png" alt="\^{}" style="vertical-align:9px; width:5px; height:4px" class="accent gen" /><img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" />mathrm{d}$")</b></tt><br /><tt class="tt"><img src="images/img-0159.png" alt="$1229^\mathrm {y}78^\mathrm {d}$" style="vertical-align:0px; 
                                     width:69px; 
                                     height:17px" class="math gen" /></tt>  </p><p> <span class="upshape"><span class="mdseries"><span class="rm">A plot of the rate of downloads from an Apache webserver.</span></span></span></p><div>

<table cellspacing="0" class="tabular">
<tr>

    
    <td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> In this example, we use PyXPlot’s facilities for handling dates and times to produce a plot of the rate of downloads from an Apache webserver based upon the download log which it stores in the file <tt class="tt">/var/log/apache2/access.log</tt>. This file contain a line of the following form for each page or file requested from the webserver: <br /><tt class="tt"><small class="footnotesize">127.0.0.1 - - [14/Apr/2010:16:05:36 +0100] "GET / HTTP/1.1" 200 2623 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.1.9) Gecko/20100402 Ubuntu/9.10 (karmic) Firefox/3.5.9"</small></tt><br />However, PyXPlot’s default input filter for <tt class="tt">.log</tt> files (see Section <a href="sec-filters.html">5.1</a>) manipulates the dates in strings such as these into the form <br /><tt class="tt"><small class="footnotesize">127.0.0.1 - -  [ 14  4  2010 16 05 36 +0100 ]  "GET   HTTP 1.1" 200 2623 "-" "Mozilla 5.0 (X11; U; Linux x86_64; en-GB; rv 1.9.1.9) Gecko 20100402 Ubuntu 9.10 (karmic) Firefox 3.5.9"</small></tt><br />such that the day, month, year, hour, minute and second components of the date are contained in the 5th to 10th white-space-separated columns respectively. In the script below, the <tt class="tt">time_­julianday()</tt> is then used to convert these components into Julian Days, and the <tt class="tt">histogram</tt> command<a name="a0000000498" id="a0000000498"></a> (see Section <a href="sec-histogram.html">5.9</a>) is used to sort each of the web accesses recorded in the Apache log file into hour-sized bins. Because this may be a time-consuming process for large log files on busy servers, we use the <tt class="tt">tabulate</tt> command<a name="a0000000499" id="a0000000499"></a> (see Section <a href="sec-tabulate.html">5.5</a>) to store the data into a temporary datafile on disk before deciding how to plot it: </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">set output ’apache.dat’</tt><br /><tt class="tt">histogram f() ’/var/log/apache2/access.log’ <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" /></tt><br /><tt class="tt"> using time_julianday($7,$6,$5,$8,$9,$10) binwidth 1/24</tt><br /><tt class="tt">tabulate f(x) with format "%16f %16f"</tt> </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p>Having stored our histogram in the file <tt class="tt">apache.dat</tt>, we now plot the resulting histogram, labelling the horizontal axis with the days of the week. The commands used to achieve this will be introduced in Chapter <a href="ch-plotting.html">1</a>. Note that the major axis ticks along the horizontal axis are placed not at integer Julian Days, which fall at midday on each day, but at —<img src="images/img-0160.png" alt="$.5$" style="vertical-align:0px; 
                                     width:12px; 
                                     height:13px" class="math gen" />, which falls at midnight on each day. Minor axis ticks are placed along the axis every quarter day, i.e. every six hours. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">set xlabel ’Day’</tt><br /><tt class="tt">set ylabel ’Rate of downloads per day’</tt><br /><tt class="tt">set xtics 0.5, 1</tt><br /><tt class="tt">set mxtics 0.5, 0.25</tt><br /><tt class="tt">set xformat "%s"%(time_dayweekname(x,0)) rotate unit(30*deg)</tt><br /><tt class="tt">plot "apache.dat" notitle with lines</tt> </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p>The plot below shows the graph which results on a moderately busy webserver which hosts, among many other sites, the PyXPlot website: </p></td>

</tr><tr>

    
    <td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"><p><center>
<img src="images/img-0162.png" alt="\includegraphics[width=\textwidth ]{examples/eps/ex_apachelog}" style="width:" /></center>  </p></td>

</tr>
</table>
</div></div>





<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-time_series.html" title="Working with Time-Series Data"><img alt="Previous: Working with Time-Series Data" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="sec-time_series.html" title="Working with Time-Series Data"><img alt="Up: Working with Time-Series Data" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="ch-numerics.html" title="Working with Data"><img alt="Next: Working with Data" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>

</body>
</html>