gphys 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +7414 -0
- data/LICENSE.txt +1 -1
- data/Rakefile +0 -2
- data/doc/derivative/math-doc/document/images.log +385 -0
- data/doc/ep_flux/math-doc/document/images.log +1375 -0
- data/doc/ganalysis/doc/NumRu.html +203 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis.html +931 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/BetaPlane.html +574 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/Fitting.html +576 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/LogP.html +425 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/Met.html +2021 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/MetZ.html +524 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/Planet.html +1047 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG.html +794 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG/Uninitialized.html +215 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG_common.html +603 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG_sphere.html +760 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG_sphere_common.html +251 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG_sphere_div.html +424 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/SigmaCoord.html +321 -0
- data/doc/ganalysis/doc/NumRu/GGraph.html +334 -0
- data/doc/ganalysis/doc/NumRu/GPhys.html +579 -0
- data/doc/ganalysis/doc/Object.html +210 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/beta_plane_rb.html +60 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/covariance_rb.html +56 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/eof_rb.html +64 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/fitting_rb.html +54 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/histogram_rb.html +58 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/log_p_rb.html +60 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/met_rb.html +60 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/met_z_rb.html +58 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/planet_rb.html +58 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/qg_rb.html +64 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/sigma_coord_rb.html +56 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis_rb.html +98 -0
- data/doc/ganalysis/doc/created.rid +13 -0
- data/doc/ganalysis/doc/images/brick.png +0 -0
- data/doc/ganalysis/doc/images/brick_link.png +0 -0
- data/doc/ganalysis/doc/images/bug.png +0 -0
- data/doc/ganalysis/doc/images/bullet_black.png +0 -0
- data/doc/ganalysis/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/ganalysis/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/ganalysis/doc/images/date.png +0 -0
- data/doc/ganalysis/doc/images/find.png +0 -0
- data/doc/ganalysis/doc/images/loadingAnimation.gif +0 -0
- data/doc/ganalysis/doc/images/macFFBgHack.png +0 -0
- data/doc/ganalysis/doc/images/package.png +0 -0
- data/doc/ganalysis/doc/images/page_green.png +0 -0
- data/doc/ganalysis/doc/images/page_white_text.png +0 -0
- data/doc/ganalysis/doc/images/page_white_width.png +0 -0
- data/doc/ganalysis/doc/images/plugin.png +0 -0
- data/doc/ganalysis/doc/images/ruby.png +0 -0
- data/doc/ganalysis/doc/images/tag_green.png +0 -0
- data/doc/ganalysis/doc/images/wrench.png +0 -0
- data/doc/ganalysis/doc/images/wrench_orange.png +0 -0
- data/doc/ganalysis/doc/images/zoom.png +0 -0
- data/doc/ganalysis/doc/index.html +383 -0
- data/doc/ganalysis/doc/js/darkfish.js +118 -0
- data/doc/ganalysis/doc/js/jquery.js +32 -0
- data/doc/ganalysis/doc/js/quicksearch.js +114 -0
- data/doc/ganalysis/doc/js/thickbox-compressed.js +10 -0
- data/doc/ganalysis/doc/rdoc.css +763 -0
- data/ext/numru/gphys/ext_init.c +1 -0
- data/ext/numru/gphys/quad_mesh_sample.c +478 -0
- data/gphys.gemspec +2 -2
- data/lib/numru/dclext.rb +394 -14
- data/lib/numru/derivative.rb +6 -0
- data/lib/numru/ganalysis/qg.rb +6 -4
- data/lib/numru/ggraph.rb +41 -8
- data/lib/numru/gphys/gphys.rb +62 -14
- data/lib/numru/gphys/gphys_io.rb +4 -4
- data/lib/numru/gphys/version.rb +2 -2
- metadata +84 -79
- data/.gitignore +0 -14
- data/TODO_ep_flux +0 -6
- data/gphys-bigmem.gemspec +0 -44
- data/install.rb +0 -130
- data/sample/cira86_to_nc.rb +0 -122
- data/sample/druby_cli1.rb +0 -23
- data/sample/druby_cli2.rb +0 -28
- data/sample/druby_serv1.rb +0 -30
- data/sample/druby_serv2.rb +0 -51
- data/sample/ep_flux/demo_NCEP_1.rb +0 -48
- data/sample/ep_flux/demo_NCEP_2.rb +0 -57
- data/sample/ep_flux/demo_NCEP_3.rb +0 -81
- data/sample/ggraph_latlon_labelling_dr002690.rb +0 -159
- data/sample/ggraph_mapfit-axes_dr002687.rb +0 -131
- data/sample/map_projection.rb +0 -121
- data/sample/ncep_theta_coord.rb +0 -79
- data/test_old/eof_slp.rb +0 -28
- data/test_old/mltbit.dat +0 -0
- data/test_old/test_ep_flux.rb +0 -533
- data/test_old/test_multibitIO.rb +0 -19
@@ -0,0 +1,203 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: NumRu</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="module">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="./index.html">Home</a>
|
25
|
+
<a href="./index.html#classes">Classes</a>
|
26
|
+
<a href="./index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="./__/__/lib/numru/ganalysis_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="../../lib/numru/ganalysis.rb">../../lib/numru/ganalysis.rb</a></li>
|
39
|
+
|
40
|
+
<li><a href="./__/__/lib/numru/ganalysis/beta_plane_rb.html?TB_iframe=true&height=550&width=785"
|
41
|
+
class="thickbox" title="../../lib/numru/ganalysis/beta_plane.rb">../../lib/numru/ganalysis/beta_plane.rb</a></li>
|
42
|
+
|
43
|
+
<li><a href="./__/__/lib/numru/ganalysis/covariance_rb.html?TB_iframe=true&height=550&width=785"
|
44
|
+
class="thickbox" title="../../lib/numru/ganalysis/covariance.rb">../../lib/numru/ganalysis/covariance.rb</a></li>
|
45
|
+
|
46
|
+
<li><a href="./__/__/lib/numru/ganalysis/eof_rb.html?TB_iframe=true&height=550&width=785"
|
47
|
+
class="thickbox" title="../../lib/numru/ganalysis/eof.rb">../../lib/numru/ganalysis/eof.rb</a></li>
|
48
|
+
|
49
|
+
<li><a href="./__/__/lib/numru/ganalysis/fitting_rb.html?TB_iframe=true&height=550&width=785"
|
50
|
+
class="thickbox" title="../../lib/numru/ganalysis/fitting.rb">../../lib/numru/ganalysis/fitting.rb</a></li>
|
51
|
+
|
52
|
+
<li><a href="./__/__/lib/numru/ganalysis/histogram_rb.html?TB_iframe=true&height=550&width=785"
|
53
|
+
class="thickbox" title="../../lib/numru/ganalysis/histogram.rb">../../lib/numru/ganalysis/histogram.rb</a></li>
|
54
|
+
|
55
|
+
<li><a href="./__/__/lib/numru/ganalysis/log_p_rb.html?TB_iframe=true&height=550&width=785"
|
56
|
+
class="thickbox" title="../../lib/numru/ganalysis/log_p.rb">../../lib/numru/ganalysis/log_p.rb</a></li>
|
57
|
+
|
58
|
+
<li><a href="./__/__/lib/numru/ganalysis/met_rb.html?TB_iframe=true&height=550&width=785"
|
59
|
+
class="thickbox" title="../../lib/numru/ganalysis/met.rb">../../lib/numru/ganalysis/met.rb</a></li>
|
60
|
+
|
61
|
+
<li><a href="./__/__/lib/numru/ganalysis/met_z_rb.html?TB_iframe=true&height=550&width=785"
|
62
|
+
class="thickbox" title="../../lib/numru/ganalysis/met_z.rb">../../lib/numru/ganalysis/met_z.rb</a></li>
|
63
|
+
|
64
|
+
<li><a href="./__/__/lib/numru/ganalysis/planet_rb.html?TB_iframe=true&height=550&width=785"
|
65
|
+
class="thickbox" title="../../lib/numru/ganalysis/planet.rb">../../lib/numru/ganalysis/planet.rb</a></li>
|
66
|
+
|
67
|
+
<li><a href="./__/__/lib/numru/ganalysis/qg_rb.html?TB_iframe=true&height=550&width=785"
|
68
|
+
class="thickbox" title="../../lib/numru/ganalysis/qg.rb">../../lib/numru/ganalysis/qg.rb</a></li>
|
69
|
+
|
70
|
+
<li><a href="./__/__/lib/numru/ganalysis/sigma_coord_rb.html?TB_iframe=true&height=550&width=785"
|
71
|
+
class="thickbox" title="../../lib/numru/ganalysis/sigma_coord.rb">../../lib/numru/ganalysis/sigma_coord.rb</a></li>
|
72
|
+
|
73
|
+
</ul>
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
</div>
|
79
|
+
|
80
|
+
<div id="class-metadata">
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<!-- Namespace Contents -->
|
87
|
+
<div id="namespace-list-section" class="section">
|
88
|
+
<h3 class="section-header">Namespace</h3>
|
89
|
+
<ul class="link-list">
|
90
|
+
|
91
|
+
<li><span class="type">MODULE</span> <a href="NumRu/GAnalysis.html">NumRu::GAnalysis</a></li>
|
92
|
+
|
93
|
+
<li><span class="type">MODULE</span> <a href="NumRu/GGraph.html">NumRu::GGraph</a></li>
|
94
|
+
|
95
|
+
<li><span class="type">CLASS</span> <a href="NumRu/GPhys.html">NumRu::GPhys</a></li>
|
96
|
+
|
97
|
+
</ul>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
<div id="project-metadata">
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<div id="classindex-section" class="section project-section">
|
111
|
+
<h3 class="section-header">Class/Module Index
|
112
|
+
<span class="search-toggle"><img src="./images/find.png"
|
113
|
+
height="16" width="16" alt="[+]"
|
114
|
+
title="show/hide quicksearch" /></span></h3>
|
115
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
116
|
+
<fieldset>
|
117
|
+
<legend>Quicksearch</legend>
|
118
|
+
<input type="text" name="quicksearch" value=""
|
119
|
+
class="quicksearch-field" />
|
120
|
+
</fieldset>
|
121
|
+
</form>
|
122
|
+
|
123
|
+
<ul class="link-list">
|
124
|
+
|
125
|
+
<li><a href="./NumRu.html">NumRu</a></li>
|
126
|
+
|
127
|
+
<li><a href="./NumRu/GAnalysis.html">NumRu::GAnalysis</a></li>
|
128
|
+
|
129
|
+
<li><a href="./NumRu/GAnalysis/BetaPlane.html">NumRu::GAnalysis::BetaPlane</a></li>
|
130
|
+
|
131
|
+
<li><a href="./NumRu/GAnalysis/Fitting.html">NumRu::GAnalysis::Fitting</a></li>
|
132
|
+
|
133
|
+
<li><a href="./NumRu/GAnalysis/LogP.html">NumRu::GAnalysis::LogP</a></li>
|
134
|
+
|
135
|
+
<li><a href="./NumRu/GAnalysis/Met.html">NumRu::GAnalysis::Met</a></li>
|
136
|
+
|
137
|
+
<li><a href="./NumRu/GAnalysis/MetZ.html">NumRu::GAnalysis::MetZ</a></li>
|
138
|
+
|
139
|
+
<li><a href="./NumRu/GAnalysis/Planet.html">NumRu::GAnalysis::Planet</a></li>
|
140
|
+
|
141
|
+
<li><a href="./NumRu/GAnalysis/QG.html">NumRu::GAnalysis::QG</a></li>
|
142
|
+
|
143
|
+
<li><a href="./NumRu/GAnalysis/QG/Uninitialized.html">NumRu::GAnalysis::QG::Uninitialized</a></li>
|
144
|
+
|
145
|
+
<li><a href="./NumRu/GAnalysis/QG_common.html">NumRu::GAnalysis::QG_common</a></li>
|
146
|
+
|
147
|
+
<li><a href="./NumRu/GAnalysis/QG_sphere.html">NumRu::GAnalysis::QG_sphere</a></li>
|
148
|
+
|
149
|
+
<li><a href="./NumRu/GAnalysis/QG_sphere_common.html">NumRu::GAnalysis::QG_sphere_common</a></li>
|
150
|
+
|
151
|
+
<li><a href="./NumRu/GAnalysis/QG_sphere_div.html">NumRu::GAnalysis::QG_sphere_div</a></li>
|
152
|
+
|
153
|
+
<li><a href="./NumRu/GAnalysis/SigmaCoord.html">NumRu::GAnalysis::SigmaCoord</a></li>
|
154
|
+
|
155
|
+
<li><a href="./NumRu/GGraph.html">NumRu::GGraph</a></li>
|
156
|
+
|
157
|
+
<li><a href="./NumRu/GPhys.html">NumRu::GPhys</a></li>
|
158
|
+
|
159
|
+
<li><a href="./Object.html">Object</a></li>
|
160
|
+
|
161
|
+
</ul>
|
162
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
<div id="documentation">
|
170
|
+
<h1 class="module">NumRu</h1>
|
171
|
+
|
172
|
+
<div id="description" class="description">
|
173
|
+
|
174
|
+
</div><!-- description -->
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<!-- Methods -->
|
189
|
+
|
190
|
+
</div><!-- 5Buntitled-5D -->
|
191
|
+
|
192
|
+
|
193
|
+
</div><!-- documentation -->
|
194
|
+
|
195
|
+
<div id="validator-badges">
|
196
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
197
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
198
|
+
Rdoc Generator</a> 2</small>.</p>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</body>
|
202
|
+
</html>
|
203
|
+
|
@@ -0,0 +1,931 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Module: NumRu::GAnalysis</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="module">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="../index.html">Home</a>
|
25
|
+
<a href="../index.html#classes">Classes</a>
|
26
|
+
<a href="../index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="../__/__/lib/numru/ganalysis_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="../../lib/numru/ganalysis.rb">../../lib/numru/ganalysis.rb</a></li>
|
39
|
+
|
40
|
+
<li><a href="../__/__/lib/numru/ganalysis/beta_plane_rb.html?TB_iframe=true&height=550&width=785"
|
41
|
+
class="thickbox" title="../../lib/numru/ganalysis/beta_plane.rb">../../lib/numru/ganalysis/beta_plane.rb</a></li>
|
42
|
+
|
43
|
+
<li><a href="../__/__/lib/numru/ganalysis/covariance_rb.html?TB_iframe=true&height=550&width=785"
|
44
|
+
class="thickbox" title="../../lib/numru/ganalysis/covariance.rb">../../lib/numru/ganalysis/covariance.rb</a></li>
|
45
|
+
|
46
|
+
<li><a href="../__/__/lib/numru/ganalysis/eof_rb.html?TB_iframe=true&height=550&width=785"
|
47
|
+
class="thickbox" title="../../lib/numru/ganalysis/eof.rb">../../lib/numru/ganalysis/eof.rb</a></li>
|
48
|
+
|
49
|
+
<li><a href="../__/__/lib/numru/ganalysis/fitting_rb.html?TB_iframe=true&height=550&width=785"
|
50
|
+
class="thickbox" title="../../lib/numru/ganalysis/fitting.rb">../../lib/numru/ganalysis/fitting.rb</a></li>
|
51
|
+
|
52
|
+
<li><a href="../__/__/lib/numru/ganalysis/histogram_rb.html?TB_iframe=true&height=550&width=785"
|
53
|
+
class="thickbox" title="../../lib/numru/ganalysis/histogram.rb">../../lib/numru/ganalysis/histogram.rb</a></li>
|
54
|
+
|
55
|
+
<li><a href="../__/__/lib/numru/ganalysis/log_p_rb.html?TB_iframe=true&height=550&width=785"
|
56
|
+
class="thickbox" title="../../lib/numru/ganalysis/log_p.rb">../../lib/numru/ganalysis/log_p.rb</a></li>
|
57
|
+
|
58
|
+
<li><a href="../__/__/lib/numru/ganalysis/met_rb.html?TB_iframe=true&height=550&width=785"
|
59
|
+
class="thickbox" title="../../lib/numru/ganalysis/met.rb">../../lib/numru/ganalysis/met.rb</a></li>
|
60
|
+
|
61
|
+
<li><a href="../__/__/lib/numru/ganalysis/met_z_rb.html?TB_iframe=true&height=550&width=785"
|
62
|
+
class="thickbox" title="../../lib/numru/ganalysis/met_z.rb">../../lib/numru/ganalysis/met_z.rb</a></li>
|
63
|
+
|
64
|
+
<li><a href="../__/__/lib/numru/ganalysis/planet_rb.html?TB_iframe=true&height=550&width=785"
|
65
|
+
class="thickbox" title="../../lib/numru/ganalysis/planet.rb">../../lib/numru/ganalysis/planet.rb</a></li>
|
66
|
+
|
67
|
+
<li><a href="../__/__/lib/numru/ganalysis/qg_rb.html?TB_iframe=true&height=550&width=785"
|
68
|
+
class="thickbox" title="../../lib/numru/ganalysis/qg.rb">../../lib/numru/ganalysis/qg.rb</a></li>
|
69
|
+
|
70
|
+
<li><a href="../__/__/lib/numru/ganalysis/sigma_coord_rb.html?TB_iframe=true&height=550&width=785"
|
71
|
+
class="thickbox" title="../../lib/numru/ganalysis/sigma_coord.rb">../../lib/numru/ganalysis/sigma_coord.rb</a></li>
|
72
|
+
|
73
|
+
</ul>
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
</div>
|
79
|
+
|
80
|
+
<div id="class-metadata">
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<!-- Namespace Contents -->
|
87
|
+
<div id="namespace-list-section" class="section">
|
88
|
+
<h3 class="section-header">Namespace</h3>
|
89
|
+
<ul class="link-list">
|
90
|
+
|
91
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/Fitting.html">NumRu::GAnalysis::Fitting</a></li>
|
92
|
+
|
93
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/LogP.html">NumRu::GAnalysis::LogP</a></li>
|
94
|
+
|
95
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/Met.html">NumRu::GAnalysis::Met</a></li>
|
96
|
+
|
97
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/MetZ.html">NumRu::GAnalysis::MetZ</a></li>
|
98
|
+
|
99
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/Planet.html">NumRu::GAnalysis::Planet</a></li>
|
100
|
+
|
101
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/QG.html">NumRu::GAnalysis::QG</a></li>
|
102
|
+
|
103
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/QG_common.html">NumRu::GAnalysis::QG_common</a></li>
|
104
|
+
|
105
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/QG_sphere.html">NumRu::GAnalysis::QG_sphere</a></li>
|
106
|
+
|
107
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/QG_sphere_common.html">NumRu::GAnalysis::QG_sphere_common</a></li>
|
108
|
+
|
109
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/QG_sphere_div.html">NumRu::GAnalysis::QG_sphere_div</a></li>
|
110
|
+
|
111
|
+
<li><span class="type">MODULE</span> <a href="GAnalysis/SigmaCoord.html">NumRu::GAnalysis::SigmaCoord</a></li>
|
112
|
+
|
113
|
+
<li><span class="type">CLASS</span> <a href="GAnalysis/BetaPlane.html">NumRu::GAnalysis::BetaPlane</a></li>
|
114
|
+
|
115
|
+
</ul>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<!-- Method Quickref -->
|
121
|
+
<div id="method-list-section" class="section">
|
122
|
+
<h3 class="section-header">Methods</h3>
|
123
|
+
<ul class="link-list">
|
124
|
+
|
125
|
+
<li><a href="#method-i-corelation">#corelation</a></li>
|
126
|
+
|
127
|
+
<li><a href="#method-i-correlation">#correlation</a></li>
|
128
|
+
|
129
|
+
<li><a href="#method-i-covariance">#covariance</a></li>
|
130
|
+
|
131
|
+
<li><a href="#method-i-eof">#eof</a></li>
|
132
|
+
|
133
|
+
<li><a href="#method-i-eof2">#eof2</a></li>
|
134
|
+
|
135
|
+
<li><a href="#method-i-histogram">#histogram</a></li>
|
136
|
+
|
137
|
+
<li><a href="#method-i-histogram1D">#histogram1D</a></li>
|
138
|
+
|
139
|
+
<li><a href="#method-i-histogram2D">#histogram2D</a></li>
|
140
|
+
|
141
|
+
</ul>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div id="project-metadata">
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<div id="classindex-section" class="section project-section">
|
153
|
+
<h3 class="section-header">Class/Module Index
|
154
|
+
<span class="search-toggle"><img src="../images/find.png"
|
155
|
+
height="16" width="16" alt="[+]"
|
156
|
+
title="show/hide quicksearch" /></span></h3>
|
157
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
158
|
+
<fieldset>
|
159
|
+
<legend>Quicksearch</legend>
|
160
|
+
<input type="text" name="quicksearch" value=""
|
161
|
+
class="quicksearch-field" />
|
162
|
+
</fieldset>
|
163
|
+
</form>
|
164
|
+
|
165
|
+
<ul class="link-list">
|
166
|
+
|
167
|
+
<li><a href="../NumRu.html">NumRu</a></li>
|
168
|
+
|
169
|
+
<li><a href="../NumRu/GAnalysis.html">NumRu::GAnalysis</a></li>
|
170
|
+
|
171
|
+
<li><a href="../NumRu/GAnalysis/BetaPlane.html">NumRu::GAnalysis::BetaPlane</a></li>
|
172
|
+
|
173
|
+
<li><a href="../NumRu/GAnalysis/Fitting.html">NumRu::GAnalysis::Fitting</a></li>
|
174
|
+
|
175
|
+
<li><a href="../NumRu/GAnalysis/LogP.html">NumRu::GAnalysis::LogP</a></li>
|
176
|
+
|
177
|
+
<li><a href="../NumRu/GAnalysis/Met.html">NumRu::GAnalysis::Met</a></li>
|
178
|
+
|
179
|
+
<li><a href="../NumRu/GAnalysis/MetZ.html">NumRu::GAnalysis::MetZ</a></li>
|
180
|
+
|
181
|
+
<li><a href="../NumRu/GAnalysis/Planet.html">NumRu::GAnalysis::Planet</a></li>
|
182
|
+
|
183
|
+
<li><a href="../NumRu/GAnalysis/QG.html">NumRu::GAnalysis::QG</a></li>
|
184
|
+
|
185
|
+
<li><a href="../NumRu/GAnalysis/QG/Uninitialized.html">NumRu::GAnalysis::QG::Uninitialized</a></li>
|
186
|
+
|
187
|
+
<li><a href="../NumRu/GAnalysis/QG_common.html">NumRu::GAnalysis::QG_common</a></li>
|
188
|
+
|
189
|
+
<li><a href="../NumRu/GAnalysis/QG_sphere.html">NumRu::GAnalysis::QG_sphere</a></li>
|
190
|
+
|
191
|
+
<li><a href="../NumRu/GAnalysis/QG_sphere_common.html">NumRu::GAnalysis::QG_sphere_common</a></li>
|
192
|
+
|
193
|
+
<li><a href="../NumRu/GAnalysis/QG_sphere_div.html">NumRu::GAnalysis::QG_sphere_div</a></li>
|
194
|
+
|
195
|
+
<li><a href="../NumRu/GAnalysis/SigmaCoord.html">NumRu::GAnalysis::SigmaCoord</a></li>
|
196
|
+
|
197
|
+
<li><a href="../NumRu/GGraph.html">NumRu::GGraph</a></li>
|
198
|
+
|
199
|
+
<li><a href="../NumRu/GPhys.html">NumRu::GPhys</a></li>
|
200
|
+
|
201
|
+
<li><a href="../Object.html">Object</a></li>
|
202
|
+
|
203
|
+
</ul>
|
204
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div id="documentation">
|
212
|
+
<h1 class="module">NumRu::GAnalysis</h1>
|
213
|
+
|
214
|
+
<div id="description" class="description">
|
215
|
+
|
216
|
+
</div><!-- description -->
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
<!-- Constants -->
|
228
|
+
<div id="constants-list" class="section">
|
229
|
+
<h3 class="section-header">Constants</h3>
|
230
|
+
<dl>
|
231
|
+
|
232
|
+
<dt><a name="HistogramGSL">HistogramGSL</a></dt>
|
233
|
+
|
234
|
+
<dd class="description"></dd>
|
235
|
+
|
236
|
+
|
237
|
+
</dl>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
<!-- Methods -->
|
244
|
+
|
245
|
+
<div id="public-instance-method-details" class="method-section section">
|
246
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
247
|
+
|
248
|
+
|
249
|
+
<div id="corelation-method" class="method-detail ">
|
250
|
+
<a name="method-i-corelation"></a>
|
251
|
+
|
252
|
+
|
253
|
+
<div class="method-heading">
|
254
|
+
<span class="method-name">corelation</span><span
|
255
|
+
class="method-args">(gphys0, gphys1, *dims)</span>
|
256
|
+
<span class="method-click-advice">click to toggle source</span>
|
257
|
+
</div>
|
258
|
+
|
259
|
+
|
260
|
+
<div class="method-description">
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<div class="method-source-code" id="corelation-source">
|
267
|
+
<pre>
|
268
|
+
<span class="ruby-comment"># File ../../lib/numru/ganalysis/covariance.rb, line 60</span>
|
269
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">corelation</span>(<span class="ruby-identifier">gphys0</span>, <span class="ruby-identifier">gphys1</span>, *<span class="ruby-identifier">dims</span>)
|
270
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">val</span>
|
271
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">val</span>
|
272
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArrayMiss</span>)
|
273
|
+
<span class="ruby-identifier">mask</span> = <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">get_mask</span>
|
274
|
+
<span class="ruby-keyword">else</span>
|
275
|
+
<span class="ruby-identifier">mask</span> = <span class="ruby-constant">NArray</span>.<span class="ruby-identifier">byte</span>(*(<span class="ruby-identifier">val0</span>.<span class="ruby-identifier">shape</span>)).<span class="ruby-identifier">fill!</span>(<span class="ruby-value">1</span>)
|
276
|
+
<span class="ruby-keyword">end</span>
|
277
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArrayMiss</span>)
|
278
|
+
<span class="ruby-identifier">mask2</span> = <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">get_mask</span>
|
279
|
+
<span class="ruby-keyword">else</span>
|
280
|
+
<span class="ruby-identifier">mask2</span> = <span class="ruby-constant">NArray</span>.<span class="ruby-identifier">byte</span>(*(<span class="ruby-identifier">val1</span>.<span class="ruby-identifier">shape</span>)).<span class="ruby-identifier">fill!</span>(<span class="ruby-value">1</span>)
|
281
|
+
<span class="ruby-keyword">end</span>
|
282
|
+
<span class="ruby-identifier">mask</span>.<span class="ruby-identifier">mul!</span>(<span class="ruby-identifier">mask2</span>)
|
283
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-constant">NArrayMiss</span>.<span class="ruby-identifier">to_nam</span>(<span class="ruby-identifier">val0</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArrayMiss</span>)
|
284
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-constant">NArrayMiss</span>.<span class="ruby-identifier">to_nam</span>(<span class="ruby-identifier">val1</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArrayMiss</span>)
|
285
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">set_mask</span>(<span class="ruby-identifier">mask</span>)
|
286
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">set_mask</span>(<span class="ruby-identifier">mask</span>)
|
287
|
+
<span class="ruby-identifier">p</span> <span class="ruby-identifier">val0</span>,<span class="ruby-identifier">val1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
288
|
+
<span class="ruby-identifier">gphys0</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">copy</span>.<span class="ruby-identifier">replace_val</span>(<span class="ruby-identifier">val0</span>)
|
289
|
+
<span class="ruby-identifier">gphys1</span> = <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">copy</span>.<span class="ruby-identifier">replace_val</span>(<span class="ruby-identifier">val1</span>)
|
290
|
+
|
291
|
+
<span class="ruby-identifier">covariance</span>, <span class="ruby-identifier">ndiv</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">covariance</span>(<span class="ruby-identifier">gphys1</span>,*<span class="ruby-identifier">dims</span>)
|
292
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">covariance</span><span class="ruby-operator">/</span>(<span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">stddev</span>(*<span class="ruby-identifier">dims</span>)*<span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">stddev</span>(*<span class="ruby-identifier">dims</span>)), <span class="ruby-identifier">mask</span>.<span class="ruby-identifier">to_type</span>(<span class="ruby-constant">NArray</span><span class="ruby-operator">::</span><span class="ruby-constant">LINT</span>).<span class="ruby-identifier">sum</span>(*<span class="ruby-identifier">dims</span>)
|
293
|
+
<span class="ruby-keyword">end</span></pre>
|
294
|
+
</div><!-- corelation-source -->
|
295
|
+
|
296
|
+
</div>
|
297
|
+
|
298
|
+
|
299
|
+
<div class="aliases">
|
300
|
+
Also aliased as: <a href="GAnalysis.html#method-i-correlation">correlation</a>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
</div><!-- corelation-method -->
|
306
|
+
|
307
|
+
|
308
|
+
<div id="correlation-method" class="method-detail method-alias">
|
309
|
+
<a name="method-i-correlation"></a>
|
310
|
+
|
311
|
+
|
312
|
+
<div class="method-heading">
|
313
|
+
<span class="method-name">correlation</span><span
|
314
|
+
class="method-args">(gphys0, gphys1, *dims)</span>
|
315
|
+
<span class="method-click-advice">click to toggle source</span>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
|
319
|
+
<div class="method-description">
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
</div>
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
<div class="aliases">
|
331
|
+
Alias for: <a href="GAnalysis.html#method-i-corelation">corelation</a>
|
332
|
+
</div>
|
333
|
+
|
334
|
+
</div><!-- correlation-method -->
|
335
|
+
|
336
|
+
|
337
|
+
<div id="covariance-method" class="method-detail ">
|
338
|
+
<a name="method-i-covariance"></a>
|
339
|
+
|
340
|
+
|
341
|
+
<div class="method-heading">
|
342
|
+
<span class="method-name">covariance</span><span
|
343
|
+
class="method-args">(gphys0, gphys1, *dims)</span>
|
344
|
+
<span class="method-click-advice">click to toggle source</span>
|
345
|
+
</div>
|
346
|
+
|
347
|
+
|
348
|
+
<div class="method-description">
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
<div class="method-source-code" id="covariance-source">
|
355
|
+
<pre>
|
356
|
+
<span class="ruby-comment"># File ../../lib/numru/ganalysis/covariance.rb, line 8</span>
|
357
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">covariance</span>(<span class="ruby-identifier">gphys0</span>, <span class="ruby-identifier">gphys1</span>, *<span class="ruby-identifier">dims</span>)
|
358
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">GPhys</span><span class="ruby-operator">===</span><span class="ruby-identifier">gphys0</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">GPhys</span><span class="ruby-operator">===</span><span class="ruby-identifier">gphys1</span>
|
359
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"gphys0 and gphys1 must be GPhys"</span>
|
360
|
+
<span class="ruby-keyword">end</span>
|
361
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">shape</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">shape</span>
|
362
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"gphys0 and gphys1 must have the same shape"</span>
|
363
|
+
<span class="ruby-keyword">end</span>
|
364
|
+
<span class="ruby-identifier">units</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">units</span>*<span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">units</span>
|
365
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">dims</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
366
|
+
<span class="ruby-identifier">dims</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
367
|
+
<span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">rank</span>.<span class="ruby-identifier">times</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">dims</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">i</span> }
|
368
|
+
<span class="ruby-keyword">else</span>
|
369
|
+
<span class="ruby-identifier">dims</span> = <span class="ruby-identifier">dims</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">dim</span><span class="ruby-operator">|</span> <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">dim_index</span>(<span class="ruby-identifier">dim</span>) }
|
370
|
+
<span class="ruby-keyword">end</span>
|
371
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">val</span>
|
372
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">val</span>
|
373
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArrayMiss</span>)
|
374
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArrayMiss</span>)
|
375
|
+
<span class="ruby-identifier">mask</span> = <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">get_mask</span> * <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">get_mask</span>
|
376
|
+
<span class="ruby-identifier">ndiv</span> = <span class="ruby-identifier">mask</span>.<span class="ruby-identifier">to_type</span>(<span class="ruby-constant">NArray</span><span class="ruby-operator">::</span><span class="ruby-constant">LINT</span>).<span class="ruby-identifier">accum</span>(*<span class="ruby-identifier">dims</span>)
|
377
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">set_mask</span>(<span class="ruby-identifier">mask</span>)
|
378
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">set_mask</span>(<span class="ruby-identifier">mask</span>)
|
379
|
+
<span class="ruby-keyword">else</span>
|
380
|
+
<span class="ruby-identifier">ndiv</span> = <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">get_mask</span>.<span class="ruby-identifier">to_type</span>(<span class="ruby-constant">NArray</span><span class="ruby-operator">::</span><span class="ruby-constant">LINT</span>).<span class="ruby-identifier">accum</span>(*<span class="ruby-identifier">dims</span>)
|
381
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-constant">NArrayMiss</span>.<span class="ruby-identifier">to_nam</span>(<span class="ruby-identifier">val1</span>,<span class="ruby-identifier">val0</span>.<span class="ruby-identifier">get_mask</span>)
|
382
|
+
<span class="ruby-keyword">end</span>
|
383
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArrayMiss</span>)
|
384
|
+
<span class="ruby-identifier">ndiv</span> = <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">get_mask</span>.<span class="ruby-identifier">to_type</span>(<span class="ruby-constant">NArray</span><span class="ruby-operator">::</span><span class="ruby-constant">LINT</span>).<span class="ruby-identifier">accum</span>(*<span class="ruby-identifier">dims</span>)
|
385
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-constant">NArrayMiss</span>.<span class="ruby-identifier">to_nam</span>(<span class="ruby-identifier">val0</span>,<span class="ruby-identifier">val1</span>.<span class="ruby-identifier">get_mask</span>)
|
386
|
+
<span class="ruby-keyword">else</span>
|
387
|
+
<span class="ruby-identifier">ndiv</span> = <span class="ruby-value">1</span>
|
388
|
+
<span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">shape</span>.<span class="ruby-identifier">each_with_index</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
389
|
+
<span class="ruby-identifier">ndiv</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">s</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">dims</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">i</span>)
|
390
|
+
}
|
391
|
+
<span class="ruby-keyword">end</span>
|
392
|
+
<span class="ruby-identifier">val0</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">accum</span>(*<span class="ruby-identifier">dims</span>).<span class="ruby-identifier">div!</span>(<span class="ruby-identifier">ndiv</span>)
|
393
|
+
<span class="ruby-identifier">val1</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">accum</span>(*<span class="ruby-identifier">dims</span>).<span class="ruby-identifier">div!</span>(<span class="ruby-identifier">ndiv</span>)
|
394
|
+
<span class="ruby-identifier">nary</span> = <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">mul_add</span>(<span class="ruby-identifier">val1</span>,*<span class="ruby-identifier">dims</span>)
|
395
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">Float</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">nary</span>
|
396
|
+
<span class="ruby-identifier">ndiv</span> = <span class="ruby-identifier">ndiv</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">ndiv</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArray</span>)
|
397
|
+
<span class="ruby-identifier">nary</span> <span class="ruby-operator">/=</span> (<span class="ruby-identifier">ndiv</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)
|
398
|
+
<span class="ruby-keyword">return</span> <span class="ruby-constant">UNumeric</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nary</span>, <span class="ruby-identifier">units</span>), <span class="ruby-identifier">ndiv</span>
|
399
|
+
<span class="ruby-keyword">else</span>
|
400
|
+
<span class="ruby-identifier">nary</span>.<span class="ruby-identifier">div!</span>(<span class="ruby-identifier">ndiv</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)
|
401
|
+
<span class="ruby-identifier">vary</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nary</span>,
|
402
|
+
{<span class="ruby-string">"long_name"</span>=<span class="ruby-operator">></span><span class="ruby-string">"covariance"</span>,<span class="ruby-string">"units"</span>=<span class="ruby-operator">></span><span class="ruby-identifier">units</span>.<span class="ruby-identifier">to_s</span>},
|
403
|
+
<span class="ruby-string">"covariance"</span>)
|
404
|
+
<span class="ruby-identifier">new_grid</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">grid</span>.<span class="ruby-identifier">delete_axes</span>(<span class="ruby-identifier">dims</span>, <span class="ruby-string">"covariance"</span>).<span class="ruby-identifier">copy</span>
|
405
|
+
<span class="ruby-keyword">return</span> <span class="ruby-constant">GPhys</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">new_grid</span>,<span class="ruby-identifier">vary</span>), <span class="ruby-identifier">ndiv</span>
|
406
|
+
<span class="ruby-keyword">end</span>
|
407
|
+
<span class="ruby-keyword">end</span></pre>
|
408
|
+
</div><!-- covariance-source -->
|
409
|
+
|
410
|
+
</div>
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
</div><!-- covariance-method -->
|
416
|
+
|
417
|
+
|
418
|
+
<div id="eof-method" class="method-detail ">
|
419
|
+
<a name="method-i-eof"></a>
|
420
|
+
|
421
|
+
|
422
|
+
<div class="method-heading">
|
423
|
+
<span class="method-name">eof</span><span
|
424
|
+
class="method-args">(gphys, *args)</span>
|
425
|
+
<span class="method-click-advice">click to toggle source</span>
|
426
|
+
</div>
|
427
|
+
|
428
|
+
|
429
|
+
<div class="method-description">
|
430
|
+
|
431
|
+
<p>Calculate EOF vectors and contribution rate</p>
|
432
|
+
|
433
|
+
<h2>call-seq</h2>
|
434
|
+
|
435
|
+
<pre>NumRu::GAnalysis.eof(gphys, dim0[, dim1, ..., dimN[, opts]]) => [eof, rate]</pre>
|
436
|
+
|
437
|
+
<h2>Arguments</h2>
|
438
|
+
<table class="rdoc-list"><tr><td class="rdoc-term"><p><tt>gphys</tt></p></td>
|
439
|
+
<td>
|
440
|
+
<p><a href="GPhys.html">GPhys</a> object to be calculated its EOF</p>
|
441
|
+
</td></tr><tr><td class="rdoc-term"><p><tt>dim0</tt>, ..., <tt>dimN</tt></p></td>
|
442
|
+
<td>
|
443
|
+
<p>dimension name (String) or number (Ingeter) to calculate variance or
|
444
|
+
covariance, and those dimensions are not contained in the result EOF
|
445
|
+
vectors.</p>
|
446
|
+
</td></tr><tr><td class="rdoc-term"><p><tt>opts</tt></p></td>
|
447
|
+
<td>
|
448
|
+
<p>a Hash object whose key is String or Symbol. The following options are
|
449
|
+
available:</p>
|
450
|
+
</td></tr></table>
|
451
|
+
|
452
|
+
<pre>* nmodes: Integer, number of EOF modes to be calculate (default all EOF modes)
|
453
|
+
* weight: GPhys or NArray, weight vector
|
454
|
+
+gphys+ is multiplied by the weight vector before calculation of variance covariance matrix
|
455
|
+
and the result eigen vectors are divided by the vector.
|
456
|
+
If weight vector is not set,
|
457
|
+
it is cosine of latitude when the first two axes of the +gphys+ are "lon" and "lat" and +disable_weight+ option is not +true+,
|
458
|
+
else 1.
|
459
|
+
* disable_weight: See weight option.</pre>
|
460
|
+
|
461
|
+
<h2>Return values</h2>
|
462
|
+
<table class="rdoc-list"><tr><td class="rdoc-term"><p><tt>eof</tt></p></td>
|
463
|
+
<td>
|
464
|
+
<p><a href="GPhys.html">GPhys</a> object for array of EOF vectors.</p>
|
465
|
+
</td></tr><tr><td class="rdoc-term"><p><tt>rate</tt></p></td>
|
466
|
+
<td>
|
467
|
+
<p><a href="GPhys.html">GPhys</a> object for array of contribution rate
|
468
|
+
correspoinding to the EOF vectors.</p>
|
469
|
+
</td></tr></table>
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
<div class="method-source-code" id="eof-source">
|
474
|
+
<pre>
|
475
|
+
<span class="ruby-comment"># File ../../lib/numru/ganalysis/eof.rb, line 51</span>
|
476
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eof</span>(<span class="ruby-identifier">gphys</span>, *<span class="ruby-identifier">args</span>)
|
477
|
+
|
478
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-identifier">@@EOF_engin</span>)
|
479
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"SSL2 (Ruby-SSL2) or LAPACK (Ruby-LAPACK) or GSL (Ruby/GSL) must have been installed. (SSL2 or LAPACK is recommended for large computation)"</span>
|
480
|
+
<span class="ruby-keyword">end</span>
|
481
|
+
|
482
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">-1</span>]
|
483
|
+
<span class="ruby-identifier">dims</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]
|
484
|
+
<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">-1</span>]
|
485
|
+
<span class="ruby-keyword">else</span>
|
486
|
+
<span class="ruby-identifier">dims</span> = <span class="ruby-identifier">args</span>
|
487
|
+
<span class="ruby-identifier">opts</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
488
|
+
<span class="ruby-keyword">end</span>
|
489
|
+
<span class="ruby-identifier">dims</span> = <span class="ruby-identifier">dims</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">dim</span><span class="ruby-operator">|</span> <span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">dim_index</span>(<span class="ruby-identifier">dim</span>) }
|
490
|
+
<span class="ruby-identifier">n</span> = <span class="ruby-value">1</span>
|
491
|
+
<span class="ruby-identifier">n_lost</span> = <span class="ruby-value">1</span>
|
492
|
+
<span class="ruby-identifier">dims1</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
493
|
+
<span class="ruby-identifier">shape1</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
494
|
+
<span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">shape</span>.<span class="ruby-identifier">each_with_index</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
495
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">dims</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">i</span>)
|
496
|
+
<span class="ruby-identifier">n_lost</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">s</span>
|
497
|
+
<span class="ruby-keyword">else</span>
|
498
|
+
<span class="ruby-identifier">n</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">s</span>
|
499
|
+
<span class="ruby-identifier">dims1</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">i</span>
|
500
|
+
<span class="ruby-identifier">shape1</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">s</span>
|
501
|
+
<span class="ruby-keyword">end</span>
|
502
|
+
}
|
503
|
+
<span class="ruby-identifier">new_grid</span> = <span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-string">"@grid"</span>).<span class="ruby-identifier">delete_axes</span>(<span class="ruby-identifier">dims</span>, <span class="ruby-string">"covariance matrix"</span>).<span class="ruby-identifier">copy</span>
|
504
|
+
<span class="ruby-identifier">new_index</span> = <span class="ruby-constant">NArray</span>.<span class="ruby-identifier">sint</span>(*<span class="ruby-identifier">new_grid</span>.<span class="ruby-identifier">shape</span>).<span class="ruby-identifier">indgen</span>
|
505
|
+
<span class="ruby-identifier">index</span> = <span class="ruby-constant">NArray</span>.<span class="ruby-identifier">object</span>(<span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">rank</span>)
|
506
|
+
<span class="ruby-identifier">index</span>[<span class="ruby-identifier">dims</span>] = <span class="ruby-keyword">true</span>
|
507
|
+
|
508
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">w</span> = (<span class="ruby-identifier">opts</span>[<span class="ruby-value">:weight</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">opts</span>[<span class="ruby-string">"weight"</span>])
|
509
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">GPhys</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">w</span>
|
510
|
+
<span class="ruby-identifier">w</span> = <span class="ruby-identifier">w</span>.<span class="ruby-identifier">val</span>
|
511
|
+
<span class="ruby-keyword">end</span>
|
512
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">NArray</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">w</span>
|
513
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"weight must be NArray of GPhys"</span>
|
514
|
+
<span class="ruby-keyword">end</span>
|
515
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">shape</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">new_grid</span>.<span class="ruby-identifier">shape</span>
|
516
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"shape of weight is invalid"</span>
|
517
|
+
<span class="ruby-keyword">end</span>
|
518
|
+
<span class="ruby-identifier">w</span> <span class="ruby-operator">/=</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">mean</span>
|
519
|
+
<span class="ruby-identifier">w</span>.<span class="ruby-identifier">reshape!</span>(<span class="ruby-identifier">n</span>)
|
520
|
+
<span class="ruby-keyword">else</span>
|
521
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">opts</span>[<span class="ruby-value">:disable_weight</span>]<span class="ruby-operator">||</span><span class="ruby-identifier">opts</span>[<span class="ruby-string">"disable_weight"</span>]) <span class="ruby-operator">&&</span> <span class="ruby-regexp">/^lon/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">new_grid</span>.<span class="ruby-identifier">coord</span>(<span class="ruby-value">0</span>).<span class="ruby-identifier">name</span> <span class="ruby-operator">&&</span> <span class="ruby-regexp">/^lat/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">new_grid</span>.<span class="ruby-identifier">coord</span>(<span class="ruby-value">1</span>).<span class="ruby-identifier">name</span>
|
522
|
+
<span class="ruby-identifier">rad</span> = <span class="ruby-constant">NumRu</span><span class="ruby-operator">::</span><span class="ruby-constant">Units</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"radian"</span>)
|
523
|
+
<span class="ruby-identifier">nlon</span> = <span class="ruby-identifier">new_grid</span>.<span class="ruby-identifier">coord</span>(<span class="ruby-value">0</span>).<span class="ruby-identifier">length</span>
|
524
|
+
<span class="ruby-identifier">lat</span> = <span class="ruby-identifier">new_grid</span>.<span class="ruby-identifier">coord</span>(<span class="ruby-value">1</span>).<span class="ruby-identifier">convert_units</span>(<span class="ruby-identifier">rad</span>).<span class="ruby-identifier">val</span>
|
525
|
+
<span class="ruby-identifier">w</span> = <span class="ruby-constant">NArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lat</span>.<span class="ruby-identifier">typecode</span>,<span class="ruby-identifier">nlon</span>).<span class="ruby-identifier">fill!</span>(<span class="ruby-value">1</span>) * <span class="ruby-constant">NMath</span><span class="ruby-operator">::</span><span class="ruby-identifier">cos</span>(<span class="ruby-identifier">lat</span>).<span class="ruby-identifier">reshape</span>(<span class="ruby-value">1</span>,<span class="ruby-identifier">lat</span>.<span class="ruby-identifier">length</span>)
|
526
|
+
<span class="ruby-identifier">w</span> <span class="ruby-operator">/=</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">mean</span>
|
527
|
+
<span class="ruby-identifier">w</span>.<span class="ruby-identifier">reshape!</span>(<span class="ruby-identifier">n</span>)
|
528
|
+
<span class="ruby-keyword">else</span>
|
529
|
+
<span class="ruby-identifier">w</span> = <span class="ruby-keyword">nil</span>
|
530
|
+
<span class="ruby-keyword">end</span>
|
531
|
+
<span class="ruby-keyword">end</span>
|
532
|
+
|
533
|
+
<span class="ruby-identifier">ary</span> = <span class="ruby-constant">NArrayMiss</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">typecode</span>, <span class="ruby-identifier">n_lost</span>, <span class="ruby-identifier">n</span>)
|
534
|
+
<span class="ruby-identifier">ind_rank</span> = <span class="ruby-identifier">dims1</span>.<span class="ruby-identifier">length</span>
|
535
|
+
<span class="ruby-identifier">ind</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ind_rank</span>,<span class="ruby-value">0</span>)
|
536
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">times</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n1</span><span class="ruby-operator">|</span>
|
537
|
+
<span class="ruby-identifier">index</span>[<span class="ruby-identifier">dims1</span>] = <span class="ruby-identifier">ind</span>
|
538
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">gphys</span>[*<span class="ruby-identifier">index</span>].<span class="ruby-identifier">val</span>
|
539
|
+
<span class="ruby-identifier">val</span>.<span class="ruby-identifier">reshape!</span>(<span class="ruby-identifier">n_lost</span>)
|
540
|
+
<span class="ruby-identifier">val</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">mean</span>
|
541
|
+
<span class="ruby-identifier">ary</span>[<span class="ruby-keyword">true</span>,<span class="ruby-identifier">n1</span>] = <span class="ruby-identifier">val</span>
|
542
|
+
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">n1</span><span class="ruby-operator">==</span><span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
543
|
+
<span class="ruby-identifier">ind</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
544
|
+
<span class="ruby-identifier">ind_rank</span>.<span class="ruby-identifier">times</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
545
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ind</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">shape1</span>[<span class="ruby-identifier">i</span>]
|
546
|
+
<span class="ruby-identifier">ind</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">0</span>
|
547
|
+
<span class="ruby-identifier">ind</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
548
|
+
<span class="ruby-keyword">else</span>
|
549
|
+
<span class="ruby-keyword">break</span>
|
550
|
+
<span class="ruby-keyword">end</span>
|
551
|
+
}
|
552
|
+
}
|
553
|
+
<span class="ruby-identifier">ary</span>.<span class="ruby-identifier">mul!</span>(<span class="ruby-identifier">w</span>.<span class="ruby-identifier">reshape</span>(<span class="ruby-value">1</span>,<span class="ruby-identifier">n</span>)) <span class="ruby-keyword">if</span> <span class="ruby-identifier">w</span>
|
554
|
+
|
555
|
+
|
556
|
+
<span class="ruby-identifier">nmodes</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:nmodes</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">opts</span>[<span class="ruby-string">"nmodes"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">n</span>
|
557
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">@@EOF_engin</span>
|
558
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"ssl2"</span>
|
559
|
+
<span class="ruby-identifier">print</span> <span class="ruby-string">"start calc covariance matrix\n"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
560
|
+
<span class="ruby-identifier">nary</span> = <span class="ruby-constant">NArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">typecode</span>,<span class="ruby-identifier">n</span>*(<span class="ruby-identifier">n</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>)<span class="ruby-operator">/</span><span class="ruby-value">2</span>)
|
561
|
+
<span class="ruby-identifier">nn</span> = <span class="ruby-value">0</span>
|
562
|
+
<span class="ruby-identifier">total_var</span> = <span class="ruby-value">0</span>
|
563
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">times</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n0</span><span class="ruby-operator">|</span>
|
564
|
+
<span class="ruby-keyword">for</span> <span class="ruby-identifier">n1</span> <span class="ruby-keyword">in</span> <span class="ruby-identifier">n0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>
|
565
|
+
<span class="ruby-identifier">nary</span>[<span class="ruby-identifier">nn</span>] = <span class="ruby-identifier">ary</span>[<span class="ruby-identifier">n0</span>].<span class="ruby-identifier">mul_add</span>(<span class="ruby-identifier">ary</span>[<span class="ruby-identifier">n1</span>],<span class="ruby-value">0</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">n_lost</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)
|
566
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">n1</span><span class="ruby-operator">==</span><span class="ruby-identifier">n0</span>
|
567
|
+
<span class="ruby-identifier">total_var</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">nary</span>[<span class="ruby-identifier">nn</span>]
|
568
|
+
<span class="ruby-keyword">end</span>
|
569
|
+
<span class="ruby-identifier">nn</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
570
|
+
<span class="ruby-keyword">end</span>
|
571
|
+
}
|
572
|
+
<span class="ruby-identifier">ary</span> = <span class="ruby-keyword">nil</span> <span class="ruby-comment"># for GC</span>
|
573
|
+
<span class="ruby-identifier">print</span> <span class="ruby-string">"start calc eigen vector\n"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
574
|
+
<span class="ruby-identifier">val</span>, <span class="ruby-identifier">vec</span> = <span class="ruby-constant">SSL2</span>.<span class="ruby-identifier">seig2</span>(<span class="ruby-identifier">nary</span>,<span class="ruby-identifier">nmodes</span>)
|
575
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"lapack"</span>
|
576
|
+
<span class="ruby-identifier">print</span> <span class="ruby-string">"start calc covariance matrix\n"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
577
|
+
<span class="ruby-identifier">nary</span> = <span class="ruby-constant">NArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">typecode</span>,<span class="ruby-identifier">n</span>,<span class="ruby-identifier">n</span>)
|
578
|
+
<span class="ruby-identifier">total_var</span> = <span class="ruby-value">0.0</span>
|
579
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">times</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n0</span><span class="ruby-operator">|</span>
|
580
|
+
<span class="ruby-identifier">nary</span>[<span class="ruby-identifier">n0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>,<span class="ruby-identifier">n0</span>] = (<span class="ruby-identifier">ary</span>[<span class="ruby-keyword">true</span>,<span class="ruby-identifier">n0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>].<span class="ruby-identifier">mul_add</span>(<span class="ruby-identifier">ary</span>[<span class="ruby-keyword">true</span>,<span class="ruby-identifier">n0</span>],<span class="ruby-value">0</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">n_lost</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)).<span class="ruby-identifier">get_array!</span>
|
581
|
+
<span class="ruby-identifier">total_var</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">nary</span>[<span class="ruby-identifier">n0</span>,<span class="ruby-identifier">n0</span>]
|
582
|
+
}
|
583
|
+
<span class="ruby-identifier">ary</span> = <span class="ruby-keyword">nil</span> <span class="ruby-comment"># for GC</span>
|
584
|
+
<span class="ruby-identifier">print</span> <span class="ruby-string">"start calc eigen vector\n"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
585
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">nary</span>.<span class="ruby-identifier">typecode</span>
|
586
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">NArray</span><span class="ruby-operator">::</span><span class="ruby-constant">DFLOAT</span>
|
587
|
+
<span class="ruby-identifier">m</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">vec</span>, <span class="ruby-identifier">isuppz</span>, <span class="ruby-identifier">work</span>, <span class="ruby-identifier">iwork</span>, <span class="ruby-identifier">info</span>, = <span class="ruby-constant">NumRu</span><span class="ruby-operator">::</span><span class="ruby-constant">Lapack</span>.<span class="ruby-identifier">dsyevr</span>(<span class="ruby-string">"V"</span>, <span class="ruby-string">"I"</span>, <span class="ruby-string">"L"</span>, <span class="ruby-identifier">nary</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-identifier">nmodes</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>, <span class="ruby-identifier">n</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">-1</span>, <span class="ruby-value">-1</span>)
|
588
|
+
<span class="ruby-identifier">m</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">vec</span>, = <span class="ruby-constant">NumRu</span><span class="ruby-operator">::</span><span class="ruby-constant">Lapack</span>.<span class="ruby-identifier">dsyevr</span>(<span class="ruby-string">"V"</span>, <span class="ruby-string">"I"</span>, <span class="ruby-string">"L"</span>, <span class="ruby-identifier">nary</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-identifier">nmodes</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>, <span class="ruby-identifier">n</span>, <span class="ruby-value">0.0</span>, <span class="ruby-identifier">work</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">iwork</span>[<span class="ruby-value">0</span>])
|
589
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">NArray</span><span class="ruby-operator">::</span><span class="ruby-constant">SFLOAT</span>
|
590
|
+
<span class="ruby-identifier">m</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">vec</span>, <span class="ruby-identifier">isuppz</span>, <span class="ruby-identifier">work</span>, <span class="ruby-identifier">iwork</span>, <span class="ruby-identifier">info</span>, = <span class="ruby-constant">NumRu</span><span class="ruby-operator">::</span><span class="ruby-constant">Lapack</span>.<span class="ruby-identifier">ssyevr</span>(<span class="ruby-string">"V"</span>, <span class="ruby-string">"I"</span>, <span class="ruby-string">"L"</span>, <span class="ruby-identifier">nary</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-identifier">nmodes</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>, <span class="ruby-identifier">n</span>, <span class="ruby-value">0.0</span>, <span class="ruby-value">-1</span>, <span class="ruby-value">-1</span>)
|
591
|
+
<span class="ruby-identifier">m</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">vec</span>, = <span class="ruby-constant">NumRu</span><span class="ruby-operator">::</span><span class="ruby-constant">Lapack</span>.<span class="ruby-identifier">ssyevr</span>(<span class="ruby-string">"V"</span>, <span class="ruby-string">"I"</span>, <span class="ruby-string">"L"</span>, <span class="ruby-identifier">nary</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-identifier">nmodes</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>, <span class="ruby-identifier">n</span>, <span class="ruby-value">0.0</span>, <span class="ruby-identifier">work</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">iwork</span>[<span class="ruby-value">0</span>])
|
592
|
+
<span class="ruby-keyword">end</span>
|
593
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span>[<span class="ruby-value">-1</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
|
594
|
+
<span class="ruby-identifier">vec</span> = <span class="ruby-identifier">vec</span>[<span class="ruby-keyword">true</span>,<span class="ruby-value">-1</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
|
595
|
+
<span class="ruby-keyword">when</span> <span class="ruby-string">"gsl"</span>
|
596
|
+
<span class="ruby-identifier">print</span> <span class="ruby-string">"start calc covariance matrix\n"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
597
|
+
<span class="ruby-identifier">nary</span> = <span class="ruby-constant">NArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">typecode</span>,<span class="ruby-identifier">n</span>,<span class="ruby-identifier">n</span>)
|
598
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">times</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n0</span><span class="ruby-operator">|</span>
|
599
|
+
<span class="ruby-identifier">nary</span>[<span class="ruby-identifier">n0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>,<span class="ruby-identifier">n0</span>] = (<span class="ruby-identifier">ary</span>[<span class="ruby-keyword">true</span>,<span class="ruby-identifier">n0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>].<span class="ruby-identifier">mul_add</span>(<span class="ruby-identifier">ary</span>[<span class="ruby-keyword">true</span>,<span class="ruby-identifier">n0</span>],<span class="ruby-value">0</span>)<span class="ruby-operator">/</span>(<span class="ruby-identifier">n_lost</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)).<span class="ruby-identifier">get_array!</span>
|
600
|
+
<span class="ruby-identifier">nary</span>[<span class="ruby-identifier">n0</span>,<span class="ruby-identifier">n0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>] = <span class="ruby-identifier">nary</span>[<span class="ruby-identifier">n0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>,<span class="ruby-identifier">n0</span>]
|
601
|
+
}
|
602
|
+
<span class="ruby-identifier">ary</span> = <span class="ruby-keyword">nil</span> <span class="ruby-comment"># for GC</span>
|
603
|
+
<span class="ruby-identifier">print</span> <span class="ruby-string">"start calc eigen vector\n"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$DEBUG</span>
|
604
|
+
<span class="ruby-identifier">val</span>, <span class="ruby-identifier">vec</span> = <span class="ruby-constant">GSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Eigen</span><span class="ruby-operator">::</span><span class="ruby-identifier">symmv</span>(<span class="ruby-identifier">nary</span>.<span class="ruby-identifier">to_gm</span>)
|
605
|
+
<span class="ruby-constant">GSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Eigen</span>.<span class="ruby-identifier">symmv_sort</span>(<span class="ruby-identifier">val</span>, <span class="ruby-identifier">vec</span>, <span class="ruby-constant">GSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Eigen</span><span class="ruby-operator">::</span><span class="ruby-constant">SORT_VAL_DESC</span>)
|
606
|
+
<span class="ruby-identifier">vec</span> = <span class="ruby-identifier">vec</span>.<span class="ruby-identifier">to_na</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">nmodes</span>,<span class="ruby-keyword">true</span>].<span class="ruby-identifier">transpose</span>(<span class="ruby-value">1</span>,<span class="ruby-value">0</span>)
|
607
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_na</span>
|
608
|
+
<span class="ruby-identifier">total_var</span> = <span class="ruby-identifier">val</span>.<span class="ruby-identifier">sum</span>
|
609
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">nmodes</span>]
|
610
|
+
<span class="ruby-keyword">end</span>
|
611
|
+
|
612
|
+
<span class="ruby-identifier">axes</span> = <span class="ruby-identifier">new_grid</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-string">'@axes'</span>)
|
613
|
+
<span class="ruby-identifier">axis_order</span> = <span class="ruby-constant">Axis</span>.<span class="ruby-identifier">new</span>
|
614
|
+
<span class="ruby-identifier">axis_order</span>.<span class="ruby-identifier">pos</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">NArray</span>.<span class="ruby-identifier">sint</span>(<span class="ruby-identifier">nmodes</span>).<span class="ruby-identifier">indgen</span>(<span class="ruby-value">1</span>),
|
615
|
+
{}, <span class="ruby-string">"mode"</span>)
|
616
|
+
<span class="ruby-identifier">axes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">axis_order</span>
|
617
|
+
<span class="ruby-identifier">new_grid</span> = <span class="ruby-constant">Grid</span>.<span class="ruby-identifier">new</span>(*<span class="ruby-identifier">axes</span>)
|
618
|
+
<span class="ruby-identifier">vec</span> <span class="ruby-operator">/=</span> <span class="ruby-identifier">w</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">w</span>
|
619
|
+
<span class="ruby-identifier">vec</span>.<span class="ruby-identifier">reshape!</span>(*<span class="ruby-identifier">new_grid</span>.<span class="ruby-identifier">shape</span>)
|
620
|
+
<span class="ruby-identifier">vec</span> <span class="ruby-operator">*=</span> <span class="ruby-constant">NMath</span><span class="ruby-operator">::</span><span class="ruby-identifier">sqrt</span>( <span class="ruby-identifier">val</span>.<span class="ruby-identifier">reshape</span>( *([<span class="ruby-value">1</span>]*(<span class="ruby-identifier">axes</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)<span class="ruby-operator">+</span>[<span class="ruby-identifier">nmodes</span>]) ) )
|
621
|
+
<span class="ruby-identifier">va_eof</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">vec</span>,
|
622
|
+
{<span class="ruby-string">"long_name"</span>=<span class="ruby-operator">></span><span class="ruby-string">"EOF vector"</span>,<span class="ruby-string">"units"</span>=<span class="ruby-operator">></span><span class="ruby-identifier">gphys</span>.<span class="ruby-identifier">units</span>.<span class="ruby-identifier">to_s</span> },
|
623
|
+
<span class="ruby-string">"EOF"</span>)
|
624
|
+
<span class="ruby-identifier">eof</span> = <span class="ruby-constant">GPhys</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">new_grid</span>, <span class="ruby-identifier">va_eof</span>)
|
625
|
+
|
626
|
+
<span class="ruby-identifier">va_rate</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">val</span>.<span class="ruby-identifier">div!</span>(<span class="ruby-identifier">total_var</span>),
|
627
|
+
{<span class="ruby-string">"long_name"</span>=<span class="ruby-operator">></span><span class="ruby-string">"EOF contribution rate"</span>, <span class="ruby-string">"units"</span>=<span class="ruby-operator">></span><span class="ruby-string">"1"</span> },
|
628
|
+
<span class="ruby-string">"rate"</span>)
|
629
|
+
<span class="ruby-identifier">rate</span> = <span class="ruby-constant">GPhys</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Grid</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">axis_order</span>), <span class="ruby-identifier">va_rate</span>)
|
630
|
+
|
631
|
+
<span class="ruby-keyword">return</span> [<span class="ruby-identifier">eof</span>, <span class="ruby-identifier">rate</span>]
|
632
|
+
<span class="ruby-keyword">end</span></pre>
|
633
|
+
</div><!-- eof-source -->
|
634
|
+
|
635
|
+
</div>
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
</div><!-- eof-method -->
|
641
|
+
|
642
|
+
|
643
|
+
<div id="eof2-method" class="method-detail ">
|
644
|
+
<a name="method-i-eof2"></a>
|
645
|
+
|
646
|
+
|
647
|
+
<div class="method-heading">
|
648
|
+
<span class="method-name">eof2</span><span
|
649
|
+
class="method-args">(gphys1, gphys2, *args)</span>
|
650
|
+
<span class="method-click-advice">click to toggle source</span>
|
651
|
+
</div>
|
652
|
+
|
653
|
+
|
654
|
+
<div class="method-description">
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
<div class="method-source-code" id="eof2-source">
|
661
|
+
<pre>
|
662
|
+
<span class="ruby-comment"># File ../../lib/numru/ganalysis/eof.rb, line 209</span>
|
663
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eof2</span>(<span class="ruby-identifier">gphys1</span>, <span class="ruby-identifier">gphys2</span>, *<span class="ruby-identifier">args</span>)
|
664
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">-1</span>]
|
665
|
+
<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">-1</span>]
|
666
|
+
<span class="ruby-keyword">else</span>
|
667
|
+
<span class="ruby-identifier">opts</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
668
|
+
<span class="ruby-keyword">end</span>
|
669
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"The 1st arg must be a GPhys of rank 1: arg1 = #{gphys1.inspect}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">rank</span><span class="ruby-operator">==</span><span class="ruby-value">1</span>
|
670
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"The 2nd arg must be a GPhys of rank 1: arg2 = #{gphys2.inspect}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">gphys2</span>.<span class="ruby-identifier">rank</span><span class="ruby-operator">==</span><span class="ruby-value">1</span>
|
671
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"The 1st and 2nd args must have the same length: #{gphys1.length}!=#{gphys2.length}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">gphys2</span>.<span class="ruby-identifier">rank</span><span class="ruby-operator">==</span><span class="ruby-value">1</span>
|
672
|
+
<span class="ruby-identifier">nam</span> = <span class="ruby-constant">NArrayMiss</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">typecode</span>, <span class="ruby-value">2</span>, <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">length</span>)
|
673
|
+
<span class="ruby-identifier">nam</span>[<span class="ruby-value">0</span>,<span class="ruby-keyword">true</span>] = <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">val</span>
|
674
|
+
<span class="ruby-identifier">nam</span>[<span class="ruby-value">1</span>,<span class="ruby-keyword">true</span>] = <span class="ruby-identifier">gphys2</span>.<span class="ruby-identifier">val</span>
|
675
|
+
<span class="ruby-identifier">gphys</span> = <span class="ruby-constant">GPhys</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Grid</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Axis</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">set_pos</span>(<span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">NArray</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>],{},<span class="ruby-string">"var"</span>)),
|
676
|
+
<span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">axis</span>(<span class="ruby-value">0</span>)),
|
677
|
+
<span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nam</span>,<span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">data</span>.<span class="ruby-identifier">attr_copy</span>,<span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">name</span>))
|
678
|
+
<span class="ruby-identifier">eof</span>(<span class="ruby-identifier">gphys</span>, <span class="ruby-value">1</span>, <span class="ruby-identifier">opts</span>)
|
679
|
+
<span class="ruby-keyword">end</span></pre>
|
680
|
+
</div><!-- eof2-source -->
|
681
|
+
|
682
|
+
</div>
|
683
|
+
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
</div><!-- eof2-method -->
|
688
|
+
|
689
|
+
|
690
|
+
<div id="histogram-method" class="method-detail ">
|
691
|
+
<a name="method-i-histogram"></a>
|
692
|
+
|
693
|
+
|
694
|
+
<div class="method-heading">
|
695
|
+
<span class="method-name">histogram</span><span
|
696
|
+
class="method-args">(gphys0,opts=Hash.new)</span>
|
697
|
+
<span class="method-click-advice">click to toggle source</span>
|
698
|
+
</div>
|
699
|
+
|
700
|
+
|
701
|
+
<div class="method-description">
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
|
706
|
+
|
707
|
+
<div class="method-source-code" id="histogram-source">
|
708
|
+
<pre>
|
709
|
+
<span class="ruby-comment"># File ../../lib/numru/ganalysis/histogram.rb, line 15</span>
|
710
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">histogram</span>(<span class="ruby-identifier">gphys0</span>,<span class="ruby-identifier">opts</span>=<span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>)
|
711
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">HistogramGSL</span>
|
712
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"gsl is necessary to use this method"</span>
|
713
|
+
<span class="ruby-keyword">end</span>
|
714
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">GPhys</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">gphys0</span>
|
715
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"gphys0 (1st arg) must be GPhys"</span>
|
716
|
+
<span class="ruby-keyword">end</span>
|
717
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">opts</span>
|
718
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"opts (2nd arg) must be Hash"</span>
|
719
|
+
<span class="ruby-keyword">end</span>
|
720
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-string">"bins"</span>]
|
721
|
+
<span class="ruby-identifier">bins</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"bins"</span>]
|
722
|
+
<span class="ruby-keyword">unless</span> (<span class="ruby-identifier">bins</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArray</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">bins</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>))
|
723
|
+
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">TypeError</span>, <span class="ruby-string">"option 'bins' must be Array or NArray"</span>)
|
724
|
+
<span class="ruby-keyword">end</span>
|
725
|
+
<span class="ruby-identifier">bins</span> = <span class="ruby-identifier">bins</span>.<span class="ruby-identifier">to_gslv</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">bins</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NArray</span>)
|
726
|
+
<span class="ruby-identifier">hist</span> = <span class="ruby-constant">GSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Histogram</span>.<span class="ruby-identifier">alloc</span>(<span class="ruby-identifier">bins</span>)
|
727
|
+
<span class="ruby-keyword">else</span>
|
728
|
+
<span class="ruby-identifier">nbins</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"nbins"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">total</span><span class="ruby-operator">/</span><span class="ruby-value">500</span>
|
729
|
+
<span class="ruby-identifier">nbins</span> = <span class="ruby-value">10</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">nbins</span> <span class="ruby-operator"><</span> <span class="ruby-value">10</span>
|
730
|
+
<span class="ruby-identifier">min</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"min"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">min</span>.<span class="ruby-identifier">val</span>
|
731
|
+
<span class="ruby-identifier">max</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"max"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">max</span>.<span class="ruby-identifier">val</span>
|
732
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">log_bins</span> = (<span class="ruby-identifier">opts</span>[<span class="ruby-string">"log_bins"</span>] <span class="ruby-operator">&&</span> (<span class="ruby-identifier">min</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>))
|
733
|
+
<span class="ruby-identifier">min</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log10</span>(<span class="ruby-identifier">min</span>)
|
734
|
+
<span class="ruby-identifier">max</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log10</span>(<span class="ruby-identifier">max</span>)
|
735
|
+
<span class="ruby-keyword">end</span>
|
736
|
+
<span class="ruby-identifier">hist</span> = <span class="ruby-constant">GSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Histogram</span>.<span class="ruby-identifier">alloc</span>(<span class="ruby-identifier">nbins</span>,[<span class="ruby-identifier">min</span>,<span class="ruby-identifier">max</span>])
|
737
|
+
<span class="ruby-keyword">end</span>
|
738
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">val</span>
|
739
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span>.<span class="ruby-identifier">get_array!</span>[<span class="ruby-identifier">val</span>.<span class="ruby-identifier">get_mask!</span>] <span class="ruby-keyword">if</span> <span class="ruby-constant">NArrayMiss</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">val</span>
|
740
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-constant">NMath</span>.<span class="ruby-identifier">log10</span>(<span class="ruby-identifier">val</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">log_bins</span>
|
741
|
+
<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">increment</span>(<span class="ruby-identifier">val</span>)
|
742
|
+
|
743
|
+
<span class="ruby-identifier">bounds</span> = <span class="ruby-identifier">hist</span>.<span class="ruby-identifier">range</span>.<span class="ruby-identifier">to_na</span>
|
744
|
+
<span class="ruby-identifier">bounds</span> = <span class="ruby-value">10</span> <span class="ruby-operator">**</span> <span class="ruby-identifier">bounds</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">log_bins</span>
|
745
|
+
<span class="ruby-identifier">center</span> = (<span class="ruby-identifier">bounds</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">bounds</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])<span class="ruby-operator">/</span><span class="ruby-value">2</span>
|
746
|
+
<span class="ruby-identifier">cell_width</span> = (<span class="ruby-identifier">bounds</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">-</span> <span class="ruby-identifier">bounds</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]) <span class="ruby-operator">/</span> <span class="ruby-value">2</span>
|
747
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">name</span>
|
748
|
+
<span class="ruby-identifier">attr</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">data</span>.<span class="ruby-identifier">attr_copy</span>
|
749
|
+
<span class="ruby-identifier">bounds</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bounds</span>, <span class="ruby-identifier">attr</span>, <span class="ruby-identifier">name</span>)
|
750
|
+
<span class="ruby-identifier">center</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">center</span>, <span class="ruby-identifier">attr</span>, <span class="ruby-identifier">name</span>)
|
751
|
+
<span class="ruby-identifier">axis</span> = <span class="ruby-constant">Axis</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">true</span>)
|
752
|
+
<span class="ruby-identifier">axis</span>.<span class="ruby-identifier">set_cell</span>(<span class="ruby-identifier">center</span>, <span class="ruby-identifier">bounds</span>, <span class="ruby-identifier">name</span>)
|
753
|
+
<span class="ruby-identifier">axis</span>.<span class="ruby-identifier">set_pos_to_center</span>
|
754
|
+
|
755
|
+
<span class="ruby-identifier">bin</span> = <span class="ruby-identifier">hist</span>.<span class="ruby-identifier">bin</span>.<span class="ruby-identifier">to_na</span>
|
756
|
+
<span class="ruby-identifier">bin</span> <span class="ruby-operator">/=</span> <span class="ruby-identifier">cell_width</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-string">"log_bins"</span>]
|
757
|
+
<span class="ruby-identifier">bin</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bin</span>,
|
758
|
+
{<span class="ruby-string">"long_name"</span> =<span class="ruby-operator">></span> (<span class="ruby-identifier">log_bins</span> <span class="ruby-operator">?</span> <span class="ruby-string">"number per unit bin width"</span> <span class="ruby-operator">:</span> <span class="ruby-string">"number in bins"</span>), <span class="ruby-string">"units"</span>=<span class="ruby-operator">></span><span class="ruby-string">"1"</span>},
|
759
|
+
<span class="ruby-string">"bin"</span>)
|
760
|
+
<span class="ruby-identifier">new_gphys</span> = <span class="ruby-constant">GPhys</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Grid</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">axis</span>), <span class="ruby-identifier">bin</span>)
|
761
|
+
<span class="ruby-identifier">new_gphys</span>.<span class="ruby-identifier">set_att</span>(<span class="ruby-string">"mean"</span>,[<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">mean</span>])
|
762
|
+
<span class="ruby-identifier">new_gphys</span>.<span class="ruby-identifier">set_att</span>(<span class="ruby-string">"standard_deviation"</span>,[<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">sigma</span>])
|
763
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">new_gphys</span>
|
764
|
+
<span class="ruby-keyword">end</span></pre>
|
765
|
+
</div><!-- histogram-source -->
|
766
|
+
|
767
|
+
</div>
|
768
|
+
|
769
|
+
|
770
|
+
<div class="aliases">
|
771
|
+
Also aliased as: <a href="GAnalysis.html#method-i-histogram1D">histogram1D</a>
|
772
|
+
</div>
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
</div><!-- histogram-method -->
|
777
|
+
|
778
|
+
|
779
|
+
<div id="histogram1D-method" class="method-detail method-alias">
|
780
|
+
<a name="method-i-histogram1D"></a>
|
781
|
+
|
782
|
+
|
783
|
+
<div class="method-heading">
|
784
|
+
<span class="method-name">histogram1D</span><span
|
785
|
+
class="method-args">(gphys0,opts=Hash.new)</span>
|
786
|
+
<span class="method-click-advice">click to toggle source</span>
|
787
|
+
</div>
|
788
|
+
|
789
|
+
|
790
|
+
<div class="method-description">
|
791
|
+
|
792
|
+
|
793
|
+
|
794
|
+
|
795
|
+
|
796
|
+
</div>
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
<div class="aliases">
|
802
|
+
Alias for: <a href="GAnalysis.html#method-i-histogram">histogram</a>
|
803
|
+
</div>
|
804
|
+
|
805
|
+
</div><!-- histogram1D-method -->
|
806
|
+
|
807
|
+
|
808
|
+
<div id="histogram2D-method" class="method-detail ">
|
809
|
+
<a name="method-i-histogram2D"></a>
|
810
|
+
|
811
|
+
|
812
|
+
<div class="method-heading">
|
813
|
+
<span class="method-name">histogram2D</span><span
|
814
|
+
class="method-args">(gphys0, gphys1, opts=Hash.new)</span>
|
815
|
+
<span class="method-click-advice">click to toggle source</span>
|
816
|
+
</div>
|
817
|
+
|
818
|
+
|
819
|
+
<div class="method-description">
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
|
825
|
+
<div class="method-source-code" id="histogram2D-source">
|
826
|
+
<pre>
|
827
|
+
<span class="ruby-comment"># File ../../lib/numru/ganalysis/histogram.rb, line 72</span>
|
828
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">histogram2D</span>(<span class="ruby-identifier">gphys0</span>, <span class="ruby-identifier">gphys1</span>, <span class="ruby-identifier">opts</span>=<span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>)
|
829
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">HistogramGSL</span>
|
830
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"gsl is necessary to use this method"</span>
|
831
|
+
<span class="ruby-keyword">end</span>
|
832
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">GPhys</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">gphys0</span>
|
833
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"gphys0 (1st arg) must be GPhys"</span>
|
834
|
+
<span class="ruby-keyword">end</span>
|
835
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">GPhys</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">gphys1</span>
|
836
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"gphys1 (2nd arg) must be GPhys"</span>
|
837
|
+
<span class="ruby-keyword">end</span>
|
838
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">opts</span>
|
839
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"opts (3nd arg) must be Hash"</span>
|
840
|
+
<span class="ruby-keyword">end</span>
|
841
|
+
|
842
|
+
<span class="ruby-identifier">nbins0</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"nbins0"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">total</span><span class="ruby-operator">/</span><span class="ruby-value">500</span>
|
843
|
+
<span class="ruby-identifier">nbins0</span> = <span class="ruby-value">10</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">nbins0</span> <span class="ruby-operator"><</span> <span class="ruby-value">10</span>
|
844
|
+
<span class="ruby-identifier">nbins1</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"nbins1"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">total</span><span class="ruby-operator">/</span><span class="ruby-value">500</span>
|
845
|
+
<span class="ruby-identifier">nbins1</span> = <span class="ruby-value">10</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">nbins1</span> <span class="ruby-operator"><</span> <span class="ruby-value">10</span>
|
846
|
+
|
847
|
+
<span class="ruby-identifier">min0</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"min0"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">min</span>.<span class="ruby-identifier">val</span>
|
848
|
+
<span class="ruby-identifier">max0</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"max0"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">max</span>.<span class="ruby-identifier">val</span>
|
849
|
+
<span class="ruby-identifier">min1</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"min1"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">min</span>.<span class="ruby-identifier">val</span>
|
850
|
+
<span class="ruby-identifier">max1</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-string">"max1"</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">max</span>.<span class="ruby-identifier">val</span>
|
851
|
+
|
852
|
+
<span class="ruby-identifier">hist</span> = <span class="ruby-constant">GSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Histogram2d</span>.<span class="ruby-identifier">alloc</span>(<span class="ruby-identifier">nbins0</span>,[<span class="ruby-identifier">min0</span>,<span class="ruby-identifier">max0</span>],<span class="ruby-identifier">nbins1</span>,[<span class="ruby-identifier">min1</span>,<span class="ruby-identifier">max1</span>])
|
853
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">val</span>
|
854
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">val</span>
|
855
|
+
<span class="ruby-identifier">mask</span> = <span class="ruby-keyword">nil</span>
|
856
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">NArrayMiss</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">val0</span>
|
857
|
+
<span class="ruby-identifier">mask</span> = <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">get_mask!</span>
|
858
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-identifier">val0</span>.<span class="ruby-identifier">get_array!</span>
|
859
|
+
<span class="ruby-keyword">end</span>
|
860
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">NArrayMiss</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">val1</span>
|
861
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">mask</span>
|
862
|
+
<span class="ruby-identifier">mask</span> = <span class="ruby-identifier">mask</span> & <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">get_mask!</span>
|
863
|
+
<span class="ruby-keyword">else</span>
|
864
|
+
<span class="ruby-identifier">mask</span> = <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">get_mask!</span>
|
865
|
+
<span class="ruby-keyword">end</span>
|
866
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">get_array!</span>
|
867
|
+
<span class="ruby-keyword">end</span>
|
868
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">mask</span>
|
869
|
+
<span class="ruby-identifier">val0</span> = <span class="ruby-identifier">val0</span>[<span class="ruby-identifier">mask</span>]
|
870
|
+
<span class="ruby-identifier">val1</span> = <span class="ruby-identifier">val1</span>[<span class="ruby-identifier">mask</span>]
|
871
|
+
<span class="ruby-keyword">end</span>
|
872
|
+
<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">increment</span>(<span class="ruby-identifier">val0</span>.<span class="ruby-identifier">to_gslv</span>, <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">to_gslv</span>)
|
873
|
+
|
874
|
+
<span class="ruby-identifier">bounds0</span> = <span class="ruby-identifier">hist</span>.<span class="ruby-identifier">xrange</span>.<span class="ruby-identifier">to_na</span>
|
875
|
+
<span class="ruby-identifier">center0</span> = (<span class="ruby-identifier">bounds0</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">bounds0</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])<span class="ruby-operator">/</span><span class="ruby-value">2</span>
|
876
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">name</span>
|
877
|
+
<span class="ruby-identifier">attr</span> = <span class="ruby-identifier">gphys0</span>.<span class="ruby-identifier">data</span>.<span class="ruby-identifier">attr_copy</span>
|
878
|
+
<span class="ruby-identifier">bounds0</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bounds0</span>, <span class="ruby-identifier">attr</span>, <span class="ruby-identifier">name</span>)
|
879
|
+
<span class="ruby-identifier">center0</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">center0</span>, <span class="ruby-identifier">attr</span>, <span class="ruby-identifier">name</span>)
|
880
|
+
<span class="ruby-identifier">axis0</span> = <span class="ruby-constant">Axis</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">true</span>)
|
881
|
+
<span class="ruby-identifier">axis0</span>.<span class="ruby-identifier">set_cell</span>(<span class="ruby-identifier">center0</span>, <span class="ruby-identifier">bounds0</span>, <span class="ruby-identifier">name</span>)
|
882
|
+
<span class="ruby-identifier">axis0</span>.<span class="ruby-identifier">set_pos_to_center</span>
|
883
|
+
|
884
|
+
<span class="ruby-identifier">bounds1</span> = <span class="ruby-identifier">hist</span>.<span class="ruby-identifier">yrange</span>.<span class="ruby-identifier">to_na</span>
|
885
|
+
<span class="ruby-identifier">center1</span> = (<span class="ruby-identifier">bounds1</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">bounds1</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])<span class="ruby-operator">/</span><span class="ruby-value">2</span>
|
886
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">name</span>
|
887
|
+
<span class="ruby-identifier">attr</span> = <span class="ruby-identifier">gphys1</span>.<span class="ruby-identifier">data</span>.<span class="ruby-identifier">attr_copy</span>
|
888
|
+
<span class="ruby-identifier">bounds1</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bounds1</span>, <span class="ruby-identifier">attr</span>, <span class="ruby-identifier">name</span>)
|
889
|
+
<span class="ruby-identifier">center1</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">center1</span>, <span class="ruby-identifier">attr</span>, <span class="ruby-identifier">name</span>)
|
890
|
+
<span class="ruby-identifier">axis1</span> = <span class="ruby-constant">Axis</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">true</span>)
|
891
|
+
<span class="ruby-identifier">axis1</span>.<span class="ruby-identifier">set_cell</span>(<span class="ruby-identifier">center1</span>, <span class="ruby-identifier">bounds1</span>, <span class="ruby-identifier">name</span>)
|
892
|
+
<span class="ruby-identifier">axis1</span>.<span class="ruby-identifier">set_pos_to_center</span>
|
893
|
+
|
894
|
+
<span class="ruby-identifier">bin</span> = <span class="ruby-identifier">hist</span>.<span class="ruby-identifier">bin</span>.<span class="ruby-identifier">to_na</span>.<span class="ruby-identifier">reshape!</span>(<span class="ruby-identifier">nbins1</span>,<span class="ruby-identifier">nbins0</span>).<span class="ruby-identifier">transpose</span>(<span class="ruby-value">1</span>,<span class="ruby-value">0</span>)
|
895
|
+
<span class="ruby-identifier">bin</span> = <span class="ruby-constant">VArray</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bin</span>,
|
896
|
+
{<span class="ruby-string">"long_name"</span>=<span class="ruby-operator">></span><span class="ruby-string">"number in bins"</span>, <span class="ruby-string">"units"</span>=<span class="ruby-operator">></span><span class="ruby-string">"1"</span>},
|
897
|
+
<span class="ruby-string">"bin"</span>)
|
898
|
+
<span class="ruby-identifier">new_gphys</span> = <span class="ruby-constant">GPhys</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Grid</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">axis0</span>,<span class="ruby-identifier">axis1</span>), <span class="ruby-identifier">bin</span>)
|
899
|
+
<span class="ruby-identifier">new_gphys</span>.<span class="ruby-identifier">set_att</span>(<span class="ruby-string">"mean0"</span>,[<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">xmean</span>])
|
900
|
+
<span class="ruby-identifier">new_gphys</span>.<span class="ruby-identifier">set_att</span>(<span class="ruby-string">"standard_deviation0"</span>,[<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">xsigma</span>])
|
901
|
+
<span class="ruby-identifier">new_gphys</span>.<span class="ruby-identifier">set_att</span>(<span class="ruby-string">"mean1"</span>,[<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">ymean</span>])
|
902
|
+
<span class="ruby-identifier">new_gphys</span>.<span class="ruby-identifier">set_att</span>(<span class="ruby-string">"standard_deviation1"</span>,[<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">ysigma</span>])
|
903
|
+
<span class="ruby-identifier">new_gphys</span>.<span class="ruby-identifier">set_att</span>(<span class="ruby-string">"covariance"</span>,[<span class="ruby-identifier">hist</span>.<span class="ruby-identifier">cov</span>])
|
904
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">new_gphys</span>
|
905
|
+
<span class="ruby-keyword">end</span></pre>
|
906
|
+
</div><!-- histogram2D-source -->
|
907
|
+
|
908
|
+
</div>
|
909
|
+
|
910
|
+
|
911
|
+
|
912
|
+
|
913
|
+
</div><!-- histogram2D-method -->
|
914
|
+
|
915
|
+
|
916
|
+
</div><!-- public-instance-method-details -->
|
917
|
+
|
918
|
+
</div><!-- 5Buntitled-5D -->
|
919
|
+
|
920
|
+
|
921
|
+
</div><!-- documentation -->
|
922
|
+
|
923
|
+
<div id="validator-badges">
|
924
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
925
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
926
|
+
Rdoc Generator</a> 2</small>.</p>
|
927
|
+
</div>
|
928
|
+
|
929
|
+
</body>
|
930
|
+
</html>
|
931
|
+
|