Skip to content

Commit

Permalink
Deploying to gh-pages from @ 24561fc 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
asogaard committed May 20, 2024
1 parent b7641cc commit 15c5d9c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions _modules/graphnet/data/dataconverter.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@

<h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet.data.dataconverter</h1><div class="highlight"><pre>
<span></span><span class="sd">"""Contains `DataConverter`."""</span>

<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">List</span><span class="p">,</span> <span class="n">Union</span><span class="p">,</span> <span class="n">OrderedDict</span><span class="p">,</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">,</span> <span class="n">Any</span><span class="p">,</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">Type</span>
<span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">abstractmethod</span><span class="p">,</span> <span class="n">ABC</span>

Expand Down Expand Up @@ -458,8 +459,7 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="bp">self</span><span class="o">.</span><span class="n">_output_files</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_output_dir</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_create_file_name</span><span class="p">(</span><span class="n">file</span><span class="p">)</span>
<span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_save_method</span><span class="o">.</span><span class="n">file_extension</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_create_file_name</span><span class="p">(</span><span class="n">file</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_save_method</span><span class="o">.</span><span class="n">file_extension</span><span class="p">,</span>
<span class="p">)</span>
<span class="k">for</span> <span class="n">file</span> <span class="ow">in</span> <span class="n">input_files</span>
<span class="p">]</span>
Expand Down Expand Up @@ -619,9 +619,7 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="n">global_index</span><span class="o">.</span><span class="n">value</span> <span class="o">+=</span> <span class="n">n_ids</span> <span class="c1"># type: ignore[name-defined]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">starting_index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span>
<span class="n">event_nos</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span>
<span class="n">starting_index</span><span class="p">,</span> <span class="n">starting_index</span> <span class="o">+</span> <span class="n">n_ids</span><span class="p">,</span> <span class="mi">1</span>
<span class="p">)</span><span class="o">.</span><span class="n">tolist</span><span class="p">()</span>
<span class="n">event_nos</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">starting_index</span><span class="p">,</span> <span class="n">starting_index</span> <span class="o">+</span> <span class="n">n_ids</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">tolist</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">+=</span> <span class="n">n_ids</span>

<span class="k">return</span> <span class="n">event_nos</span>
Expand Down Expand Up @@ -681,9 +679,7 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<div class="viewcode-block" id="DataConverter.merge_files">
<a class="viewcode-back" href="../../../api/graphnet.data.dataconverter.html#graphnet.data.dataconverter.DataConverter.merge_files">[docs]</a>
<span class="nd">@final</span>
<span class="k">def</span> <span class="nf">merge_files</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span> <span class="n">files</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">merge_files</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">files</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">"""Merge converted files.</span>

<span class="sd"> `DataConverter` will call the `.merge_files` method in the</span>
Expand All @@ -699,7 +695,7 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="k">elif</span> <span class="n">files</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="c1"># Proceed to merge specified by user.</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">files</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="n">files</span> <span class="o">=</span> <span class="p">[</span><span class="n">files</span><span class="p">]</span> <span class="c1"># Cast to list if user forgot</span>
<span class="n">files</span> <span class="o">=</span> <span class="p">[</span><span class="n">files</span><span class="p">]</span> <span class="c1"># Cast to list if user forgot</span>
<span class="n">files_to_merge</span> <span class="o">=</span> <span class="n">files</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># Raise error</span>
Expand Down

0 comments on commit 15c5d9c

Please sign in to comment.