| | | |
Offset 271, 23 lines modified | Offset 271, 23 lines modified |
271 | <span·class="gh">Out[15]:·</span><span·class="go">5</span> | 271 | <span·class="gh">Out[15]:·</span><span·class="go">5</span> |
| |
272 | <span·class="gp">In·[16]:·</span><span·class="n">snap</span><span·class="o">.</span><span·class="n">particles</span><span·class="o">.</span><span·class="n">N</span> | 272 | <span·class="gp">In·[16]:·</span><span·class="n">snap</span><span·class="o">.</span><span·class="n">particles</span><span·class="o">.</span><span·class="n">N</span> |
273 | <span·class="gh">Out[16]:·</span><span·class="go">9</span> | 273 | <span·class="gh">Out[16]:·</span><span·class="go">9</span> |
| |
274 | <span·class="gp">In·[17]:·</span><span·class="n">snap</span><span·class="o">.</span><span·class="n">particles</span><span·class="o">.</span><span·class="n">position</span> | 274 | <span·class="gp">In·[17]:·</span><span·class="n">snap</span><span·class="o">.</span><span·class="n">particles</span><span·class="o">.</span><span·class="n">position</span> |
275 | <span·class="gh">Out[17]:·</span><span·class="go"></span> | 275 | <span·class="gh">Out[17]:·</span><span·class="go"></span> |
276 | <span·class="go">array([[0.48177087,·0.0019721·,·0.6821456·],</span> | 276 | <span·class="go">array([[0.2047895·,·0.70605606,·0.07798767],</span> |
| 277 | <span·class="go">·······[0.96794635,·0.9033231·,·0.8153699·],</span> |
| 278 | <span·class="go">·······[0.41904292,·0.32442886,·0.9867672·],</span> |
| 279 | <span·class="go">·······[0.48278466,·0.543924··,·0.40995002],</span> |
| 280 | <span·class="go">·······[0.12609783,·0.06111464,·0.9033138·],</span> |
277 | <span·class="go">·······[0.8952125·,·0.6255473·,·0.02883342],</span> | 281 | <span·class="go">·······[0.3999571·,·0.0428344·,·0.02384735],</span> |
| 282 | <span·class="go">·······[0.52714556,·0.8148939·,·0.9498546·],</span> |
278 | <span·class="go">·······[0.4324867·,·0.71397847,·0.6837485·],</span> | 283 | <span·class="go">·······[0.48973358,·0.27436677,·0.9293624·],</span> |
279 | <span·class="go">·······[0.48239848,·0.06148845,·0.584769··],</span> | |
280 | <span·class="go">·······[0.91358054,·0.90127224,·0.83669275],</span> | |
281 | <span·class="go">·······[0.71254784,·0.17851584,·0.36799958],</span> | |
282 | <span·class="go">·······[0.39305127,·0.8323114·,·0.7881819·],</span> | |
283 | <span·class="go">·······[0.6811617·,·0.38293022,·0.16583234],</span> | |
284 | <span·class="go">·······[0.899306··,·0.7256755·,·0.67697614]],·dtype=float32)</span> | 284 | <span·class="go">·······[0.19695702,·0.50833076,·0.52838415]],·dtype=float32)</span> |
285 | </pre></div> | 285 | </pre></div> |
286 | </div> | 286 | </div> |
287 | <p><a·class="reference·internal"·href="python-module-gsd.hoomd.html#gsd.hoomd.HOOMDTrajectory"·title="gsd.hoomd.HOOMDTrajectory"><code·class="xref·any·py·py-class·docutils·literal·notranslate"><span·class="pre">gsd.hoomd.HOOMDTrajectory</span></code></a>·supports·random·indexing·of·frames·in·the·file. | 287 | <p><a·class="reference·internal"·href="python-module-gsd.hoomd.html#gsd.hoomd.HOOMDTrajectory"·title="gsd.hoomd.HOOMDTrajectory"><code·class="xref·any·py·py-class·docutils·literal·notranslate"><span·class="pre">gsd.hoomd.HOOMDTrajectory</span></code></a>·supports·random·indexing·of·frames·in·the·file. |
288 | Indexing·into·a·trajectory·returns·a·<a·class="reference·internal"·href="python-module-gsd.hoomd.html#gsd.hoomd.Snapshot"·title="gsd.hoomd.Snapshot"><code·class="xref·any·py·py-class·docutils·literal·notranslate"><span·class="pre">gsd.hoomd.Snapshot</span></code></a>.</p> | 288 | Indexing·into·a·trajectory·returns·a·<a·class="reference·internal"·href="python-module-gsd.hoomd.html#gsd.hoomd.Snapshot"·title="gsd.hoomd.Snapshot"><code·class="xref·any·py·py-class·docutils·literal·notranslate"><span·class="pre">gsd.hoomd.Snapshot</span></code></a>.</p> |
289 | </div> | 289 | </div> |
290 | <div·class="section"·id="slicing-and-selection"> | 290 | <div·class="section"·id="slicing-and-selection"> |
291 | <h2>Slicing·and·selection<a·class="headerlink"·href="#slicing-and-selection"·title="Permalink·to·this·headline">¶</a></h2> | 291 | <h2>Slicing·and·selection<a·class="headerlink"·href="#slicing-and-selection"·title="Permalink·to·this·headline">¶</a></h2> |
Offset 315, 21 lines modified | Offset 315, 21 lines modified |
315 | <h2>Pure·python·reader<a·class="headerlink"·href="#pure-python-reader"·title="Permalink·to·this·headline">¶</a></h2> | 315 | <h2>Pure·python·reader<a·class="headerlink"·href="#pure-python-reader"·title="Permalink·to·this·headline">¶</a></h2> |
316 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[22]:·</span><span·class="n">f</span>·<span·class="o">=</span>·<span·class="n">gsd</span><span·class="o">.</span><span·class="n">pygsd</span><span·class="o">.</span><span·class="n">GSDFile</span><span·class="p">(</span><span·class="nb">open</span><span·class="p">(</span><span·class="s1">'test.gsd'</span><span·class="p">,</span>·<span·class="s1">'rb'</span><span·class="p">))</span> | 316 | <div·class="highlight-ipython·notranslate"><div·class="highlight"><pre><span></span><span·class="gp">In·[22]:·</span><span·class="n">f</span>·<span·class="o">=</span>·<span·class="n">gsd</span><span·class="o">.</span><span·class="n">pygsd</span><span·class="o">.</span><span·class="n">GSDFile</span><span·class="p">(</span><span·class="nb">open</span><span·class="p">(</span><span·class="s1">'test.gsd'</span><span·class="p">,</span>·<span·class="s1">'rb'</span><span·class="p">))</span> |
| |
317 | <span·class="gp">In·[23]:·</span><span·class="n">t</span>·<span·class="o">=</span>·<span·class="n">gsd</span><span·class="o">.</span><span·class="n">hoomd</span><span·class="o">.</span><span·class="n">HOOMDTrajectory</span><span·class="p">(</span><span·class="n">f</span><span·class="p">);</span> | 317 | <span·class="gp">In·[23]:·</span><span·class="n">t</span>·<span·class="o">=</span>·<span·class="n">gsd</span><span·class="o">.</span><span·class="n">hoomd</span><span·class="o">.</span><span·class="n">HOOMDTrajectory</span><span·class="p">(</span><span·class="n">f</span><span·class="p">);</span> |
| |
318 | <span·class="gp">In·[24]:·</span><span·class="n">t</span><span·class="p">[</span><span·class="mi">3</span><span·class="p">]</span><span·class="o">.</span><span·class="n">particles</span><span·class="o">.</span><span·class="n">position</span> | 318 | <span·class="gp">In·[24]:·</span><span·class="n">t</span><span·class="p">[</span><span·class="mi">3</span><span·class="p">]</span><span·class="o">.</span><span·class="n">particles</span><span·class="o">.</span><span·class="n">position</span> |
319 | <span·class="gh">Out[24]:·</span><span·class="go"></span> | 319 | <span·class="gh">Out[24]:·</span><span·class="go"></span> |
320 | <span·class="go">array([[0.88437366,·0.25044152,·0.28480613],</span> | 320 | <span·class="go">array([[0.7248003·,·0.2913952·,·0.06764258],</span> |
321 | <span·class="go">·······[0.304431··,·0.6978187·,·0.9323169·],</span> | 321 | <span·class="go">·······[0.57350767,·0.5005179·,·0.8065427·],</span> |
322 | <span·class="go">·······[0.19105905,·0.00701067,·0.47030786],</span> | 322 | <span·class="go">·······[0.10758855,·0.6531324·,·0.4915261·],</span> |
323 | <span·class="go">·······[0.9418109·,·0.44126406,·0.20453954],</span> | 323 | <span·class="go">·······[0.14974728,·0.8607226·,·0.15923217],</span> |
324 | <span·class="go">·······[0.5063586·,·0.18852428,·0.73964417],</span> | 324 | <span·class="go">·······[0.40866554,·0.49934256,·0.9564412·],</span> |
325 | <span·class="go">·······[0.9421013·,·0.3941617·,·0.75893104],</span> | 325 | <span·class="go">·······[0.00705034,·0.8974011·,·0.53028136],</span> |
326 | <span·class="go">·······[0.310962··,·0.7817279·,·0.42892203]],·dtype=float32)</span> | 326 | <span·class="go">·······[0.3729126·,·0.8467917·,·0.359741··]],·dtype=float32)</span> |
327 | </pre></div> | 327 | </pre></div> |
328 | </div> | 328 | </div> |
329 | <p>You·can·use·<strong>GSD</strong>·without·needing·to·compile·C·code·to·read·<strong>GSD</strong>·files | 329 | <p>You·can·use·<strong>GSD</strong>·without·needing·to·compile·C·code·to·read·<strong>GSD</strong>·files |
330 | using·<a·class="reference·internal"·href="python-module-gsd.pygsd.html#gsd.pygsd.GSDFile"·title="gsd.pygsd.GSDFile"><code·class="xref·any·py·py-class·docutils·literal·notranslate"><span·class="pre">gsd.pygsd.GSDFile</span></code></a>·in·combination·with·<a·class="reference·internal"·href="python-module-gsd.hoomd.html#gsd.hoomd.HOOMDTrajectory"·title="gsd.hoomd.HOOMDTrajectory"><code·class="xref·any·py·py-class·docutils·literal·notranslate"><span·class="pre">gsd.hoomd.HOOMDTrajectory</span></code></a>.·It | 330 | using·<a·class="reference·internal"·href="python-module-gsd.pygsd.html#gsd.pygsd.GSDFile"·title="gsd.pygsd.GSDFile"><code·class="xref·any·py·py-class·docutils·literal·notranslate"><span·class="pre">gsd.pygsd.GSDFile</span></code></a>·in·combination·with·<a·class="reference·internal"·href="python-module-gsd.hoomd.html#gsd.hoomd.HOOMDTrajectory"·title="gsd.hoomd.HOOMDTrajectory"><code·class="xref·any·py·py-class·docutils·literal·notranslate"><span·class="pre">gsd.hoomd.HOOMDTrajectory</span></code></a>.·It |
331 | only·supports·the·<code·class="docutils·literal·notranslate"><span·class="pre">rb</span></code>·mode·and·does·not·read·files·as·fast·as·the·C | 331 | only·supports·the·<code·class="docutils·literal·notranslate"><span·class="pre">rb</span></code>·mode·and·does·not·read·files·as·fast·as·the·C |
332 | implementation.·It·takes·in·a·python·file-like·object,·so·it·can·be·used·with | 332 | implementation.·It·takes·in·a·python·file-like·object,·so·it·can·be·used·with |
333 | in-memory·IO·classes,·and·grid·file·classes·that·access·data·over·the·internet.</p> | 333 | in-memory·IO·classes,·and·grid·file·classes·that·access·data·over·the·internet.</p> |