Skip to content

Commit

Permalink
Improved Randi 2023 colours
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Sep 3, 2024
1 parent 15ecba1 commit cd24c36
Show file tree
Hide file tree
Showing 189 changed files with 122,210 additions and 315 deletions.
11 changes: 7 additions & 4 deletions cect/Cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,8 @@ def _generate_cell_table(cell_type, cells):

fig_md = ""

verbose = False

for syn_summary in syn_summaries:
fig = go.Figure()
fig.layout.showlegend = True
Expand All @@ -1723,10 +1725,11 @@ def _generate_cell_table(cell_type, cells):
conns_here = connectome.get_connections_from(cell, syn_type)
else:
conns_here = connectome.get_connections_to(cell, syn_type)
print_(
"Conns: %i for %s of type %s (%s)"
% (len(conns_here), cell, syn_type, syn_summary)
)
if verbose:
print_(
"Conns: %i for %s of type %s (%s)"
% (len(conns_here), cell, syn_type, syn_summary)
)
total_y += len(conns_here)

y.append(total_y)
Expand Down
17 changes: 13 additions & 4 deletions cect/ConnectomeDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,15 @@ def to_plotly_matrix_fig(self, synclass, view, color_continuous_scale=None):

conn_array = self.connections[synclass]

color_continuous_scale = (
POS_NEG_COLORMAP if synclass == "Functional" else DEFAULT_COLORMAP
)
zmin = np.min(conn_array)
zmax = np.max(conn_array)
color_continuous_scale = DEFAULT_COLORMAP

if synclass == "Functional":
color_continuous_scale = POS_NEG_COLORMAP
largest = max(abs(zmin), abs(zmax))
zmin = -1 * largest
zmax = largest

def get_color_html(color, node):
return f'<span style="color:{color};">{node}</span>'
Expand All @@ -278,11 +284,14 @@ def get_color_html(color, node):

fig = px.imshow(
conn_array,
labels=dict(x="Postsynaptic", y="Presynaptic", color="Synapses"),
labels=dict(x="Postsynaptic", y="Presynaptic", color="Weight"),
x=x_ticktext,
y=y_ticktext,
color_continuous_scale=color_continuous_scale,
zmin=zmin,
zmax=zmax,
)

fig.update(
data=[
{
Expand Down
2 changes: 1 addition & 1 deletion cect/ConnectomeReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from cect.Cells import PREFERRED_MUSCLE_NAMES

DEFAULT_COLORMAP = ["white", "green", "black"]
POS_NEG_COLORMAP = "Spectral_r"
POS_NEG_COLORMAP = ["darkblue", "blue", "white", "red", "darkred"]


def convert_to_preferred_muscle_name(muscle):
Expand Down
3 changes: 2 additions & 1 deletion cect/ConnectomeView.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def get_index_of_cell(self, cell):
RAW_VIEW.node_sets.append(NodeSet(cell, [cell], get_standard_color(cell)))


FULL_VIEW = View("Full View", [], EXC_INH_GJ_SYN_CLASSES)
FULL_VIEW = View("Full View", [], EXC_INH_GJ_FUNC_SYN_CLASSES)

for cell in (
sorted(SENSORY_NEURONS_COOK)
+ sorted(INTERNEURONS_NONPHARYNGEAL_COOK)
Expand Down
6 changes: 6 additions & 0 deletions docs/Randi2023_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Data extracted from the **WormNeuroAtlas package** for functional connectivity
```

=== "Full View"
=== "Functional"

```plotly
---8<-- "./assets/Randi2023_Full View_Functional.json"
```

=== "Pharynx View"
=== "Functional"

Expand Down
6 changes: 6 additions & 0 deletions docs/Randi2023_data_graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Data extracted from the **WormNeuroAtlas package** for functional connectivity
```

=== "Full View"
=== "Functional"

```plotly
---8<-- "./assets/Randi2023_Full View_Functional_graph.json"
```

=== "Pharynx View"
=== "Functional"

Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Full View_Chemical_Exc.json
Original file line number Diff line number Diff line change
Expand Up @@ -96734,9 +96734,11 @@
],
"layout": {
"coloraxis": {
"cmax": 75.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Full View_Chemical_Inh.json
Original file line number Diff line number Diff line change
Expand Up @@ -96734,9 +96734,11 @@
],
"layout": {
"coloraxis": {
"cmax": 13.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Full View_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -96734,9 +96734,11 @@
],
"layout": {
"coloraxis": {
"cmax": 250.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Pharynx View_Chemical_Exc.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,11 @@
],
"layout": {
"coloraxis": {
"cmax": 34.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Pharynx View_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,11 @@
],
"layout": {
"coloraxis": {
"cmax": 11.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Raw Data_Chemical.json
Original file line number Diff line number Diff line change
Expand Up @@ -225638,9 +225638,11 @@
],
"layout": {
"coloraxis": {
"cmax": 142.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Raw Data_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -225638,9 +225638,11 @@
],
"layout": {
"coloraxis": {
"cmax": 401.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Small View_Chemical.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@
],
"layout": {
"coloraxis": {
"cmax": 2341.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Small View_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@
],
"layout": {
"coloraxis": {
"cmax": 1894.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Social View_Chemical_Exc.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@
],
"layout": {
"coloraxis": {
"cmax": 6.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Herm_Social View_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@
],
"layout": {
"coloraxis": {
"cmax": 5.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Full View_Chemical_Exc.json
Original file line number Diff line number Diff line change
Expand Up @@ -96734,9 +96734,11 @@
],
"layout": {
"coloraxis": {
"cmax": 171.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Full View_Chemical_Inh.json
Original file line number Diff line number Diff line change
Expand Up @@ -96734,9 +96734,11 @@
],
"layout": {
"coloraxis": {
"cmax": 12.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Full View_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -96734,9 +96734,11 @@
],
"layout": {
"coloraxis": {
"cmax": 250.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Pharynx View_Chemical_Exc.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,11 @@
],
"layout": {
"coloraxis": {
"cmax": 34.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Pharynx View_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,11 @@
],
"layout": {
"coloraxis": {
"cmax": 11.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Raw Data_Chemical.json
Original file line number Diff line number Diff line change
Expand Up @@ -342238,9 +342238,11 @@
],
"layout": {
"coloraxis": {
"cmax": 194.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Raw Data_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -342238,9 +342238,11 @@
],
"layout": {
"coloraxis": {
"cmax": 400.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Small View_Chemical.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@
],
"layout": {
"coloraxis": {
"cmax": 2318.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Small View_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@
],
"layout": {
"coloraxis": {
"cmax": 2274.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Social View_Chemical_Exc.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@
],
"layout": {
"coloraxis": {
"cmax": 2.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/Cook2019Male_Social View_Electrical.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@
],
"layout": {
"coloraxis": {
"cmax": 6.0,
"cmin": 0.0,
"colorbar": {
"title": {
"text": "Synapses"
"text": "Weight"
}
},
"colorscale": [
Expand Down
Loading

0 comments on commit cd24c36

Please sign in to comment.