1111class Sensor (SynapseDevice ):
1212 """Base class for sensors"""
1313
14+ name : str = field (default = "sensor" , kw_only = True )
15+ """name of the sensor device"""
1416 sigma_noise : float = field (kw_only = True )
1517 """standard deviation of Gaussian noise in ΔF/F measurement"""
1618 dFF_1AP : float = field (kw_only = True )
@@ -73,15 +75,15 @@ class DynamicCalcium(CalciumModel):
7375 )
7476 """from eq 8 in Lütke et al., 2013"""
7577
76- Ca_rest : Quantity = field (kw_only = True )
78+ Ca_rest : Quantity = field (default = 50 * nmolar , kw_only = True )
7779 """resting Ca2+ concentration (molar)"""
78- gamma : Quantity = field (kw_only = True )
80+ gamma : Quantity = field (default = 292.3 / second , kw_only = True )
7981 """clearance/extrusion rate (1/sec)"""
80- B_T : Quantity = field (kw_only = True )
82+ B_T : Quantity = field (default = 200 * umolar , kw_only = True )
8183 """total indicator (buffer) concentration (molar)"""
82- kappa_S : float = field (kw_only = True )
84+ kappa_S : float = field (default = 110.0 , kw_only = True )
8385 """Ca2+ binding ratio of the endogenous buffer"""
84- dCa_T : Quantity = field (kw_only = True )
86+ dCa_T : Quantity = field (default = 7.6 * umolar , kw_only = True )
8587 """total Ca2+ concentration increase per spike (molar)"""
8688
8789 def init_syn_vars (self , syn : Synapses ) -> None :
@@ -95,7 +97,6 @@ class CalBindingActivationModel:
9597 model : str
9698
9799
98-
99100@define (eq = False )
100101class NullBindingActivation (CalBindingActivationModel ):
101102 """Doesn't model binding/activation; i.e., goes straight from [Ca2+] to ΔF/F"""
@@ -168,11 +169,11 @@ class LightExcitation(ExcitationModel):
168169 * exp(-k * Irr * soma_radius**2 * pi * (mwatt)) * (1/Hz)) : 1
169170 """ , init = False )
170171
171- baseline : float = field (kw_only = True )
172- A : float = field (kw_only = True )
173- n : float = field (kw_only = True )
174- ec50 : float = field (kw_only = True )
175- k : float = field (kw_only = True )
172+ baseline : float = field (default = 1.0 , kw_only = True )
173+ A : float = field (default = 1.0 , kw_only = True )
174+ n : float = field (default = 1.0 , kw_only = True )
175+ ec50 : float = field (default = 1.0 , kw_only = True )
176+ k : float = field (default = 0.0 , kw_only = True )
176177
177178@define (eq = False )
178179class GECI (Sensor ):
@@ -186,6 +187,7 @@ class GECI(Sensor):
186187 to data, rather than to biophysical processes before the data.
187188 """
188189
190+ name : str = field (default = "GECI" , kw_only = True )
189191 cal_model : CalciumModel = field (kw_only = True )
190192 bind_act_model : CalBindingActivationModel = field (kw_only = True )
191193 exc_model : ExcitationModel = field (kw_only = True )
@@ -251,9 +253,15 @@ def params(self) -> dict:
251253
252254@define (eq = False , slots = False )
253255class LightDependentGECI (GECI , LightDependent ):
254- """Light-dependent calcium indicator (not yet implemented)"""
255- """Uses a Hill equation to convert from Ca2+ to ΔF/F, as in Song et al., 2021"""
256- pass
256+ """Light-dependent calcium indicator"""
257+
258+ name : str = field (default = "LightDependentGECI" , kw_only = True )
259+
260+ def __attrs_post_init__ (self ):
261+ super ().__attrs_post_init__ ()
262+ # Ensure LightDependent mixin initialization runs to set spectrum defaults
263+ if hasattr (LightDependent , "__post_init__" ):
264+ LightDependent .__post_init__ (self )
257265
258266def geci (
259267 light_dependent : bool , doub_exp_conv : bool , pre_existing_cal : bool , ** kwparams
@@ -402,8 +410,6 @@ def geci_fn(
402410 ** extra_kwparams ,
403411 )
404412
405- # geci_fn.spectrum = spectrum
406-
407413 geci_fn .__doc__ += "\n \n " + (" " * 8 ) + extra_doc
408414
409415 globals ()[brian_safe_name (name .lower ())] = geci_fn
@@ -448,6 +454,7 @@ def load_geci_dataframe(name: str):
448454 return gcamp
449455 except Exception as e :
450456 print (f"Failed to register sensors from csv: { e } " )
457+
451458import matplotlib .pyplot as plt
452459def Plot_Generator (time_history , dFF_history , count ):
453460 for i in range (len (dFF_history [0 ])):
0 commit comments