Skip to content

Commit

Permalink
add notebook execution with hashing to build
Browse files Browse the repository at this point in the history
  • Loading branch information
dylansdaniels committed Feb 6, 2025
1 parent 02905d0 commit 5b3931b
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 496 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
home
# folders
local
references

# OS, run, and IDE artifacts
Expand Down
198 changes: 0 additions & 198 deletions backup_styles.css

This file was deleted.

35 changes: 15 additions & 20 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# %%
import os
# import re
import pypandoc
from create_page_index import update_page_index
from create_navbar import generate_navbar_html
# from bs4 import BeautifulSoup
from scripts.create_page_index import update_page_index
from scripts.create_navbar import generate_navbar_html
from scripts.convert_notebooks import convert_notebooks_to_html


# %% ######################################################################
def compile_page_components():
"""Compile base html components for building webpage"""

Expand All @@ -26,11 +24,6 @@ def compile_page_components():
return html_parts


html_parts = compile_page_components()
html_parts.keys()


# %%
def get_page_paths(path=None):
"""Get paths to all .md pages to be converted to html"""

Expand All @@ -50,10 +43,6 @@ def get_page_paths(path=None):
return md_pages


get_page_paths()


# %%
def generate_page_html(page_paths):
html_parts = compile_page_components()
order = [
Expand All @@ -66,6 +55,7 @@ def generate_page_html(page_paths):

for page, path in page_paths.items():
page_components = html_parts.copy()

# get path only
out_path = path.split(page)[0]

Expand All @@ -79,6 +69,7 @@ def generate_page_html(page_paths):

# remove leading `##_` from page
page = page.split("_", 1)[1]

# change file extension for page
page = page.split(".md")[0] + ".html"

Expand Down Expand Up @@ -108,7 +99,6 @@ def generate_page_html(page_paths):
converted = pypandoc.convert_file(
path,
to='html',
# format='md',
extra_args=["--mathml"],
)
except Exception as ex:
Expand All @@ -119,12 +109,11 @@ def generate_page_html(page_paths):
converted = pypandoc.convert_file(
path,
to='html',
# format='md',
extra_args=["--mathml"],
)
else:
raise ex
# format html for readability
# converted = BeautifulSoup(converted, 'html.parser').prettify()

page_components['body'] = converted

file_contents = ""
Expand All @@ -138,7 +127,13 @@ def generate_page_html(page_paths):
return


# %%
content_path = os.path.join(os.getcwd(), "content")
hash_path = os.path.join(os.getcwd(), "scripts", "notebook_hashes.json")

_ = convert_notebooks_to_html(
input_folder=content_path,
hash_path=hash_path,
)
page_paths = get_page_paths()
generate_page_html(page_paths)

# %%
21 changes: 11 additions & 10 deletions content/03_assumptions/primary_electric_currents.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,17 @@ <h1 id="primary-electrical-currents">3.3 Primary Electrical
horizontally-oriented oblique dendrites which do not have any vertical
length component, do not contribute to the dipole signal, whereas for
basal dendrites oriented at 45 degrees from the vertical axis, the
scaling is <span class="math inline">$-\sqrt{2}/2$</span> (note the
negative sign is because these dendrites are pointing downward). The
contribution from all neighboring compartments within a neuron is
integrated and then added to a value across the set of all pyramidal
neurons. As a result of the multiplication between axial current and
length, the model dipole output signal has the same units of measure as
the experimental data (in units of nano-Ampere-meters) and we are then
able to directly compare the two signals, as well as precisely tune
model parameters to match characteristics of recorded signals (Okada,
Wu, and Kyuhou 1997).</p>
scaling is
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi></mi><msqrt><mn>2</mn></msqrt><mi>/</mi><mn>2</mn></mrow><annotation encoding="application/x-tex">-\sqrt{2}/2</annotation></semantics></math>
(note the negative sign is because these dendrites are pointing
downward). The contribution from all neighboring compartments within a
neuron is integrated and then added to a value across the set of all
pyramidal neurons. As a result of the multiplication between axial
current and length, the model dipole output signal has the same units of
measure as the experimental data (in units of nano-Ampere-meters) and we
are then able to directly compare the two signals, as well as precisely
tune model parameters to match characteristics of recorded signals
(Okada, Wu, and Kyuhou 1997).</p>
<h2 id="tutorial-references">Tutorial References</h2>
<p>Okada, Y. C., J. Wu, and S. Kyuhou. 1997. “Genesis of MEG Signals in
a Mammalian CNS Structure.” Electroencephalography and Clinical
Expand Down
3 changes: 1 addition & 2 deletions content/06_alpha_beta/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@
# Blake Caldwell <[email protected]>
# Christopher Bailey <[email protected]>
-->
<!-- [[api_alpha_beta.ipynb]] -->
<p>[[api_alpha_beta]]</p>
<p>[[api_alpha_beta.ipynb]]</p>
</div> <!-- close content wrapper -->
</div> <!-- close content -->
</div> <!-- close main -->
Expand Down
Loading

0 comments on commit 5b3931b

Please sign in to comment.