Skip to content
Snippets Groups Projects
Commit 6acc1c0b authored by Zineb Aly's avatar Zineb Aly
Browse files

added a tutorial in README file

parent b8177c46
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,7 @@ That's it! Now let's have a look at the hits data:: ...@@ -49,7 +49,7 @@ That's it! Now let's have a look at the hits data::
Quick intro to read Aanet files Quick intro to read Aanet files
------------------------------- -------------------------------
Currently, only one Aanet event file can be read. The next version of km3io will be able to read multiple Aanet files (from the same simulation!). Currently, only one Aanet event file can be read. The next version of km3io will be able to read multiple Aanet files (from the same simulation!). Data is always returned as a "lazyarray". A lazyarray is an array-like object that reads data on demand. Here, only the first and last chunks of data are read in memory, and not all data in the array. The output can be used with all `Numpy's universal functions <https://docs.scipy.org/doc/numpy/reference/ufuncs.html>.
Let's have a look at some events data from ORCA 4 lines simulations - run id 5971 (``datav6.0test.jchain.aanet.00005971.root``) Let's have a look at some events data from ORCA 4 lines simulations - run id 5971 (``datav6.0test.jchain.aanet.00005971.root``)
...@@ -61,7 +61,7 @@ To get a lazy ragged array of all data:: ...@@ -61,7 +61,7 @@ To get a lazy ragged array of all data::
That's it! Now let's take a look at all the available branches in our file:: That's it! Now let's take a look at all the available branches in our file::
>>> reader >>> reader
Number of events: 10 Number of events: 145028
Events keys are: Events keys are:
id id
det_id det_id
...@@ -131,3 +131,60 @@ That's it! Now let's take a look at all the available branches in our file:: ...@@ -131,3 +131,60 @@ That's it! Now let's take a look at all the available branches in our file::
trks.hit_ids trks.hit_ids
trks.error_matrix trks.error_matrix
trks.comment trks.comment
Now that you have seen all the available branches, you can choose any key from the above (key refers to a branch name) and display the corresponding data. For example, we will check that we are indeed reading data from the run 5971::
>>> reader['run_id']
<ChunkedArray [5971 5971 5971 ... 5971 5971 5971] at 0x7fb2341ad810>
Let's look at the number of hits and tracks in the event number 5::
>>> reader[5]['hits']
60
>>> reader[5]['trks']
56
So event 5 has exactly 60 hits and 56 tracks. Let's explore in more details hits and tracks data in event 5::
>>> reader['hits.dom_id'][5]
array([806455814, 806487219, 806487219, 806487219, 806487226, 808432835,
808432835, 808432835, 808432835, 808432835, 808432835, 808432835,
808451904, 808451904, 808451907, 808451907, 808469129, 808469129,
808469129, 808493910, 808949744, 808949744, 808951460, 808951460,
808956908, 808961655, 808964908, 808969848, 808969857, 808972593,
808972593, 808972598, 808972598, 808972698, 808972698, 808974758,
808974811, 808976377, 808981510, 808981523, 808981812, 808982005,
808982005, 808982018, 808982077, 808982077, 808982547, 809007627,
809521500, 809521500, 809521500, 809524432, 809526097, 809526097,
809526097, 809526097, 809526097, 809526097, 809526097, 809544058],
dtype=int32)
One can access the dom_id for the first hit in event 5 as follows::
>>> reader['hits.dom_id'][5][0]
806455814
Now let's read tracks data in event 5::
>>> reader['trks.dir.z'][5]
array([-0.60246049, -0.60246049, -0.60246049, -0.51420541, -0.5475772 ,
-0.5772408 , -0.56068238, -0.64907684, -0.67781799, -0.66565114,
-0.63014839, -0.64566464, -0.62691012, -0.58465493, -0.59287533,
-0.63655091, -0.63771247, -0.73446841, -0.7456636 , -0.70941246,
-0.66312268, -0.66312268, -0.56806477, -0.56806477, -0.66312268,
-0.66312268, -0.74851077, -0.74851077, -0.66312268, -0.74851077,
-0.56806477, -0.74851077, -0.66312268, -0.74851077, -0.56806477,
-0.66312268, -0.56806477, -0.66312268, -0.56806477, -0.56806477,
-0.66312268, -0.74851077, -0.66312268, -0.93501626, -0.56806477,
-0.74851077, -0.66312268, -0.56806477, -0.82298389, -0.74851077,
-0.66312268, -0.56806477, -0.82298389, -0.56806477, -0.66312268,
-0.97094183])
One can access the 'trks.dir.z' for the first track in event 5 as follows::
>>> reader['trks.dir.z'][5][0]
-0.60246049
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment