Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interactive GUI is essential for all new users of HNN to develop an
intuition on how to interact with the large-scale computational model to
study the multi-scale neural dynamics underlying their MEG/EEG data.
Once this intuition is gained, users who chose to can dive into the
computational neural modeling code, where further command line utily can
computational neural modeling code, where further command line utility can
be developed. As such, an equal goal is to enable the neural modeling
and coding community to participate in HNN development. We are
prioritizing best practices in open-source software design and the
Expand Down
10 changes: 6 additions & 4 deletions hnn_core/gui/_viz_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

from hnn_core.dipole import _rmse, average_dipoles
from hnn_core.gui._logging import logger
from hnn_core.network_models import default_drive_colors
from hnn_core.viz import plot_dipole

#
Expand Down Expand Up @@ -295,18 +296,19 @@ def _update_ax(fig, ax, single_simulation, sim_name, plot_type, plot_config):
if "evdist" in name:
if "evdist" not in drive_locations.keys():
drive_locations["evdist"] = drive["location"]
drive_colors["evdist"] = "g"
drive_colors["evdist"] = default_drive_colors["distal"]
# remove all increments of default 'evprox' inputs
elif "evprox" in name:
if "evprox" not in drive_locations.keys():
drive_locations["evprox"] = drive["location"]
drive_colors["evprox"] = "r"
drive_colors["evprox"] = default_drive_colors["proximal"]

else:
drive_locations[name] = drive["location"]
if drive["location"] == "proximal":
drive_colors[name] = "r"
drive_colors[name] = default_drive_colors["proximal"]
elif drive["location"] == "distal":
drive_colors[name] = "g"
drive_colors[name] = default_drive_colors["distal"]

# all drives to plot, excluding 'evdist' and 'evprox' increments
all_drives = list(drive_locations.keys())
Expand Down
7 changes: 0 additions & 7 deletions hnn_core/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,6 @@ def __init__(
)
else:
# Default behavior - create standard network
"""
wip:
so why not put cell name direct right?
1. will always need to create a cell object for using, might not satisfy the current problem solving reqs
2. What if more added in the future? makes the code modular aka, future proof!
"""
# wip: getting it from network_models this time
from .network_models import default_cell_metadata

cell_types_default = {
Expand Down
2 changes: 0 additions & 2 deletions hnn_core/network_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# serialisation / deserialisation) can import it without instantiating
# a full Network object.

# colors are a wip placeholder that will change post dev meet discussion
default_cell_metadata = {
"L2_basket": {
"morpho_type": "basket",
Expand Down Expand Up @@ -56,7 +55,6 @@
},
}

# same, placeholder, wip
default_drive_colors = {
"proximal": "r",
"distal": "g",
Expand Down
18 changes: 13 additions & 5 deletions hnn_core/param/jones2009_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
"electro_type": "inhibitory",
"layer": "2",
"measure_dipole": false,
"reference": "https://doi.org/10.7554/eLife.51214"
"reference": "https://doi.org/10.7554/eLife.51214",
"color": "m",
"marker": "x"
}
},
"L2_pyramidal": {
Expand Down Expand Up @@ -473,7 +475,9 @@
"electro_type": "excitatory",
"layer": "2",
"measure_dipole": true,
"reference": "https://doi.org/10.7554/eLife.51214"
"reference": "https://doi.org/10.7554/eLife.51214",
"color": "c",
"marker": "^"
}
},
"L5_basket": {
Expand Down Expand Up @@ -550,7 +554,9 @@
"electro_type": "inhibitory",
"layer": "5",
"measure_dipole": false,
"reference": "https://doi.org/10.7554/eLife.51214"
"reference": "https://doi.org/10.7554/eLife.51214",
"color": "r",
"marker": "x"
}
},
"L5_pyramidal": {
Expand Down Expand Up @@ -1144,7 +1150,7 @@
]
],
"nseg": 1,
"v0": -72,
"v0": -72.0,
"mechs": {
"hh2": {
"gkbar_hh2": 0.01,
Expand Down Expand Up @@ -1268,7 +1274,9 @@
"electro_type": "excitatory",
"layer": "5",
"measure_dipole": true,
"reference": "https://doi.org/10.7554/eLife.51214"
"reference": "https://doi.org/10.7554/eLife.51214",
"color": "b",
"marker": "^"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions hnn_core/tests/test_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import hnn_core
from hnn_core import read_params, jones_2009_model
from hnn_core.dipole import simulate_dipole
from hnn_core.network_models import default_cell_metadata
from hnn_core.viz import (
plot_cells,
plot_dipole,
Expand All @@ -21,7 +23,6 @@
plot_drive_strength,
NetworkPlotter,
)
from hnn_core.dipole import simulate_dipole

matplotlib.use("agg")

Expand Down Expand Up @@ -402,7 +403,6 @@ def _get_line_hex_colors(fig):
# Default colors should come from cell metadata
fig = net.cell_response.plot_spikes_raster(trial_idx=0, show=False)
colors, labels = _get_line_hex_colors(fig)
from hnn_core.network_models import default_cell_metadata

expected_cell_types = sorted(default_cell_metadata.keys())
expected_colors = [
Expand Down
11 changes: 10 additions & 1 deletion hnn_core/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def _get_cell_colors_from_metadata(cell_types_dict):
"""Get color and marker mappings (WIP) from cell_metadata.
"""Get color and marker mappings from cell_metadata.

Parameters
----------
Expand Down Expand Up @@ -571,6 +571,12 @@ def plot_spikes_hist(
spike_label: list() for spike_label in np.unique(list(spike_labels.values()))
}
spike_color = dict() # Store colors specified for each spike_label
# NOTE: Currently, since `CellResponse` only contains the "type" (aka drive name or
# cell name) of what produced each spike, but not whether that drive was proximal or
# distal, there is currently no way to apply the coloring of
# `hnn_core.network_models.default_drive_colors` to the spikes in this plot. If
# `CellResponse` is ever guaranteed access to the `Network` information in the
# future, then this will be fixable.
for spike_type, spike_label in spike_labels.items():
if spike_label not in spike_color:
if isinstance(color, dict):
Expand All @@ -582,6 +588,9 @@ def plot_spikes_hist(
color[spike_label], str, "Dictionary values of color", "str"
)
spike_color[spike_label] = color[spike_label]
elif spike_label in default_cell_metadata.keys():
# Overwrite spike colors if the spikes come from true cells
spike_color[spike_label] = default_cell_metadata[spike_label]["color"]
else:
spike_color[spike_label] = next(color_cycle)
spike_type_times[spike_label].extend(spike_times[spike_types_mask[spike_type]])
Expand Down
Loading