Introduction |
|
1 | (1) |
Introduction to Data Analysis and Why This Book Is Special |
|
1 | (1) |
Who Is This Book for |
|
2 | (1) |
|
1 Jython, Java and jHep Work |
|
|
3 | (24) |
|
|
3 | (4) |
|
1.1.1 Books You May Read Before |
|
|
4 | (1) |
|
1.1.2 Yes, It Is Pure Java |
|
|
4 | (1) |
|
|
5 | (2) |
|
|
7 | (1) |
|
1.2 Introduction to Scientific Computing |
|
|
7 | (6) |
|
1.2.1 Book Examples and the Power of Jython |
|
|
7 | (1) |
|
1.2.2 The History of jHepWork |
|
|
8 | (1) |
|
|
9 | (1) |
|
1.2.4 Differences with Other Data-analysis Packages |
|
|
10 | (1) |
|
|
11 | (1) |
|
1.2.6 Jython and CPython Versions |
|
|
12 | (1) |
|
|
13 | (1) |
|
1.4 Introduction to the jHepWork IDE |
|
|
14 | (9) |
|
|
15 | (1) |
|
1.4.2 jHepWork Java Libraries and Python Packages |
|
|
15 | (2) |
|
1.4.3 Jython and Bean Shell Consoles |
|
|
17 | (2) |
|
1.4.4 Accessing Methods of Instances |
|
|
19 | (1) |
|
1.4.5 Editing Jython Scripts |
|
|
19 | (1) |
|
1.4.6 Running Jython Scripts |
|
|
19 | (1) |
|
1.4.7 Running a BeanShell Scripts |
|
|
20 | (1) |
|
1.4.8 Compiling and Running Java Code |
|
|
20 | (1) |
|
1.4.9 Working with Command-line Scripts |
|
|
21 | (1) |
|
1.4.10 jHepWork Code Assist |
|
|
21 | (1) |
|
|
22 | (1) |
|
1.5 Third-party Packages and the License |
|
|
23 | (4) |
|
1.5.1 Contributions and Third-party Packages |
|
|
23 | (2) |
|
1.5.2 Disclaimer of Warranty |
|
|
25 | (1) |
|
|
25 | (1) |
|
|
26 | (1) |
|
|
27 | (58) |
|
2.1 Code Structure and Commentary |
|
|
27 | (1) |
|
2.2 Quick Introduction to Jython Objects |
|
|
28 | (6) |
|
|
31 | (1) |
|
|
32 | (1) |
|
2.2.3 Mathematical Functions |
|
|
33 | (1) |
|
|
34 | (1) |
|
|
34 | (1) |
|
|
35 | (2) |
|
2.4.1 Executing Native Applications |
|
|
36 | (1) |
|
2.5 Comparison Tests and Loops |
|
|
37 | (3) |
|
2.5.1 The `if-else' Statement |
|
|
37 | (1) |
|
2.5.2 Loops. The "for" Statement |
|
|
38 | (1) |
|
2.5.3 The `continue' and `break' Statements |
|
|
39 | (1) |
|
2.5.4 Loops. The `while' Statement |
|
|
39 | (1) |
|
|
40 | (10) |
|
|
40 | (1) |
|
|
41 | (1) |
|
2.6.3 Iteration over Elements |
|
|
42 | (1) |
|
2.6.4 Removal of Duplicates |
|
|
43 | (2) |
|
|
45 | (1) |
|
2.6.6 Functional Programming. Operations with Lists |
|
|
46 | (2) |
|
|
48 | (2) |
|
2.7 Java Collections in Jython |
|
|
50 | (7) |
|
2.7.1 List. An Ordered Collection |
|
|
50 | (3) |
|
2.7.2 Set. A Collection Without Duplicate Elements |
|
|
53 | (1) |
|
2.7.3 SortedSet. Sorted Unique Elements |
|
|
54 | (1) |
|
2.7.4 Map. Mapping Keys to Values |
|
|
55 | (1) |
|
2.7.5 Java Map with Sorted Elements |
|
|
55 | (1) |
|
2.7.6 Real Life Example: Sorting and Removing Duplicates |
|
|
56 | (1) |
|
|
57 | (1) |
|
|
58 | (2) |
|
|
59 | (1) |
|
2.10 Python Functions and Modules |
|
|
60 | (3) |
|
|
63 | (4) |
|
2.11.1 Initializing a Class |
|
|
65 | (1) |
|
2.11.2 Classes Inherited from Other Classes |
|
|
66 | (1) |
|
2.11.3 Java Classes in Jython |
|
|
66 | (1) |
|
2.11.4 Topics Not Covered |
|
|
67 | (1) |
|
|
67 | (1) |
|
2.13 Parallel Computing and Threads |
|
|
67 | (1) |
|
|
68 | (3) |
|
2.14.1 Array Conversion and Transformations |
|
|
70 | (1) |
|
2.14.2 Performance Issues |
|
|
70 | (1) |
|
2.15 Exceptions in Python |
|
|
71 | (1) |
|
|
72 | (8) |
|
|
72 | (1) |
|
2.16.2 Reading and Writing Files |
|
|
72 | (2) |
|
2.16.3 Input and Output for Arrays |
|
|
74 | (1) |
|
2.16.4 Working with CSV Python Module |
|
|
75 | (2) |
|
2.16.5 Saving Objects in a Serialized File |
|
|
77 | (1) |
|
2.16.6 Storing Multiple Objects |
|
|
77 | (1) |
|
2.16.7 Using Java for I/O |
|
|
78 | (1) |
|
2.16.8 Reading Data from the Network |
|
|
79 | (1) |
|
2.17 Real-life Example. Collecting Data Files |
|
|
80 | (3) |
|
2.18 Using Java for GUI Programming |
|
|
83 | (1) |
|
|
84 | (1) |
|
|
84 | (1) |
|
|
85 | (36) |
|
|
85 | (2) |
|
3.2 1D Functions in jHepWork |
|
|
87 | (4) |
|
3.2.1 Details of Java Implementation |
|
|
89 | (1) |
|
3.2.2 Integration and Differentiation |
|
|
90 | (1) |
|
3.3 Plotting 1D Functions |
|
|
91 | (9) |
|
3.3.1 Building a Graphical Canvas |
|
|
92 | (3) |
|
3.3.2 Drawing 1D Functions |
|
|
95 | (2) |
|
3.3.3 Plotting 1D Functions on Different Pads |
|
|
97 | (1) |
|
3.3.4 Short Summary of HPlot Methods |
|
|
98 | (1) |
|
|
98 | (2) |
|
|
100 | (5) |
|
3.4.1 Functions in Two Dimensions |
|
|
100 | (1) |
|
3.4.2 Displaying 2D Functions on a Lego Plot |
|
|
101 | (3) |
|
3.4.3 Using a Contour Plot |
|
|
104 | (1) |
|
|
105 | (1) |
|
3.5.1 Functions in Three Dimensions |
|
|
105 | (1) |
|
3.6 Functions in Many Dimensions |
|
|
105 | (2) |
|
|
105 | (1) |
|
3.6.2 Drawing FND Functions |
|
|
106 | (1) |
|
3.7 Custom Functions Defined by Jython Scripts |
|
|
107 | (6) |
|
3.7.1 Custom Functions and Their Methods |
|
|
107 | (3) |
|
3.7.2 Using External Libraries |
|
|
110 | (1) |
|
3.7.3 Plotting Custom Functions |
|
|
111 | (2) |
|
3.8 Parametric Surfaces in 3D |
|
|
113 | (3) |
|
|
113 | (3) |
|
3.8.2 3D Mathematical Objects |
|
|
116 | (1) |
|
3.9 Symbolic Calculations |
|
|
116 | (3) |
|
3.10 File Input and Output |
|
|
119 | (2) |
|
|
120 | (1) |
|
|
121 | (14) |
|
4.1 One Dimensional Arrays |
|
|
121 | (1) |
|
|
122 | (8) |
|
4.2.1 POD Transformations |
|
|
125 | (1) |
|
4.2.2 Analyzing POD and Summary Statistics |
|
|
126 | (2) |
|
4.2.3 Displaying POD Data |
|
|
128 | (2) |
|
4.3 Reading and Writing POD Files |
|
|
130 | (5) |
|
|
131 | (1) |
|
|
131 | (2) |
|
4.3.3 Dealing with Object Collections |
|
|
133 | (2) |
|
|
135 | (26) |
|
5.1 Two Dimensional Data Structures |
|
|
135 | (1) |
|
5.2 Two Dimensional Data with Errors |
|
|
136 | (9) |
|
|
140 | (2) |
|
|
142 | (2) |
|
|
144 | (1) |
|
5.3 Manipulations with P1D Data |
|
|
145 | (6) |
|
5.3.1 Advanced P1D Operations |
|
|
146 | (2) |
|
5.3.2 Weighted Average and Systematical Uncertainties |
|
|
148 | (3) |
|
5.4 Reading and Writing P1D Data |
|
|
151 | (3) |
|
5.4.1 Dealing with a Single P1D Container |
|
|
151 | (2) |
|
5.4.2 Reading and Writing Collections |
|
|
153 | (1) |
|
5.5 Real-life Example I: Henon Attractor |
|
|
154 | (1) |
|
5.6 Real-life Example II. Weighted Average |
|
|
155 | (6) |
|
|
159 | (2) |
|
|
161 | (10) |
|
|
161 | (3) |
|
6.1.1 Drawing P2D and HP1ot3D Canvas |
|
|
161 | (3) |
|
|
164 | (2) |
|
|
166 | (3) |
|
6.3.1 Operations with PND Data |
|
|
167 | (2) |
|
|
169 | (2) |
|
7 Arrays, Matrices and Linear Algebra |
|
|
171 | (22) |
|
7.1 Jaida Data Containers |
|
|
171 | (3) |
|
|
172 | (2) |
|
7.2 jMathTools Arrays and Operations |
|
|
174 | (3) |
|
7.2.1 1D Arrays and Operations |
|
|
174 | (2) |
|
|
176 | (1) |
|
|
177 | (1) |
|
7.4 Statistical Analysis Using Jython |
|
|
178 | (3) |
|
|
181 | (8) |
|
7.5.1 Basic Matrix Arithmetic |
|
|
183 | (1) |
|
7.5.2 Elements of Linear Algebra |
|
|
184 | (1) |
|
7.5.3 Jampack Matrix Computations and Complex Matrices |
|
|
185 | (1) |
|
7.5.4 Jython Vector and Matrix Operations |
|
|
186 | (2) |
|
7.5.5 Matrix Operations in SymPy |
|
|
188 | (1) |
|
7.6 Lorentz Vector and Particle Representations |
|
|
189 | (4) |
|
7.6.1 Three-vector and Lorentz Vector |
|
|
189 | (2) |
|
7.6.2 Classes Representing Particles |
|
|
191 | (1) |
|
|
192 | (1) |
|
|
193 | (30) |
|
8.1 One-dimensional Histogram |
|
|
193 | (12) |
|
8.1.1 Probability Distribution and Probability Density |
|
|
198 | (1) |
|
8.1.2 Histogram Characteristics |
|
|
198 | (1) |
|
8.1.3 Histogram Initialization and Filling Methods |
|
|
199 | (2) |
|
8.1.4 Accessing Histogram Values |
|
|
201 | (1) |
|
|
201 | (2) |
|
8.1.6 Histogram Operations |
|
|
203 | (1) |
|
8.1.7 Accessing Low-level Jaida Classes |
|
|
204 | (1) |
|
8.1.8 Graphical Attributes |
|
|
205 | (1) |
|
|
205 | (7) |
|
8.2.1 Histogram Operations |
|
|
207 | (2) |
|
8.2.2 Graphical Representation |
|
|
209 | (3) |
|
|
212 | (2) |
|
|
214 | (1) |
|
|
214 | (3) |
|
8.5.1 Profile Histograms in 1D |
|
|
215 | (1) |
|
8.5.2 Profile Histograms in 2D |
|
|
215 | (2) |
|
8.6 Histogram Input and Output |
|
|
217 | (3) |
|
8.6.1 External Programs for Histograms |
|
|
218 | (2) |
|
8.7 Real-life Example. Analyzing Histograms from Multiple Files |
|
|
220 | (3) |
|
|
221 | (2) |
|
9 Random Numbers and Statistical Samples |
|
|
223 | (12) |
|
9.1 Random Numbers in Jython |
|
|
223 | (2) |
|
9.2 Random Numbers in Java |
|
|
225 | (1) |
|
9.3 Random Numbers from the Colt Package |
|
|
226 | (1) |
|
9.4 Random Numbers from the jhplot.math Package |
|
|
227 | (2) |
|
9.4.1 Apache Common Math Package |
|
|
229 | (1) |
|
|
229 | (4) |
|
9.5.1 Methods for 1D Arrays from jhplot.math |
|
|
230 | (2) |
|
9.5.2 Methods for 2D Arrays from jhplot.math |
|
|
232 | (1) |
|
9.6 Sampling Using the Colt Package |
|
|
233 | (2) |
|
|
233 | (2) |
|
|
235 | (38) |
|
|
236 | (2) |
|
10.2 Working with the HPlot Canvas |
|
|
238 | (6) |
|
10.2.1 Find USER or NDC Coordinators |
|
|
238 | (1) |
|
10.2.2 Zoom in to a Certain Region |
|
|
238 | (1) |
|
10.2.3 How to Change Titles, Legends and Labels |
|
|
238 | (1) |
|
10.2.4 Edit Style of Data Presentation |
|
|
239 | (1) |
|
10.2.5 How to Modify the Global Margins |
|
|
239 | (1) |
|
10.2.6 Saving Plots in XML Files |
|
|
240 | (1) |
|
|
240 | (1) |
|
10.2.8 Cleaning the HPlot Canvas from Graphics |
|
|
241 | (1) |
|
|
241 | (1) |
|
10.2.10 Summary of the HPlot Methods |
|
|
242 | (1) |
|
10.2.11 Saving Drawings in an Image File |
|
|
242 | (2) |
|
|
244 | (4) |
|
10.3.1 Simple Text Labels |
|
|
244 | (1) |
|
10.3.2 Interactive Labels |
|
|
245 | (1) |
|
10.3.3 Interactive Text Labels with Keys |
|
|
246 | (2) |
|
10.4 Geometrical Primitives |
|
|
248 | (1) |
|
10.5 Text Strings and Symbols |
|
|
249 | (1) |
|
10.6 SHPlot Class. HPlot Canvas as a Singleton |
|
|
249 | (2) |
|
10.7 Visualizing Interconnected Objects |
|
|
251 | (2) |
|
|
253 | (1) |
|
10.9 SPlot Class. A Simple Canvas |
|
|
254 | (3) |
|
10.9.1 Henon Attractor Again |
|
|
256 | (1) |
|
10.10 Canvas for Interactive Drawing |
|
|
257 | (3) |
|
|
258 | (1) |
|
|
259 | (1) |
|
|
260 | (2) |
|
|
262 | (1) |
|
|
263 | (4) |
|
|
263 | (3) |
|
10.13.2 3D Geometry Package |
|
|
266 | (1) |
|
10.14 Combining Graphs with Java Swing GUI Components |
|
|
267 | (3) |
|
10.15 Showing Streams of Data in Real Time |
|
|
270 | (3) |
|
|
271 | (2) |
|
|
273 | (40) |
|
11.1 Non-persistent Data. Memory-based Data |
|
|
273 | (1) |
|
11.2 Serialization of Objects |
|
|
274 | (2) |
|
11.3 Storing Data Persistently |
|
|
276 | (7) |
|
11.3.1 Sequential Input and Output |
|
|
276 | (2) |
|
11.3.2 GUI Browser for Serialized Objects |
|
|
278 | (1) |
|
11.3.3 Saving Event Records Persistently |
|
|
279 | (1) |
|
11.3.4 Buffer Size for I/O Intensive Operations |
|
|
280 | (1) |
|
11.3.5 Input and Output to XML Files |
|
|
281 | (1) |
|
11.3.6 Non-sequential Input and Output |
|
|
282 | (1) |
|
11.4 Compressed PFile Format |
|
|
283 | (4) |
|
11.4.1 Browser Dialog for PFile Files |
|
|
286 | (1) |
|
11.5 Reading ROOT and AIDA Files |
|
|
287 | (4) |
|
11.5.1 Reading ROOT Histograms |
|
|
287 | (1) |
|
11.5.2 Reading ROOT Trees |
|
|
288 | (2) |
|
11.5.3 Plotting ROOT or AIDA Objects Using jHepWork IDE |
|
|
290 | (1) |
|
11.6 Working with Relational SQL Databases |
|
|
291 | (4) |
|
11.6.1 Creating a SQL Database |
|
|
292 | (1) |
|
11.6.2 Working with a Database |
|
|
293 | (1) |
|
11.6.3 Creating a Read-only Compact Database |
|
|
294 | (1) |
|
11.7 Reading and Writing CSV Files |
|
|
295 | (2) |
|
|
295 | (1) |
|
|
296 | (1) |
|
11.8 Google's Protocol Buffer Format |
|
|
297 | (9) |
|
11.8.1 Prototyping Data Records |
|
|
298 | (1) |
|
11.8.2 Dealing with Data Using Java |
|
|
299 | (3) |
|
11.8.3 Switching to Jython |
|
|
302 | (1) |
|
11.8.4 Adding New Data Records |
|
|
303 | (1) |
|
11.8.5 Using C++ for I/O in the Protocol Buffers Format |
|
|
303 | (3) |
|
|
306 | (1) |
|
|
306 | (3) |
|
|
309 | (1) |
|
|
310 | (3) |
|
11.11.1 Dealing with Single Objects |
|
|
310 | (1) |
|
11.11.2 Dealing with Collections of Objects |
|
|
310 | (1) |
|
|
311 | (2) |
|
12 Miscellaneous Analysis Issues Using jHepWork |
|
|
313 | (22) |
|
12.1 Accessing Third-party Libraries |
|
|
313 | (2) |
|
12.1.1 Extracting Data Points from a Figure |
|
|
313 | (1) |
|
12.1.2 Cellular Automaton |
|
|
314 | (1) |
|
12.2 Downloading Files from the Web |
|
|
315 | (1) |
|
12.3 Macro Files for jHepWork Editor |
|
|
315 | (1) |
|
12.4 Data Output to Tables and Spreadsheets |
|
|
316 | (2) |
|
12.4.1 Showing Data in a Sortable Table |
|
|
316 | (2) |
|
12.4.2 Spreadsheet Support |
|
|
318 | (1) |
|
12.5 Accessing External Java and Jython Libraries |
|
|
318 | (1) |
|
12.6 Working with a jHepWork Project |
|
|
319 | (2) |
|
12.6.1 Pure Jython Project |
|
|
319 | (1) |
|
|
320 | (1) |
|
12.6.3 Mixing Jython with Java |
|
|
320 | (1) |
|
|
321 | (1) |
|
12.7.1 Saving Plots in External Image File |
|
|
321 | (1) |
|
12.7.2 View an Image. IView Class |
|
|
321 | (1) |
|
12.7.3 Analyzing and Editing Images |
|
|
321 | (1) |
|
|
322 | (1) |
|
12.9 Building List of Files |
|
|
322 | (1) |
|
12.10 Reading Configuration Files |
|
|
323 | (3) |
|
12.10.1 Configuration Files Using Jython |
|
|
323 | (2) |
|
12.10.2 Reading Configuration Files Using Java |
|
|
325 | (1) |
|
12.11 Jython Scripting with jHepWork |
|
|
326 | (3) |
|
12.11.1 Jython Operations with Data Holders |
|
|
328 | (1) |
|
12.12 Unwrapping Jython Code. Back to Java |
|
|
329 | (2) |
|
12.13 Embedding jHepWork in Applets |
|
|
331 | (4) |
|
|
334 | (1) |
|
|
335 | (8) |
|
13.1 Data Clustering. Real-life Example |
|
|
335 | (8) |
|
13.1.1 Preparing a Data Sample |
|
|
336 | (2) |
|
13.1.2 Clustering Analysis |
|
|
338 | (4) |
|
13.1.3 Interactive Clustering with JMinHEP |
|
|
342 | (1) |
|
|
342 | (1) |
|
14 Linear Regression and Curve Fitting |
|
|
343 | (24) |
|
|
343 | (3) |
|
|
343 | (1) |
|
14.1.2 Analyzing the Data Set |
|
|
344 | (2) |
|
14.2 Curve Fitting of Data |
|
|
346 | (8) |
|
|
348 | (1) |
|
14.2.2 Creating a Fit Function |
|
|
349 | (5) |
|
14.3 Displaying a Fit Function |
|
|
354 | (3) |
|
|
354 | (3) |
|
14.4 Real-life Example. Signal Plus Background |
|
|
357 | (6) |
|
14.4.1 Preparing a Data Sample |
|
|
357 | (1) |
|
14.4.2 Performing Curve Fitting |
|
|
357 | (2) |
|
14.4.3 Fitting Multiple Peaks |
|
|
359 | (3) |
|
14.4.4 Fitting Histograms in 3D |
|
|
362 | (1) |
|
|
363 | (4) |
|
|
365 | (2) |
|
|
367 | (16) |
|
|
367 | (8) |
|
15.1.1 Generating a Data Sample |
|
|
368 | (1) |
|
|
369 | (2) |
|
15.1.3 Building a Neural Net |
|
|
371 | (2) |
|
15.1.4 Training and Verifying |
|
|
373 | (2) |
|
|
375 | (1) |
|
|
376 | (3) |
|
15.3.1 Non-interactive BSOM |
|
|
378 | (1) |
|
15.4 Neural Network Using Python Libraries |
|
|
379 | (4) |
|
|
382 | (1) |
|
16 Steps in Data Analysis |
|
|
383 | (24) |
|
16.1 Major Analysis Steps |
|
|
383 | (2) |
|
16.2 Real Life Example. Analyzing a Gene Catalog |
|
|
385 | (6) |
|
16.2.1 Data Transformation |
|
|
386 | (1) |
|
|
386 | (1) |
|
|
387 | (1) |
|
|
387 | (2) |
|
16.2.5 Removing Duplicate Records |
|
|
389 | (1) |
|
16.2.6 Sorting and Removing Duplicate Records Using Java |
|
|
390 | (1) |
|
16.3 Using Metadata for Data Mining |
|
|
391 | (5) |
|
16.3.1 Analyzing Data Using Built-in Metadata File |
|
|
392 | (3) |
|
16.3.2 Using an External Metadata File |
|
|
395 | (1) |
|
16.4 Multiprocessor Programming |
|
|
396 | (7) |
|
16.4.1 Reading Data in Parallel |
|
|
397 | (2) |
|
16.4.2 Processing a Single Input File in Parallel |
|
|
399 | (2) |
|
16.4.3 Numerical Computations Using Multiple Cores |
|
|
401 | (2) |
|
16.5 Data Consistency and Security. MD5 Class |
|
|
403 | (4) |
|
16.5.1 MD5 Fingerprint at Runtime |
|
|
403 | (1) |
|
16.5.2 Fingerprinting Files |
|
|
404 | (1) |
|
|
405 | (2) |
|
|
407 | (28) |
|
17.1 Measuring Single-particle Densities |
|
|
407 | (4) |
|
17.1.1 Preparing a Data Sample |
|
|
408 | (1) |
|
|
409 | (2) |
|
17.2 Many-particle Densities, Fluctuations and Correlations |
|
|
411 | (9) |
|
17.2.1 Building a Data Sample for Analysis |
|
|
411 | (4) |
|
17.2.2 Analyzing the Data |
|
|
415 | (1) |
|
17.2.3 Reading the Data and Plotting Multiplicities |
|
|
416 | (4) |
|
17.3 Analyzing Macro Data: Nearby Galaxies |
|
|
420 | (3) |
|
17.4 Analyzing Micro Data: Elementary Particles |
|
|
423 | (2) |
|
17.5 A Monte Carlo Simulation of Particle Decays |
|
|
425 | (3) |
|
17.6 Measuring the Speed of Light Using the Internet |
|
|
428 | (7) |
|
17.6.1 Getting Host Names in Each Continent |
|
|
429 | (1) |
|
17.6.2 Checking Response from Servers |
|
|
430 | (1) |
|
17.6.3 Creating Histograms with the Response Time |
|
|
430 | (1) |
|
17.6.4 Final Measurements |
|
|
431 | (2) |
|
|
433 | (2) |
Index of Examples |
|
435 | (2) |
Index |
|
437 | |