Skip to content

Commit

Permalink
Deploying to gh-pages from @ 1d942a4 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
asogaard committed May 28, 2024
1 parent d055ea5 commit 461440a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
23 changes: 12 additions & 11 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 @@ -434,6 +435,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">_index</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_output_dir</span> <span class="o">=</span> <span class="n">outdir</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_output_files</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="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_extension</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="c1"># Set Extractors. Will throw error if extractors are incompatible</span>
<span class="c1"># with reader.</span>
Expand All @@ -458,8 +460,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">_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 @@ -612,16 +613,12 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="c1"># Get new, unique index and increment value</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_num_workers</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">with</span> <span class="n">global_index</span><span class="o">.</span><span class="n">get_lock</span><span class="p">():</span> <span class="c1"># type: ignore[name-defined]</span>
<span class="n">starting_index</span> <span class="o">=</span> <span class="n">global_index</span><span class="o">.</span><span class="n">value</span> <span class="c1"># type: ignore[name-defined]</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">start_idx</span> <span class="o">=</span> <span class="n">global_index</span><span class="o">.</span><span class="n">value</span> <span class="c1"># type: ignore[name-defined]</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">start_idx</span><span class="p">,</span> <span class="n">start_idx</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">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">start_idx</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">start_idx</span><span class="p">,</span> <span class="n">start_idx</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 @@ -682,7 +679,7 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<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="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">Union</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="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>

Expand All @@ -698,6 +695,10 @@ <h1 id="modules-graphnet-data-dataconverter--page-root">Source code for graphnet
<span class="n">files_to_merge</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_output_files</span>
<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="c1"># We shouldn't merge a single file?</span>
<span class="bp">self</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Got just a single file </span><span class="si">{</span><span class="n">files</span><span class="si">}</span><span class="s2">. Merging skipped."</span><span class="p">)</span>
<span class="k">return</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
5 changes: 3 additions & 2 deletions _modules/graphnet/training/labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,9 @@ <h1 id="modules-graphnet-training-labels--page-root">Source code for graphnet.tr

<span class="k">def</span> <span class="fm">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">graph</span><span class="p">:</span> <span class="n">Data</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">torch</span><span class="o">.</span><span class="n">tensor</span><span class="p">:</span>
<span class="w"> </span><span class="sd">"""Compute label for `graph`."""</span>
<span class="n">label</span> <span class="o">=</span> <span class="p">(</span><span class="n">graph</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_pid_key</span><span class="p">]</span> <span class="o">==</span> <span class="mi">14</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">graph</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_int_key</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span>
<span class="k">return</span> <span class="n">label</span><span class="o">.</span><span class="n">type</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">int</span><span class="p">)</span></div>
<span class="n">is_numu</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">graph</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_pid_key</span><span class="p">])</span> <span class="o">==</span> <span class="mi">14</span>
<span class="n">is_cc</span> <span class="o">=</span> <span class="n">graph</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_int_key</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span>
<span class="k">return</span> <span class="p">(</span><span class="n">is_numu</span> <span class="o">&amp;</span> <span class="n">is_cc</span><span class="p">)</span><span class="o">.</span><span class="n">type</span><span class="p">(</span><span class="n">torch</span><span class="o">.</span><span class="n">int</span><span class="p">)</span></div>

</pre></div>

Expand Down
2 changes: 1 addition & 1 deletion api/graphnet.data.dataconverter.html
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>files</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]]</span>, default: <code class="docutils literal notranslate"><span class="pre">None</span></code>) – Intermediate files to be merged.</p></li>
<li><p><strong>files</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>]</span>, default: <code class="docutils literal notranslate"><span class="pre">None</span></code>) – Intermediate files to be merged.</p></li>
<li><p><strong>kwargs</strong> (<em>Any</em>)</p></li>
</ul>
</dd>
Expand Down
4 changes: 2 additions & 2 deletions api/graphnet.data.extractors.icecube.i3genericextractor.html
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>keys</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>]</span>, default: <code class="docutils literal notranslate"><span class="pre">None</span></code>) – List of keys in <cite>I3Frame</cite> to be parsed. Defaults to all keys.</p></li>
<li><p><strong>exclude_keys</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>]</span>, default: <code class="docutils literal notranslate"><span class="pre">None</span></code>) – List of keys in <cite>I3Frame</cite> to exclude while parsing.</p></li>
<li><p><strong>keys</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>]</span>, default: <code class="docutils literal notranslate"><span class="pre">None</span></code>) – List of keys in <cite>I3Frame</cite> to be parsed. Defaults to all keys.</p></li>
<li><p><strong>exclude_keys</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>]</span>, default: <code class="docutils literal notranslate"><span class="pre">None</span></code>) – List of keys in <cite>I3Frame</cite> to exclude while parsing.</p></li>
<li><p><strong>extractor_name</strong> (<em>str</em>)</p></li>
</ul>
</dd>
Expand Down
2 changes: 1 addition & 1 deletion api/graphnet.models.gnn.dynedge.html
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@
post-processing _and_ optional global pooling. As this is the
last layer(s) in the model, the last layer in the read-out
yields the output of the <cite>DynEdge</cite> model. Defaults to [128,].</p></li>
<li><p><strong>global_pooling_schemes</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>]</span>, default: <code class="docutils literal notranslate"><span class="pre">None</span></code>) – The list global pooling schemes to use.
<li><p><strong>global_pooling_schemes</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>]</span>, default: <code class="docutils literal notranslate"><span class="pre">None</span></code>) – The list global pooling schemes to use.
Options are: “min”, “max”, “mean”, and “sum”.</p></li>
<li><p><strong>add_global_variables_after_pooling</strong> (<span class="sphinx_autodoc_typehints-type"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></span>, default: <code class="docutils literal notranslate"><span class="pre">False</span></code>) – Whether to add global variables
after global pooling. The alternative is to added (distribute)
Expand Down
Loading

0 comments on commit 461440a

Please sign in to comment.