Skip to content

Commit

Permalink
Deploying to gh-pages from @ 5801d62 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
asogaard committed Oct 11, 2023
1 parent b027c36 commit 1e76666
Show file tree
Hide file tree
Showing 49 changed files with 1,453 additions and 21 deletions.
28 changes: 20 additions & 8 deletions _modules/graphnet/data/dataconverter.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="kn">from</span> <span class="nn">graphnet.utilities.filesys</span> <span class="kn">import</span> <span class="n">find_i3_files</span>
<span class="kn">from</span> <span class="nn">graphnet.utilities.imports</span> <span class="kn">import</span> <span class="n">has_icecube_package</span>
<span class="kn">from</span> <span class="nn">graphnet.utilities.logging</span> <span class="kn">import</span> <span class="n">Logger</span>
<span class="kn">from</span> <span class="nn">graphnet.data.filters</span> <span class="kn">import</span> <span class="n">I3Filter</span><span class="p">,</span> <span class="n">NullSplitI3Filter</span>

<span class="k">if</span> <span class="n">has_icecube_package</span><span class="p">():</span>
<span class="kn">from</span> <span class="nn">icecube</span> <span class="kn">import</span> <span class="n">icetray</span><span class="p">,</span> <span class="n">dataio</span> <span class="c1"># pyright: reportMissingImports=false</span>
Expand Down Expand Up @@ -442,6 +443,7 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="n">workers</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
<span class="n">index_column</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"event_no"</span><span class="p">,</span>
<span class="n">icetray_verbose</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<span class="n">i3_filters</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">I3Filter</span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">"""Construct DataConverter.</span>

Expand Down Expand Up @@ -502,6 +504,14 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="bp">self</span><span class="o">.</span><span class="n">_input_file_batch_pattern</span> <span class="o">=</span> <span class="n">input_file_batch_pattern</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_workers</span> <span class="o">=</span> <span class="n">workers</span>

<span class="c1"># I3Filters (NullSplitI3Filter is always included)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_i3filters</span> <span class="o">=</span> <span class="p">[</span><span class="n">NullSplitI3Filter</span><span class="p">()]</span> <span class="o">+</span> <span class="n">i3_filters</span>

<span class="k">for</span> <span class="nb">filter</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_i3filters</span><span class="p">:</span>
<span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span>
<span class="nb">filter</span><span class="p">,</span> <span class="n">I3Filter</span>
<span class="p">),</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="nb">filter</span><span class="p">)</span><span class="si">}</span><span class="s2"> is not a subclass of I3Filter"</span>

<span class="c1"># Create I3Extractors</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_extractors</span> <span class="o">=</span> <span class="n">I3ExtractorCollection</span><span class="p">(</span><span class="o">*</span><span class="n">extractors</span><span class="p">)</span>

Expand Down Expand Up @@ -777,6 +787,7 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="k">if</span> <span class="s2">"I3"</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">):</span>
<span class="k">continue</span>
<span class="c1"># check if frame should be skipped</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_skip_frame</span><span class="p">(</span><span class="n">frame</span><span class="p">):</span>
<span class="k">continue</span>

Expand Down Expand Up @@ -902,17 +913,18 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="k">return</span> <span class="n">output_file</span>

<span class="k">def</span> <span class="nf">_skip_frame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">frame</span><span class="p">:</span> <span class="s2">"icetray.I3Frame"</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="w"> </span><span class="sd">"""Check if frame should be skipped.</span>

<span class="sd"> Args:</span>
<span class="sd"> frame: I3Frame to check.</span>
<span class="w"> </span><span class="sd">"""Check the user defined filters.</span>

<span class="sd"> Returns:</span>
<span class="sd"> True if frame is a null split frame, else False.</span>
<span class="sd"> bool: True if frame should be skipped, False otherwise.</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="n">frame</span><span class="p">[</span><span class="s2">"I3EventHeader"</span><span class="p">]</span><span class="o">.</span><span class="n">sub_event_stream</span> <span class="o">==</span> <span class="s2">"NullSplit"</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">True</span>
<span class="k">return</span> <span class="kc">False</span></div>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_i3filters</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">False</span> <span class="c1"># No filters defined, so we keep the frame</span>

<span class="k">for</span> <span class="nb">filter</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_i3filters</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">filter</span><span class="p">(</span><span class="n">frame</span><span class="p">):</span>
<span class="k">return</span> <span class="kc">True</span> <span class="c1"># keep_frame call false, skip the frame.</span>
<span class="k">return</span> <span class="kc">False</span> <span class="c1"># All filter keep_frame calls true, keep the frame.</span></div>

</pre></div>

Expand Down
Loading

0 comments on commit 1e76666

Please sign in to comment.