File: bin2dcommand.htm

package info (click to toggle)
extrema 4.3.6-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 19,212 kB
  • ctags: 6,452
  • sloc: cpp: 86,428; sh: 8,229; makefile: 814
file content (124 lines) | stat: -rw-r--r-- 5,681 bytes parent folder | download | duplicates (3)
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
<HTML>
<HEAD>
<TITLE>BIN2D command</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

<P><font size="+3" color="green"><B>BIN2D command</B></font></P>

<TABLE border="1" cols="2" frame="box" rules="all" width="650">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%" valign="top"><CODE>
BIN2D x y xbin ybin mcounts nx ny { xmin xmax ymin ymax }<br />
BIN2D\MATRIX mdata mxin myin mout</CODE>
</TD></TR>
<TR>
<TD width="15%" valign="top"><B>Qualifiers</B>:</TD>
<TD width="85%" valign="top"><CODE>
\WEIGHTS, \EMPTY, \MATRIX, \XDISCARD, \YDISCARD</CODE>
</TD></TR>
<TR>
<TD width="15%" valign="top"><B>Defaults</B>:</TD>
<TD width="85%" valign="top"><CODE>
\-WEIGHTS, \-EMPTY, \-MATRIX, \-XDISCARD, \-YDISCARD, xmin = min(x), xmax = max(x) ymin = min(y),
ymax = max(y)</CODE>
</TD></TR>
</TABLE>
<P>
 The <CODE>BIN2D</CODE> command forms a matrix of bins of data by sorting the
 vectors <CODE>x</CODE> and <CODE>y</CODE> into
 grids of bins which are returned in vectors <CODE>xbin</CODE> and
 <CODE>ybin</CODE>. The accumulated matrix of total counts
 per bin is returned in matrix <CODE>mcounts</CODE>. If the numbers
 <CODE>xmin</CODE> and <CODE>xmax</CODE> are not
 entered, they default to the minimum and maximum of <CODE>x</CODE>.
 Similarly, if the numbers <CODE>ymin</CODE> and
 <CODE>ymax</CODE> are not entered, they default to the minimum and maximum
 of <CODE>y</CODE>.</p>
<p>
 <center><CODE>xbin<sub>i</sub> =
 xmin+(i-1/2)(xmax-xmin)/nx</CODE>&nbsp;&nbsp; for&nbsp;&nbsp; <code>i=1,2,...,nx</code></center></p>
<p>
 <center><CODE>ybin<sub>j</sub> =
 ymin+(j-1/2)(ymax-ymin)/ny</CODE>&nbsp;&nbsp; for&nbsp;&nbsp; <code>j=1,2,...,ny</code></center></p>
<p>
 The point <code>(x<sub>k</sub>,y<sub>k</sub>)</code> will be accumulated in
 <code>mcounts<sub>i,j</sub></code>,
 where</p>
<p>
 <table>
 <tr><td align="right">row:</td>
     <td><code>i = int((y<sub>k</sub>-ymin)/(ymax-ymin)*ny)+1</code></td></tr>
 <tr><td align="right">column:</td>
     <td><code>j = int((x<sub>k</sub>-xmin)/(xmax-xmin)*nx)+1</code></td></tr></table></p>
<p><font size="+1" color="green"><B>Dimensions</B></font></P>
<p>
 The lengths of <CODE>x</CODE> and <CODE>y</CODE>
 must be equal. If a weight vector, <CODE>w</CODE>, is supplied, it must also
 be the same length.</p>
<p>
 The vectors <CODE>xbin</CODE> and <CODE>ybin</CODE> and the matrix <CODE>mcounts</CODE> will be
 created. <CODE>xbin</CODE> will have <code>nx</CODE> elements, <CODE>ybin</CODE> will have
 <CODE>ny</CODE> elements, and matrix <CODE>mcounts</CODE> will have <CODE>nx</CODE> columns and
 <CODE>ny</CODE> rows.</p>
<p><font size="+1" color="green"><B>Extremes</B></font></P>
<p>
 By default, events below <CODE>xmin</CODE> are placed in the first bin
 column, events above <CODE>xmax</CODE> are placed in the last bin column,
 events below <CODE>ymin</CODE> are placed in the first bin row, and events
 above <CODE>ymax</CODE> are placed in the last bin row. If the
 <CODE>\XDISCARD</CODE> qualifier is used, events below <CODE>xmin</CODE> are discarded, and events above
 <CODE>xmax</CODE> are discarded. If the <CODE>\YDISCARD</CODE> qualifier is used, events below
 <CODE>ymin</CODE> are discarded, and events above <CODE>ymax</CODE> are discarded.</p>
<p><font size="+1" color="green"><B>Weights</B></font></P>

<TABLE border="1" cols="2" frame="box" rules="all" width="650">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%" valign="top"><CODE>
BIN2D\WEIGHTS w x y xbin ybin mcounts nx ny { xmin xmax ymin ymax }</CODE>
</TD></TR>
</TABLE>
<p>
 If a vector of weights is entered, you must indicate that it is there by using the
 <CODE>\WEIGHTS</CODE> qualifier. The weight <CODE>w</CODE> must be a vector. The
 <code>i</code><sup>th</sup> event causes the bin count to be incremented by <CODE>w<sub>i</sub></CODE>.</p>
<p><font size=+1 color="green"><B>Increment only if empty</B></font></P>

<TABLE border="1" cols="2" frame="box" rules="all" width="650">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%" valign="top"><CODE>
BIN2D\EMPTY w x y xbin ybin mcounts nx ny { xmin xmax ymin ymax }</CODE>
</TD></TR>
</TABLE>
<p>
 If the <CODE>\EMPTY</CODE> qualifier is used, an event is counted in a
 bin only if that bin is empty. Only the first event encountered for each bin will be counted in
 that bin. <CODE>\EMPTY</CODE> cannot be used with <CODE>\MATRIX</CODE>.</p>
<p><font size="+1" color="green"><B>Defined by box corners</B></font></P>

<TABLE border="1" cols="2" frame="box" rules="all" width="650">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%" valign="top"><CODE>
BIN2D\MATRIX mdata mx my mcounts</CODE>
</TD></TR>
</TABLE>
<p>
 The <CODE>BIN2D\MATRIX</CODE> command calculates the sum of the data
 points given by matrix <CODE>mdata</CODE> within a set of boxes. The
 <i>x</i>-coordinates of the boxes are given in matrix <CODE>mx</CODE>,
 the <i>y</i>-coordinates are given in matrix <CODE>my</CODE>. Matrices
 <CODE>mx</CODE> and <CODE>my</CODE> must be the
 same size. A data point is taken to be inside a box if it is interior or on an edge. Each data point
 is considered only once, so a data point is never taken to be in more than one of the boxes. The
 coordinates of the data points are the row and column indices, for example,
 <CODE>mdata[3,4]</CODE> is row 3 and column 4 so it is at
 <code>(<i>x</i>,<i>y</i>)</code> location <code>(4,3)</code>. The <i>x</i> and <i>y</i>-coordinates in
 <CODE>mx</CODE> and <CODE>my</CODE> should be in
 this index space of coordinates. The qualifiers <CODE>\EMPTY</CODE> and
 <CODE>\WEIGHTS</CODE> cannot be used with <CODE>\MATRIX</CODE>.</p>
</BODY>
</HTML>