-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ dc536bf 🚀
- Loading branch information
Showing
40 changed files
with
5,643 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 08305ee786fae082286401822252dc1d | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en" data-content_root="../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>dolomite_matrix.choose_dense_chunk_sizes — dolomite-matrix 0.0.post1.dev1+gdc536bf documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" /> | ||
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=233b9934" /> | ||
<script src="../../_static/documentation_options.js?v=79024f0b"></script> | ||
<script src="../../_static/doctools.js?v=888ff710"></script> | ||
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<link rel="index" title="Index" href="../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../search.html" /> | ||
|
||
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" /> | ||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> | ||
|
||
</head><body> | ||
|
||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
|
||
|
||
<div class="body" role="main"> | ||
|
||
<h1>Source code for dolomite_matrix.choose_dense_chunk_sizes</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Tuple</span> | ||
|
||
|
||
<div class="viewcode-block" id="choose_dense_chunk_sizes"> | ||
<a class="viewcode-back" href="../../api/dolomite_matrix.html#dolomite_matrix.choose_dense_chunk_sizes.choose_dense_chunk_sizes">[docs]</a> | ||
<span class="k">def</span> <span class="nf">choose_dense_chunk_sizes</span><span class="p">(</span><span class="n">shape</span><span class="p">:</span> <span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="n">size</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">min_extent</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> <span class="n">memory</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mf">1e7</span><span class="p">)</span> <span class="o">-></span> <span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">]:</span> | ||
<span class="w"> </span><span class="sd">"""Chosen some chunk sizes to use for a dense HDF5 dataset. For each</span> | ||
<span class="sd"> dimension, we consider a slice of the array that consists of the full</span> | ||
<span class="sd"> extent of all other dimensions. We want this slice to occupy less than</span> | ||
<span class="sd"> ``memory`` in memory, and we resize the slice along the current dimension</span> | ||
<span class="sd"> to achieve this. The chosen chunk size is then defined as the size of the</span> | ||
<span class="sd"> slice along the current dimension. This ensures that efficient iteration</span> | ||
<span class="sd"> along each dimension will not use any more than ``memory`` bytes.</span> | ||
|
||
<span class="sd"> Args:</span> | ||
<span class="sd"> shape: Shape of the array.</span> | ||
|
||
<span class="sd"> size: Size of each array element in bytes.</span> | ||
|
||
<span class="sd"> min_extent: </span> | ||
<span class="sd"> Minimum extent of each chunk dimension, to avoid problems</span> | ||
<span class="sd"> with excessively small chunk sizes when the data is large.</span> | ||
|
||
<span class="sd"> memory:</span> | ||
<span class="sd"> Size of the (conceptual) memory buffer to use for storing blocks of</span> | ||
<span class="sd"> data during iteration through the array, in bytes.</span> | ||
|
||
<span class="sd"> Returns:</span> | ||
<span class="sd"> Tuple containing the chunk dimensions.</span> | ||
<span class="sd"> """</span> | ||
|
||
<span class="n">num_elements</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">memory</span> <span class="o">/</span> <span class="n">size</span><span class="p">)</span> | ||
<span class="n">chunks</span> <span class="o">=</span> <span class="p">[]</span> | ||
|
||
<span class="k">for</span> <span class="n">d</span><span class="p">,</span> <span class="n">s</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">shape</span><span class="p">):</span> | ||
<span class="n">otherdim</span> <span class="o">=</span> <span class="mi">1</span> | ||
<span class="k">for</span> <span class="n">d2</span><span class="p">,</span> <span class="n">s2</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">shape</span><span class="p">):</span> <span class="c1"># just calculating it again to avoid overflow issues.</span> | ||
<span class="k">if</span> <span class="n">d2</span> <span class="o">!=</span> <span class="n">d</span><span class="p">:</span> | ||
<span class="n">otherdim</span> <span class="o">*=</span> <span class="n">s2</span> | ||
|
||
<span class="n">proposed</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">num_elements</span> <span class="o">/</span> <span class="n">otherdim</span><span class="p">)</span> | ||
<span class="k">if</span> <span class="n">proposed</span> <span class="o">></span> <span class="n">s</span><span class="p">:</span> | ||
<span class="n">proposed</span> <span class="o">=</span> <span class="n">s</span> | ||
<span class="k">elif</span> <span class="n">proposed</span> <span class="o"><</span> <span class="n">min_extent</span><span class="p">:</span> | ||
<span class="n">proposed</span> <span class="o">=</span> <span class="n">min_extent</span> | ||
|
||
<span class="n">chunks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">proposed</span><span class="p">)</span> | ||
|
||
<span class="k">return</span> <span class="p">(</span><span class="o">*</span><span class="n">chunks</span><span class="p">,)</span></div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> | ||
<div class="sphinxsidebarwrapper"> | ||
<h1 class="logo"><a href="../../index.html">dolomite-matrix</a></h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../readme.html">Overview</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../contributing.html">Contributions & Help</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../license.html">License</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../authors.html">Authors</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../changelog.html">Changelog</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../api/modules.html">Module Reference</a></li> | ||
</ul> | ||
|
||
<div class="relations"> | ||
<h3>Related Topics</h3> | ||
<ul> | ||
<li><a href="../../index.html">Documentation overview</a><ul> | ||
<li><a href="../index.html">Module code</a><ul> | ||
</ul></li> | ||
</ul></li> | ||
</ul> | ||
</div> | ||
<div id="searchbox" style="display: none" role="search"> | ||
<h3 id="searchlabel">Quick search</h3> | ||
<div class="searchformwrapper"> | ||
<form class="search" action="../../search.html" method="get"> | ||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> | ||
<input type="submit" value="Go" /> | ||
</form> | ||
</div> | ||
</div> | ||
<script>document.getElementById('searchbox').style.display = "block"</script> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="footer"> | ||
©2023, LTLA. | ||
|
||
| | ||
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.2.6</a> | ||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en" data-content_root="../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>dolomite_matrix.load_hdf5_dense_array — dolomite-matrix 0.0.post1.dev1+gdc536bf documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" /> | ||
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=233b9934" /> | ||
<script src="../../_static/documentation_options.js?v=79024f0b"></script> | ||
<script src="../../_static/doctools.js?v=888ff710"></script> | ||
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<link rel="index" title="Index" href="../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../search.html" /> | ||
|
||
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" /> | ||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> | ||
|
||
</head><body> | ||
|
||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
|
||
|
||
<div class="body" role="main"> | ||
|
||
<h1>Source code for dolomite_matrix.load_hdf5_dense_array</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Any</span> | ||
<span class="kn">from</span> <span class="nn">numpy</span> <span class="kn">import</span> <span class="n">bool_</span> | ||
<span class="kn">from</span> <span class="nn">filebackedarray</span> <span class="kn">import</span> <span class="n">Hdf5DenseArray</span> | ||
<span class="kn">from</span> <span class="nn">dolomite_base</span> <span class="kn">import</span> <span class="n">acquire_file</span> | ||
|
||
|
||
<div class="viewcode-block" id="load_hdf5_dense_array"> | ||
<a class="viewcode-back" href="../../api/dolomite_matrix.html#dolomite_matrix.load_hdf5_dense_array.load_hdf5_dense_array">[docs]</a> | ||
<span class="k">def</span> <span class="nf">load_hdf5_dense_array</span><span class="p">(</span><span class="n">meta</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">],</span> <span class="n">project</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Hdf5DenseArray</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Load a HDF5-backed dense array. In general, this function should be</span> | ||
<span class="sd"> called via :py:meth:`~dolomite_base.load_object.load_object`.</span> | ||
|
||
<span class="sd"> Args:</span> | ||
<span class="sd"> meta: Metadata for this HDF5 array.</span> | ||
|
||
<span class="sd"> project: Value specifying the project of interest. This is most</span> | ||
<span class="sd"> typically a string containing a file path to a staging directory</span> | ||
<span class="sd"> but may also be an application-specific object that works with</span> | ||
<span class="sd"> :py:meth:`~dolomite_base.acquire_file.acquire_file`.</span> | ||
|
||
<span class="sd"> kwargs: Further arguments, ignored.</span> | ||
|
||
<span class="sd"> Returns:</span> | ||
<span class="sd"> A HDF5-backed dense array.</span> | ||
<span class="sd"> """</span> | ||
<span class="n">fpath</span> <span class="o">=</span> <span class="n">acquire_file</span><span class="p">(</span><span class="n">project</span><span class="p">,</span> <span class="n">meta</span><span class="p">[</span><span class="s2">"path"</span><span class="p">])</span> | ||
<span class="n">name</span> <span class="o">=</span> <span class="n">meta</span><span class="p">[</span><span class="s2">"hdf5_dense_array"</span><span class="p">][</span><span class="s2">"dataset"</span><span class="p">]</span> | ||
|
||
<span class="n">dtype</span> <span class="o">=</span> <span class="kc">None</span> | ||
<span class="k">if</span> <span class="n">meta</span><span class="p">[</span><span class="s2">"array"</span><span class="p">][</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"boolean"</span><span class="p">:</span> | ||
<span class="n">dtype</span> <span class="o">=</span> <span class="n">bool_</span> | ||
|
||
<span class="k">return</span> <span class="n">Hdf5DenseArray</span><span class="p">(</span><span class="n">fpath</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">dtype</span><span class="p">,</span> <span class="n">native_order</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span></div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> | ||
<div class="sphinxsidebarwrapper"> | ||
<h1 class="logo"><a href="../../index.html">dolomite-matrix</a></h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../readme.html">Overview</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../contributing.html">Contributions & Help</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../license.html">License</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../authors.html">Authors</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../changelog.html">Changelog</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../api/modules.html">Module Reference</a></li> | ||
</ul> | ||
|
||
<div class="relations"> | ||
<h3>Related Topics</h3> | ||
<ul> | ||
<li><a href="../../index.html">Documentation overview</a><ul> | ||
<li><a href="../index.html">Module code</a><ul> | ||
</ul></li> | ||
</ul></li> | ||
</ul> | ||
</div> | ||
<div id="searchbox" style="display: none" role="search"> | ||
<h3 id="searchlabel">Quick search</h3> | ||
<div class="searchformwrapper"> | ||
<form class="search" action="../../search.html" method="get"> | ||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> | ||
<input type="submit" value="Go" /> | ||
</form> | ||
</div> | ||
</div> | ||
<script>document.getElementById('searchbox').style.display = "block"</script> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="footer"> | ||
©2023, LTLA. | ||
|
||
| | ||
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.2.6</a> | ||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
</body> | ||
</html> |
Oops, something went wrong.