Skip to content
Snippets Groups Projects
Commit 8dfcedbb authored by Ryan Godwin's avatar Ryan Godwin
Browse files

Adding some documentation and updating docker to python 3.10

parent 3175b286
No related branches found
No related tags found
1 merge request!2Feature/execute
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.224.2/containers/python-3-miniconda/.devcontainer/base.Dockerfile
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
ARG VARIANT="3.8-bullseye"
ARG VARIANT="3.10-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
......
......@@ -6,6 +6,13 @@ import neurokit2 as nk
def make_html(fig, output_file):
"""
It takes a matplotlib figure and saves it as an HTML file
Args:
fig: the figure object
output_file: the name of the output file
"""
# save figure as HTML file
html_str = mpld3.fig_to_html(fig)
output_html = Path(output_file).rename(output_file.with_suffix(".html"))
......@@ -15,6 +22,14 @@ def make_html(fig, output_file):
def plot_signals_comp(meg_values, ecg_values, output_file):
"""
It takes in two dataframes, plots them, and saves the plot to a file
Args:
meg_values: the MEG data
ecg_values: The ECG signal values
output_file: The name of the output file.
"""
fig, ax = plt.subplot(211)
print("Plotting Cardiac IC...")
......@@ -38,6 +53,14 @@ def plot_signals_comp(meg_values, ecg_values, output_file):
def plot_ecg(ecg_values, output_file):
"""
It takes in a list of ECG values and an output file name, and then plots the ECG values and saves
the plot to the output file
Args:
ecg_values: The raw ECG values
output_file: The name of the file to save the plot to.
"""
plt.close()
print("Plotting ECG...")
plt.plot(ecg_values[15000:25000], linewidth=1)
......@@ -53,4 +76,11 @@ def plot_ecg(ecg_values, output_file):
def nk_plotter(signals, output_file):
"""
It takes a list of signals and plots them
Args:
signals: a list of lists of signals. Each list of signals is a single ECG recording.
output_file: The name of the file you want to save the plot to.
"""
nk.plot_ecgs(signals)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment