Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Update NeXus HTML documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cow-bot committed Aug 5, 2022
1 parent 71e3bed commit 15cc64d
Show file tree
Hide file tree
Showing 6 changed files with 304 additions and 263 deletions.
20 changes: 10 additions & 10 deletions nx-class-documentation/html/examples/code_napi.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,30 +244,30 @@ <h3>NAPI Python Example: write simple NeXus file<a class="headerlink" href="#nap
<span class="linenos"> 4</span><span class="kn">import</span> <span class="nn">nxs</span>
<span class="linenos"> 5</span><span class="kn">import</span> <span class="nn">numpy</span>
<span class="linenos"> 6</span>
<span class="linenos"> 7</span><span class="n">a</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">),</span><span class="n">dtype</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">int</span><span class="p">)</span>
<span class="linenos"> 7</span><span class="n">a</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">int</span><span class="p">)</span>
<span class="linenos"> 8</span><span class="n">val</span> <span class="o">=</span> <span class="mi">0</span>
<span class="linenos"> 9</span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span>
<span class="linenos">10</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
<span class="linenos">11</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">4</span><span class="p">):</span>
<span class="linenos">12</span> <span class="n">a</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">,</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span>
<span class="linenos">12</span> <span class="n">a</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">val</span>
<span class="linenos">13</span> <span class="n">val</span> <span class="o">=</span> <span class="n">val</span> <span class="o">+</span> <span class="mi">1</span>
<span class="linenos">14</span>
<span class="linenos">15</span><span class="n">nf</span> <span class="o">=</span> <span class="n">nxs</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="s2">&quot;simple3D.h5&quot;</span><span class="p">,</span> <span class="s2">&quot;w5&quot;</span><span class="p">)</span>
<span class="linenos">16</span>
<span class="linenos">17</span><span class="n">nf</span><span class="o">.</span><span class="n">makegroup</span><span class="p">(</span><span class="s2">&quot;entry&quot;</span><span class="p">,</span><span class="s2">&quot;NXentry&quot;</span><span class="p">)</span>
<span class="linenos">18</span><span class="n">nf</span><span class="o">.</span><span class="n">opengroup</span><span class="p">(</span><span class="s2">&quot;entry&quot;</span><span class="p">,</span><span class="s2">&quot;NXentry&quot;</span><span class="p">)</span>
<span class="linenos">17</span><span class="n">nf</span><span class="o">.</span><span class="n">makegroup</span><span class="p">(</span><span class="s2">&quot;entry&quot;</span><span class="p">,</span> <span class="s2">&quot;NXentry&quot;</span><span class="p">)</span>
<span class="linenos">18</span><span class="n">nf</span><span class="o">.</span><span class="n">opengroup</span><span class="p">(</span><span class="s2">&quot;entry&quot;</span><span class="p">,</span> <span class="s2">&quot;NXentry&quot;</span><span class="p">)</span>
<span class="linenos">19</span>
<span class="linenos">20</span><span class="n">nf</span><span class="o">.</span><span class="n">makegroup</span><span class="p">(</span><span class="s2">&quot;data&quot;</span><span class="p">,</span><span class="s2">&quot;NXdata&quot;</span><span class="p">)</span>
<span class="linenos">21</span><span class="n">nf</span><span class="o">.</span><span class="n">opengroup</span><span class="p">(</span><span class="s2">&quot;data&quot;</span><span class="p">,</span><span class="s2">&quot;NXdata&quot;</span><span class="p">)</span>
<span class="linenos">22</span><span class="n">nf</span><span class="o">.</span><span class="n">putattr</span><span class="p">(</span><span class="s2">&quot;signal&quot;</span><span class="p">,</span><span class="s2">&quot;test&quot;</span><span class="p">)</span>
<span class="linenos">20</span><span class="n">nf</span><span class="o">.</span><span class="n">makegroup</span><span class="p">(</span><span class="s2">&quot;data&quot;</span><span class="p">,</span> <span class="s2">&quot;NXdata&quot;</span><span class="p">)</span>
<span class="linenos">21</span><span class="n">nf</span><span class="o">.</span><span class="n">opengroup</span><span class="p">(</span><span class="s2">&quot;data&quot;</span><span class="p">,</span> <span class="s2">&quot;NXdata&quot;</span><span class="p">)</span>
<span class="linenos">22</span><span class="n">nf</span><span class="o">.</span><span class="n">putattr</span><span class="p">(</span><span class="s2">&quot;signal&quot;</span><span class="p">,</span> <span class="s2">&quot;test&quot;</span><span class="p">)</span>
<span class="linenos">23</span>
<span class="linenos">24</span><span class="n">nf</span><span class="o">.</span><span class="n">makedata</span><span class="p">(</span><span class="s2">&quot;test&quot;</span><span class="p">,</span><span class="s1">&#39;int32&#39;</span><span class="p">,[</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">])</span>
<span class="linenos">24</span><span class="n">nf</span><span class="o">.</span><span class="n">makedata</span><span class="p">(</span><span class="s2">&quot;test&quot;</span><span class="p">,</span> <span class="s2">&quot;int32&quot;</span><span class="p">,</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">])</span>
<span class="linenos">25</span><span class="n">nf</span><span class="o">.</span><span class="n">opendata</span><span class="p">(</span><span class="s2">&quot;test&quot;</span><span class="p">)</span>
<span class="linenos">26</span><span class="n">nf</span><span class="o">.</span><span class="n">putdata</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<span class="linenos">27</span><span class="n">nf</span><span class="o">.</span><span class="n">closedata</span><span class="p">()</span>
<span class="linenos">28</span>
<span class="linenos">29</span><span class="n">nf</span><span class="o">.</span><span class="n">closegroup</span><span class="p">()</span> <span class="c1"># NXdata</span>
<span class="linenos">30</span><span class="n">nf</span><span class="o">.</span><span class="n">closegroup</span><span class="p">()</span> <span class="c1"># NXentry</span>
<span class="linenos">29</span><span class="n">nf</span><span class="o">.</span><span class="n">closegroup</span><span class="p">()</span> <span class="c1"># NXdata</span>
<span class="linenos">30</span><span class="n">nf</span><span class="o">.</span><span class="n">closegroup</span><span class="p">()</span> <span class="c1"># NXentry</span>
<span class="linenos">31</span>
<span class="linenos">32</span><span class="n">nf</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="linenos">33</span>
Expand Down
Loading

0 comments on commit 15cc64d

Please sign in to comment.