Skip to content

Commit

Permalink
Synaptic delay entered in the junction definition overrides the gener…
Browse files Browse the repository at this point in the history
…ic synaptic delay value.
  • Loading branch information
EmineTopcu committed Jul 20, 2023
1 parent b5d26ad commit 94cf263
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 69 deletions.
51 changes: 24 additions & 27 deletions SiliFish.UI/Controls/Model Edit/InterPoolControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions SiliFish.UI/Controls/Model Edit/InterPoolControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ public void SetInterPoolTemplate(List<CellPoolTemplate> pools, InterPoolTemplate
numMaxOutgoing.SetValue(interPoolTemplate.CellReach.MaxOutgoing);

numConductance.SetValue(interPoolTemplate.Weight);
numDelay.SetValue(interPoolTemplate.Delay_ms);
eFixedDuration.Text = interPoolTemplate.FixedDuration_ms?.ToString() ?? "";
eSynDelay.Text = interPoolTemplate.Delay_ms?.ToString() ?? "";
if (interPoolTemplate.SynapseParameters != null)
{
synapseControl.SetSynapseParameters(interPoolTemplate.SynapseParameters);
Expand All @@ -286,6 +286,9 @@ public InterPoolTemplate GetInterPoolTemplate()
double? fixedDuration = null;
if (!string.IsNullOrEmpty(eFixedDuration.Text) && double.TryParse(eFixedDuration.Text, out double fd))
fixedDuration = fd;
double? synDelay = null;
if (!string.IsNullOrEmpty(eSynDelay.Text) && double.TryParse(eSynDelay.Text, out double sd))
synDelay = sd;
interPoolTemplate.CellReach = new CellReach
{
Ascending = cbAscending.Checked,
Expand All @@ -303,8 +306,8 @@ public InterPoolTemplate GetInterPoolTemplate()
interPoolTemplate.ConnectionType = ddConnectionType.SelectedItem != null ? (ConnectionType)ddConnectionType.SelectedItem : ConnectionType.NotSet;
interPoolTemplate.DistanceMode = (DistanceMode)Enum.Parse(typeof(DistanceMode), ddDistanceMode.Text);
interPoolTemplate.Weight = (double)numConductance.Value;
interPoolTemplate.Delay_ms = (double)numDelay.Value;
interPoolTemplate.FixedDuration_ms = fixedDuration;
interPoolTemplate.Delay_ms = synDelay;
interPoolTemplate.Name = eName.Text;
interPoolTemplate.Description = eDescription.Text;
interPoolTemplate.Probability = (double)numProbability.Value;
Expand Down
27 changes: 12 additions & 15 deletions SiliFish.UI/Controls/Model Edit/JunctionControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions SiliFish.UI/Controls/Model Edit/JunctionControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public void SetJunction(JunctionBase junction, bool newJunc)
sourceCell = gapJunction.Cell1;
targetCell = gapJunction.Cell2;
numConductance.SetValue(gapJunction.Weight);
numDelay.SetValue(gapJunction.Delay_ms);
eFixedDuration.Text = gapJunction.FixedDuration_ms.ToString();
eSynDelay.Text = gapJunction.Delay_ms.ToString();
ddConnectionType.SelectedItem = ConnectionType.Gap;
}
else if (junction is ChemicalSynapse syn)
Expand All @@ -164,8 +164,8 @@ public void SetJunction(JunctionBase junction, bool newJunc)
ddConnectionType.SelectedItem = targetCell is MuscleCell ? ConnectionType.NMJ : ConnectionType.Synapse;
synapseControl.SetSynapseParameters(syn.SynapseParameters);
numConductance.SetValue(syn.Weight);
numDelay.SetValue(syn.Delay_ms);
eFixedDuration.Text = syn.FixedDuration_ms.ToString();
eSynDelay.Text = syn.Delay_ms.ToString();
}
if (this.junction != null)
{
Expand Down Expand Up @@ -270,7 +270,9 @@ public List<JunctionBase> GetJunctions()
double? fixedDuration = null;
if (!string.IsNullOrEmpty(eFixedDuration.Text) && double.TryParse(eFixedDuration.Text, out double fd))
fixedDuration = fd;
double delay = (double)numDelay.Value;
double? delay = null;
if (!string.IsNullOrEmpty(eSynDelay.Text) && double.TryParse(eSynDelay.Text, out double sd))
delay = sd;
double conductance = (double)numConductance.Value;
DistanceMode distanceMode = (DistanceMode)Enum.Parse(typeof(DistanceMode), ddDistanceMode.Text);
List<JunctionBase> junctions = new();
Expand Down
Binary file modified SiliFish.UI/Resources/BuildDate.txt
Binary file not shown.
2 changes: 1 addition & 1 deletion SiliFish.UI/SiliFish.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>2.5.1</Version>
<Version>2.5.2</Version>
<PackageIcon>fishbone2BlueBG.png</PackageIcon>
<ApplicationIcon>Resources\fishbone2BlueBG.ico</ApplicationIcon>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
Expand Down
2 changes: 0 additions & 2 deletions SiliFish/Definitions/GlobalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public class GlobalSettings

public static bool SameYAxis = true;
public static bool ShowZeroValues = true;

public static int DefaultPlotWidth = 800;

public static int DefaultPlotHeight = 200;

public static int MaxNumberOfUnits = 100;
Expand Down
8 changes: 6 additions & 2 deletions SiliFish/ModelUnits/Architecture/ModelSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ public class ModelSettings
[Description("Default conduction velocity of currents between cells."),
DisplayName("Conduction Velocity"),
Category("Default Values")]
public double cv { get; set; } = 0.2;
public double cv { get; set; } = 0.2;

[Description("Default delay in chemical synapses."),
DisplayName("Synaptic Delay"),
Category("Default Values")]
public double syanptic_delay { get; set; } = 0.5;
public double synaptic_delay { get; set; } = 0.5;
[Description("Default delay in electrical junctions."),
DisplayName("Gap Junction Delay"),
Category("Default Values")]
public double gap_delay { get; set; } = 0;

[Description("Default reversal potential of glutamate."),
Category("Default Values")]
Expand Down
4 changes: 2 additions & 2 deletions SiliFish/ModelUnits/Cells/CellPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public void ReachToCellPoolViaGapJunction(CellPool target,
double weight,
double probability,
DistanceMode distanceMode,
double delay_ms,
double? delay_ms,
double? fixedduration_ms)
{
int maxIncoming = reach.MaxIncoming;
Expand Down Expand Up @@ -476,7 +476,7 @@ public void ReachToCellPoolViaChemSynapse(CellPool target,
double weight,
double probability,
DistanceMode distanceMode,
double delay_ms,
double? delay_ms,
double? fixedduration_ms)
{
int maxIncoming = reach.MaxIncoming;
Expand Down
9 changes: 5 additions & 4 deletions SiliFish/ModelUnits/Junction/ChemicalSynapse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public override void ImportValues(List<string> values)
Core.Conductance = Weight;
if (double.TryParse(values[iter++], out double d))
FixedDuration_ms = d;
Delay_ms = double.Parse(values[iter++]);
if (double.TryParse(values[iter++], out double dd))
Delay_ms = dd;
Active = bool.Parse(values[iter++]);
if (iter < values.Count)
TimeLine_ms.ImportValues(new[] { values[iter++] }.ToList());
Expand Down Expand Up @@ -186,8 +187,8 @@ public override void InitForSimulation(int nmax, bool trackCurrent)
else
{
double distance = Util.Distance(PreNeuron.Coordinate, PostCell.Coordinate, DistanceMode);
int delay = (int)((Delay_ms + model.Settings.syanptic_delay) / model.RunParam.DeltaT);
duration = Math.Max((int)(distance / (PreNeuron.ConductionVelocity * model.RunParam.DeltaT)), 1);
int delay = (int)((Delay_ms ?? model.Settings.synaptic_delay) / model.RunParam.DeltaT);
duration = Math.Max((int)Math.Round(distance / (PreNeuron.ConductionVelocity * model.RunParam.DeltaT)), 1);
duration += delay;
}
}
Expand All @@ -196,7 +197,7 @@ public void SetFixedDuration(double dur)
{
FixedDuration_ms = dur;
}
public void SetDelay(double delay)
public void SetDelay(double? delay)
{
Delay_ms = delay;
}
Expand Down
Loading

0 comments on commit 94cf263

Please sign in to comment.