Skip to content

Commit

Permalink
move out label exclusion to argument
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD committed Sep 19, 2024
1 parent 10ee743 commit feaf5f3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
9 changes: 7 additions & 2 deletions 001075/001075_paper_figure_1d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
"outputs": [],
"source": [
"subject_id = \"26\"\n",
"session_id = \"20211104-163944\""
"session_id = \"20211104-163944\"\n",
"\n",
"exclude_labels = [\"AMsoL\", \"AMsoR\", \"AMso\", \"AMSoL\", \"AMSoR\", \"AmSo\"]"
]
},
{
Expand Down Expand Up @@ -82,7 +84,10 @@
}
],
"source": [
"utils_001075.plot_waterfall(segmentation_nwbfile=segmentation_nwbfile)"
"utils_001075.plot_waterfall(\n",
" segmentation_nwbfile=segmentation_nwbfile,\n",
" exclude_labels=exclude_labels,\n",
")"
]
},
{
Expand Down
15 changes: 13 additions & 2 deletions 001075/utils_001075/_waterfall.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

import matplotlib.pyplot
import numpy
import pynwb
Expand All @@ -7,24 +9,34 @@
def plot_waterfall(
*,
segmentation_nwbfile: pynwb.NWBFile,
exclude_labels: Optional[list] = None,
suppress_deviations: bool = True,
suppress_deviations_threshold: float = 40.0,
) -> None:
"""
Recreate the Fig 1d. from "Neural signal propagation atlas of Caenorhabditis elegans".
Recreate the waterfall similar to Fig 1d. from "Neural signal propagation atlas of Caenorhabditis elegans".
Parameters
----------
imaging_nwbfile : pynwb.NWBFile
The NWBFile containing the imaging data.
segmentation_nwbfile : pynwb.NWBFile
The NWBFile containing the segmentation data.
exclude_labels : list, optional
A list of NeuroPAL lables to exclude from plotting.

Check failure on line 26 in 001075/utils_001075/_waterfall.py

View workflow job for this annotation

GitHub Actions / Check for spelling errors

lables ==> labels
For example, Fig 1d from the paper (which used session "20211104-163944" of subject 26)
excluded ["AMsoL", "AMsoR", "AMso", "AMSoL", "AMSoR", "AmSo"].
suppress_deviations : bool, default: True
FOr unknown reasons, about 10 traces in the figure reproduction do not match the original figure from the paper.
If True, suppresses the plotting of lines with deviations greater than the threshold.
suppress_deviations_threshold : float, default: 40.0
The threshold for the deviation of a line to be suppressed.
"""
exclude_labels = exclude_labels or []

# Always exclude unlabelled ROIs
excluded_labels = ["", " "] + exclude_labels

# Actual parameters values as inferred from the fig1_commands.txt record
savgol_filter_size = 13
savgol_shift = (savgol_filter_size - 1) // 2
Expand All @@ -33,7 +45,6 @@ def plot_waterfall(

# Hardcoded parameters from the original plot function
Delta = 5.0
excluded_labels = ["", " ", "AMsoL", "AMsoR", "AMso", "AMSoL", "AMSoR", "AmSo"]

# Fetch data from NWB source
green_signal = segmentation_nwbfile.processing["ophys"]["GreenSignals"].microscopy_response_series["GreenSignal"]
Expand Down

0 comments on commit feaf5f3

Please sign in to comment.