Skip to content
Snippets Groups Projects
Commit 75c81a6c authored by ViaFerrata's avatar ViaFerrata
Browse files

Fixed docs and removed leftover code.

parent 2ec3aebe
No related branches found
No related tags found
No related merge requests found
......@@ -20,8 +20,11 @@ OrcaSong: Main Framework
parse_input
parser_check_input
make_output_dirs
calculate_bin_edges
calculate_bin_edges_test
get_file_particle_type
EventSkipper
skip_event
data_to_images
main
......@@ -39,9 +42,11 @@ OrcaSong: Main Framework
.. autosummary::
:toctree: api
get_event_data
get_primary_track_index
get_time_residual_nu_interaction_mean_triggered_hits
get_hits
get_tracks
EventDataExtractor
``orcasong.hits_to_histograms``: Making images based on the event info
......@@ -56,24 +61,9 @@ OrcaSong: Main Framework
.. autosummary::
:toctree: api
get_time_parameters
compute_4d_to_2d_histograms
convert_2d_numpy_hists_to_pdf_image
compute_4d_to_3d_histograms
compute_4d_to_4d_histograms
convert_2d_numpy_hists_to_pdf_image
get_time_parameters
``orcasong.histograms_to_files``: Saving the images to a h5 file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. automodule:: orcasong.histograms_to_files
:no-members:
:no-inherited-members:
.. currentmodule:: orcasong.histograms_to_files
.. autosummary::
:toctree: api
store_histograms_as_hdf5
\ No newline at end of file
HistogramMaker
\ No newline at end of file
......@@ -134,9 +134,9 @@ At this point, we are now ready to start using OrcaSong for the generation of ev
Usage of OrcaSong
-----------------
After pulling the OrcaSong repo to your local harddisk you first need to install it with the provided setup.py::
In order to use OrcaSong, you can just install it with :code:`pip`::
~/orcasong$: pip install .
~/$: pip install orcasong
Before you can start to use OrcaSong, you need a .detx detector geometry file that corresponds to your input files.
OrcaSong is currently producing event "images" based on a 1 DOM / XYZ-bin assumption. This image generation is done
......@@ -146,18 +146,24 @@ automatically, based on the number of bins (n_bins) for each dimension XYZ that
If your .detx file is not contained in the OrcaSong/detx_files folder, please add it to the repository!
Currently, only the 115l ORCA 2016 detx file is available.
At this point, you're finally ready to use OrcaSong, it can be executed as follows::
At this point, you're finally ready to use OrcaSong.
OrcaSong can be called from every directory by using the :code:`make_nn_images` command::
~/orcasong$: python data_to_images.py testfile.h5 geofile.detx
~/$: make_nn_images testfile.h5 geofile.detx
OrcaSong will then generate a hdf5 file with images into the Results folder, e.g. Results/4dTo4d/h5/xyzt.
OrcaSong will then generate a hdf5 file with images that will be put in a "Results" folder at your current path.
The configuration options of OrcaSong can be found by calling the help::
~/orcasong$: python data_to_images.py -h
~/$: make_nn_images -h
Main OrcaSong code which takes raw simulated .h5 files and the corresponding .detx detector file as input in
order to generate 2D/3D/4D histograms ('images') that can be used for CNNs.
The input file can be calibrated or not (e.g. contains pos_xyz of the hits).
First argument: KM3NeT hdf5 simfile at JTE level.
Second argument: a .detx file that is associated with the hdf5 file.
The input file can be calibrated or not (e.g. contains pos_xyz of the hits) and the OrcaSong output is written
to the current folder by default (otherwise use --o option).
Makes only 4D histograms ('images') by default.
Usage:
......@@ -169,6 +175,15 @@ The configuration options of OrcaSong can be found by calling the help::
-c CONFIGFILE Load all options from a config file (.toml format).
--o OUTPUTPATH Path for the directory, where the OrcaSong output should be stored. [default: ./]
--chunksize CHUNKSIZE Chunksize (axis_0) that should be used for the hdf5 output of OrcaSong. [default: 32]
--complib COMPLIB Compression library that should be used for the OrcaSong output.
All PyTables compression filters are available. [default: zlib]
--complevel COMPLEVEL Compression level that should be used for the OrcaSong output. [default: 1]
--n_bins N_BINS Number of bins that are used in the image making for each dimension, e.g. (x,y,z,t).
[default: 11,13,18,60]
......@@ -222,18 +237,15 @@ The configuration options of OrcaSong can be found by calling the help::
the 'y' dataset of the output file of OrcaSong. [default: 1]
OrcaSong will then generate a hdf5 file with images into the Results folder, e.g. Results/4dTo4d/h5/xyzt.
Alternatively, they can also be found in the docs of the :code:`main()` function:
Alternatively, they can also be found in the docs of the :code:`data_to_images()` function:
.. currentmodule:: orcasong.data_to_images
.. autosummary::
main
data_to_images
Other than parsing every information to orcasong via the console, you can also load a .toml config file::
~/orcasong$: python data_to_images.py -c config.toml testfile.h5 geofile.detx
~/$: make_nn_images -c config.toml testfile.h5 geofile.detx
Please checkout the config.toml file in the main folder of the OrcaSong repo in order to get an idea about
the structure of the config file.
......
......@@ -217,52 +217,6 @@ def get_tracks(event_blob, file_particle_type, event_hits, prod_ident):
return event_track
def get_event_data(event_blob, file_particle_type, geo, do_mc_hits, data_cuts, do4d, prod_ident):
"""
Reads a km3pipe blob which contains the information for one event and returns a hit array and a track array
that contains all relevant information of the event.
Parameters
----------
event_blob : kp.io.HDF5Pump.blob
Event blob of the HDF5Pump which contains all information for one event.
file_particle_type : str
String that specifies the type of particles that are contained in the file: ['undefined', 'muon', 'neutrino'].
geo : kp.Geometry
km3pipe Geometry instance that contains the geometry information of the detector.
Only used if the event_blob is from a non-calibrated file!
do_mc_hits : bool
Tells the function of the hits (mc_hits + BG) or the mc_hits only should be parsed.
In the case of mc_hits, the dom_id needs to be calculated thanks to the jpp output.
data_cuts : dict
Specifies if cuts should be applied.
Contains the keys 'triggered' and 'energy_lower/upper_limit' and 'throw_away_prob'.
do4d : tuple(bool, str)
Tuple that declares if 4D histograms should be created [0] and if yes, what should be used as the 4th dim after xyz.
In the case of 'channel_id', this information needs to be included in the event_hits as well.
prod_ident : int
Optional int that identifies the used production, more documentation in the docs of the main function.
geo : None/kp.Geometry
If none, the event_blob should already contain the calibrated hit information (e.g. pos_xyz).
Else, a km3pipe Geometry instance that contains the geometry information of the detector.
Returns
-------
event_hits : ndarray(ndim=2)
2D array containing the hit information of the event [pos_xyz, time, triggered, (channel_id)].
event_track : ndarray(ndim=1)
1D array containing important MC information of the event,
[event_id, particle_type, energy, is_cc, bjorkeny, dir_x, dir_y, dir_z, time_track, run_id,
vertex_pos_x, vertex_pos_y, vertex_pos_z, time_residual_vertex, (prod_ident)].
"""
event_hits = get_hits(event_blob, geo, do_mc_hits, data_cuts, do4d)
event_track = get_tracks(event_blob, file_particle_type, event_hits, prod_ident)
return event_hits, event_track
class EventDataExtractor(kp.Module):
"""
Class that takes a km3pipe blob which contains the information for one event and returns
......
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