-
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.
- Loading branch information
Showing
136 changed files
with
22,318 additions
and
1 deletion.
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
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
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: 661ee7406388d085c75b2b522d567f0f | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
195 changes: 195 additions & 0 deletions
195
docs/html/_modules/histopath_bim_des/config/arrivals.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,195 @@ | ||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" data-content_root="../../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>histopath_bim_des.config.arrivals — histopath-bim-des 0.0.0 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=80d5e7a1" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=19f00094" /> | ||
|
||
|
||
<!--[if lt IE 9]> | ||
<script src="../../../_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
<script src="../../../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script src="../../../_static/documentation_options.js?v=7026087e"></script> | ||
<script src="../../../_static/doctools.js?v=9a2dae69"></script> | ||
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script src="../../../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../../../index.html" class="icon icon-home"> | ||
histopath-bim-des | ||
</a> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Contents</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../config.html">Model Configuration</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../simulation.html">Simulation and KPI extraction</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../processes.html">Histopathology processes</a></li> | ||
</ul> | ||
<p class="caption" role="heading"><span class="caption-text">API reference:</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../apidoc/histopath_bim_des.html">histopath_bim_des package</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../../index.html">histopath-bim-des</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="../../index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">histopath_bim_des.config.arrivals</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for histopath_bim_des.config.arrivals</h1><div class="highlight"><pre> | ||
<span></span><span class="sd">"""Arrival process configuration module for the histopath simulation model."""</span> | ||
|
||
<span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">ty</span> | ||
|
||
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span> | ||
<span class="kn">import</span> <span class="nn">pydantic</span> <span class="k">as</span> <span class="nn">pyd</span> | ||
<span class="kn">from</span> <span class="nn">annotated_types</span> <span class="kn">import</span> <span class="n">Annotated</span><span class="p">,</span> <span class="n">Len</span> | ||
<span class="kn">from</span> <span class="nn">openpyxl</span> <span class="kn">import</span> <span class="n">Workbook</span> | ||
|
||
<span class="kn">from</span> <span class="nn">..</span> <span class="kn">import</span> <span class="n">excel</span> | ||
|
||
|
||
<div class="viewcode-block" id="ArrivalSchedule"> | ||
<a class="viewcode-back" href="../../../apidoc/histopath_bim_des.config.arrivals.html#histopath_bim_des.config.arrivals.ArrivalSchedule">[docs]</a> | ||
<span class="k">class</span> <span class="nc">ArrivalSchedule</span><span class="p">(</span><span class="n">pyd</span><span class="o">.</span><span class="n">BaseModel</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""An arrival schedule for specimens."""</span> | ||
|
||
<span class="n">rates</span><span class="p">:</span> <span class="n">Annotated</span><span class="p">[</span><span class="n">ty</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">pyd</span><span class="o">.</span><span class="n">NonNegativeFloat</span><span class="p">],</span> <span class="n">Len</span><span class="p">(</span><span class="mi">168</span><span class="p">,</span> <span class="mi">168</span><span class="p">)]</span> | ||
<span class="s2">"Hourly arrival rates for the arrival process, for one week (168 hours)."</span> | ||
|
||
<div class="viewcode-block" id="ArrivalSchedule.from_pd"> | ||
<a class="viewcode-back" href="../../../apidoc/histopath_bim_des.config.arrivals.html#histopath_bim_des.config.arrivals.ArrivalSchedule.from_pd">[docs]</a> | ||
<span class="nd">@staticmethod</span> | ||
<span class="k">def</span> <span class="nf">from_pd</span><span class="p">(</span><span class="n">df</span><span class="p">:</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="s1">'ArrivalSchedule'</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""Construct an arrival schedule from a dataframe with the 24 hours the day as rows</span> | ||
<span class="sd"> and the seven days of the week as columns (starting on Monday). Each value is the</span> | ||
<span class="sd"> arrival rate for one hour of the week</span> | ||
|
||
<span class="sd"> Args:</span> | ||
<span class="sd"> df: The dataframe containing the arrival schedule information.</span> | ||
|
||
<span class="sd"> Returns:</span> | ||
<span class="sd"> The ArrivalSchedule object.</span> | ||
<span class="sd"> """</span> | ||
<span class="k">return</span> <span class="vm">__class__</span><span class="p">(</span><span class="n">rates</span><span class="o">=</span><span class="n">df</span><span class="o">.</span><span class="n">to_numpy</span><span class="p">()</span><span class="o">.</span><span class="n">flatten</span><span class="p">(</span><span class="s1">'F'</span><span class="p">)</span><span class="o">.</span><span class="n">tolist</span><span class="p">())</span> <span class="c1"># F = column-major order</span></div> | ||
</div> | ||
|
||
|
||
|
||
<div class="viewcode-block" id="ArrivalSchedules"> | ||
<a class="viewcode-back" href="../../../apidoc/histopath_bim_des.config.arrivals.html#histopath_bim_des.config.arrivals.ArrivalSchedules">[docs]</a> | ||
<span class="k">class</span> <span class="nc">ArrivalSchedules</span><span class="p">(</span><span class="n">pyd</span><span class="o">.</span><span class="n">BaseModel</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""Dataclass for tracking the specimen arrival schedules of the histopathology model."""</span> | ||
|
||
<span class="n">cancer</span><span class="p">:</span> <span class="n">ArrivalSchedule</span> | ||
<span class="w"> </span><span class="sd">"""Arrival schedule for cancer pathway specimens."""</span> | ||
|
||
<span class="n">noncancer</span><span class="p">:</span> <span class="n">ArrivalSchedule</span> | ||
<span class="w"> </span><span class="sd">"""Arrival schedule for non-cancer pathway specimens."""</span> | ||
|
||
<div class="viewcode-block" id="ArrivalSchedules.from_workbook"> | ||
<a class="viewcode-back" href="../../../apidoc/histopath_bim_des.config.arrivals.html#histopath_bim_des.config.arrivals.ArrivalSchedules.from_workbook">[docs]</a> | ||
<span class="nd">@staticmethod</span> | ||
<span class="k">def</span> <span class="nf">from_workbook</span><span class="p">(</span><span class="n">wbook</span><span class="p">:</span> <span class="n">Workbook</span><span class="p">)</span> <span class="o">-></span> <span class="s1">'ArrivalSchedules'</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""Construct a dataclass instance from an Excel workbook.</span> | ||
|
||
<span class="sd"> Args:</span> | ||
<span class="sd"> wbook: The Excel workbook to parse.</span> | ||
|
||
<span class="sd"> Returns:</span> | ||
<span class="sd"> The parsed dataclass instance.</span> | ||
<span class="sd"> """</span> | ||
<span class="n">arrival_schedule_cancer_df</span> <span class="o">=</span> <span class="p">(</span> | ||
<span class="n">df</span> <span class="o">:=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span> | ||
<span class="p">(</span> | ||
<span class="n">table</span> <span class="o">:=</span> <span class="n">excel</span><span class="o">.</span><span class="n">get_table</span><span class="p">(</span><span class="n">wbook</span><span class="p">,</span> <span class="s1">'Arrival Schedules'</span><span class="p">,</span> <span class="s1">'ArrivalScheduleCancer'</span><span class="p">)</span> | ||
<span class="p">)[</span><span class="mi">1</span><span class="p">:],</span> | ||
<span class="n">columns</span><span class="o">=</span><span class="n">table</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> | ||
<span class="p">)</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="s1">'Hour'</span><span class="p">)</span> | ||
<span class="p">)</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">df</span><span class="o">.</span><span class="n">index</span> <span class="o">!=</span> <span class="s1">'Total'</span><span class="p">]</span> | ||
|
||
<span class="n">arrival_schedule_noncancer_df</span> <span class="o">=</span> <span class="p">(</span> | ||
<span class="n">df</span> <span class="o">:=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span> | ||
<span class="p">(</span> | ||
<span class="n">table</span> <span class="o">:=</span> <span class="n">excel</span><span class="o">.</span><span class="n">get_table</span><span class="p">(</span><span class="n">wbook</span><span class="p">,</span> <span class="s1">'Arrival Schedules'</span><span class="p">,</span> <span class="s1">'ArrivalScheduleNonCancer'</span><span class="p">)</span> | ||
<span class="p">)[</span><span class="mi">1</span><span class="p">:],</span> | ||
<span class="n">columns</span><span class="o">=</span><span class="n">table</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> | ||
<span class="p">)</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="s1">'Hour'</span><span class="p">)</span> | ||
<span class="p">)</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">df</span><span class="o">.</span><span class="n">index</span> <span class="o">!=</span> <span class="s1">'Total'</span><span class="p">]</span> | ||
|
||
<span class="k">return</span> <span class="n">ArrivalSchedules</span><span class="p">(</span> | ||
<span class="n">cancer</span><span class="o">=</span><span class="n">ArrivalSchedule</span><span class="o">.</span><span class="n">from_pd</span><span class="p">(</span><span class="n">arrival_schedule_cancer_df</span><span class="p">),</span> | ||
<span class="n">noncancer</span><span class="o">=</span><span class="n">ArrivalSchedule</span><span class="o">.</span><span class="n">from_pd</span><span class="p">(</span><span class="n">arrival_schedule_noncancer_df</span><span class="p">),</span> | ||
<span class="p">)</span></div> | ||
</div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2024, Yin-Chi Chan, Nicola Moretti.</p> | ||
</div> | ||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | ||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.