bluecellulab 2.6.63__py3-none-any.whl → 2.6.65__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bluecellulab might be problematic. Click here for more details.

@@ -351,29 +351,32 @@ class BPAP:
351
351
  return soma_amp, dend_amps, dend_dist, apic_amps, apic_dist
352
352
 
353
353
  @staticmethod
354
- def fit(soma_amp, dend_amps, dend_dist, apic_amps, apic_dist):
354
+ def fit(soma_amp, branch_amps, branch_dist):
355
355
  """Fit the amplitudes vs distances to an exponential decay function."""
356
356
  from scipy.optimize import curve_fit
357
357
 
358
- popt_dend = None
359
- if dend_amps and dend_dist:
360
- dist = [0] + dend_dist # add soma distance
361
- amps = soma_amp + dend_amps # add soma amplitude
362
- popt_dend, _ = curve_fit(exp_decay, dist, amps)
363
-
364
- popt_apic = None
365
- if apic_amps and apic_dist:
366
- dist = [0] + apic_dist # add soma distance
367
- amps = soma_amp + apic_amps # add soma amplitude
368
- popt_apic, _ = curve_fit(exp_decay, dist, amps)
369
-
370
- return popt_dend, popt_apic
358
+ if not branch_amps or not branch_dist or len(branch_amps) != len(branch_dist):
359
+ return None, False
360
+ try:
361
+ dist = [0] + branch_dist
362
+ amps = soma_amp + branch_amps
363
+ popt, _ = curve_fit(exp_decay, dist, amps)
364
+ return popt, False
365
+ except RuntimeError:
366
+ return None, True
371
367
 
372
368
  def validate(self, soma_amp, dend_amps, dend_dist, apic_amps, apic_dist):
373
369
  """Check that the exponential fit is decaying."""
374
370
  validated = True
375
371
  notes = ""
376
- popt_dend, popt_apic = self.fit(soma_amp, dend_amps, dend_dist, apic_amps, apic_dist)
372
+ popt_dend, dend_fit_error = self.fit(soma_amp, dend_amps, dend_dist)
373
+ popt_apic, apic_fit_error = self.fit(soma_amp, apic_amps, apic_dist)
374
+ if dend_fit_error or apic_fit_error:
375
+ logger.debug("Fitting error occurred.")
376
+ validated = False
377
+ notes += "Validation failed: Fitting error occurred.\n"
378
+ return validated, notes
379
+
377
380
  if dend_amps is not None:
378
381
  plt.cla()
379
382
  plt.plot([0], soma_amp, '.')
@@ -415,7 +418,8 @@ class BPAP:
415
418
  output_fname="bpap.pdf",
416
419
  ):
417
420
  """Plot the results of the BPAP analysis."""
418
- popt_dend, popt_apic = self.fit(soma_amp, dend_amps, dend_dist, apic_amps, apic_dist)
421
+ popt_dend, _ = self.fit(soma_amp, dend_amps, dend_dist)
422
+ popt_apic, _ = self.fit(soma_amp, apic_amps, apic_dist)
419
423
 
420
424
  outpath = pathlib.Path(output_dir) / output_fname
421
425
  fig, ax1 = plt.subplots(figsize=(10, 6))
bluecellulab/tools.py CHANGED
@@ -40,7 +40,7 @@ def calculate_input_resistance(
40
40
  morphology_path: str | Path,
41
41
  template_format: str,
42
42
  emodel_properties: EmodelProperties | None,
43
- current_delta: float = 0.01,
43
+ current_delta: float = -0.02,
44
44
  section: str = "soma[0]",
45
45
  segx: float = 0.5
46
46
  ) -> float:
@@ -83,7 +83,7 @@ def plot_traces(recordings, out_dir, fname, title, labels=None, xlim=None):
83
83
  return outpath
84
84
 
85
85
 
86
- def spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
86
+ def spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-20.):
87
87
  """Spiking test: cell should spike."""
88
88
  stim_factory = StimulusFactory(dt=1.0)
89
89
  step_stimulus = stim_factory.idrest(threshold_current=rheobase, threshold_percentage=200)
@@ -194,7 +194,7 @@ def bpap_test(template_params, rheobase, out_dir="./"):
194
194
  }
195
195
 
196
196
 
197
- def ais_spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30.):
197
+ def ais_spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-20.):
198
198
  """AIS spiking test: axon should spike before soma."""
199
199
  name = "Simulatable Neuron AIS Spiking Validation"
200
200
  # Check that the cell has an axon
@@ -337,7 +337,7 @@ def rin_test(rin):
337
337
  }
338
338
 
339
339
 
340
- def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30., n_processes=None):
340
+ def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-20., n_processes=None):
341
341
  """IV curve should have a positive slope."""
342
342
  name = "Simulatable Neuron IV Curve Validation"
343
343
  amps, steady_states = compute_plot_iv_curve(
@@ -377,7 +377,7 @@ def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30., n_
377
377
  }
378
378
 
379
379
 
380
- def fi_test(template_params, rheobase, out_dir, spike_threshold_voltage=-30., n_processes=None):
380
+ def fi_test(template_params, rheobase, out_dir, spike_threshold_voltage=-20., n_processes=None):
381
381
  """FI curve should have a positive slope."""
382
382
  name = "Simulatable Neuron FI Curve Validation"
383
383
  amps, spike_counts = compute_plot_fi_curve(
@@ -449,7 +449,7 @@ def thumbnail_test(template_params, rheobase, out_dir):
449
449
  def run_validations(
450
450
  cell,
451
451
  cell_name,
452
- spike_threshold_voltage=-30,
452
+ spike_threshold_voltage=-20,
453
453
  v_init=-80.0,
454
454
  celsius=34.0,
455
455
  output_dir="./memodel_validation_figures",
@@ -489,6 +489,7 @@ def run_validations(
489
489
  morphology_path=cell.template_params.morph_filepath,
490
490
  template_format=cell.template_params.template_format,
491
491
  emodel_properties=cell.template_params.emodel_properties,
492
+ current_delta=-0.2 * rheobase,
492
493
  )
493
494
 
494
495
  logger.debug("Running validations...")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluecellulab
3
- Version: 2.6.63
3
+ Version: 2.6.65
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -10,12 +10,12 @@ bluecellulab/plotwindow.py,sha256=ePU-EegZ1Sqk0SoYYiQ6k24ZO4s3Hgfpx10uePiJ5xM,27
10
10
  bluecellulab/psection.py,sha256=FSOwRNuOTyB469BM-jPEf9l1J59FamXmzrQgBI6cnP4,6174
11
11
  bluecellulab/psegment.py,sha256=PTgoGLqM4oFIdF_8QHFQCU59j-8TQmtq6PakiGUQhIo,3138
12
12
  bluecellulab/rngsettings.py,sha256=2Ykb4Ylk3XTs58x1UIxjg8XJqjSpnCgKRZ8avXCDpxk,4237
13
- bluecellulab/tools.py,sha256=Wj3zEalJuyMzp0btoyWHXsCRpxyg6lNEuJfvmudlQmc,21767
13
+ bluecellulab/tools.py,sha256=EGrX1RQyaEIFEN9pvcw1oxBP_vONgcx7U7a2N_11Z_g,21768
14
14
  bluecellulab/type_aliases.py,sha256=DvgjERv2Ztdw_sW63JrZTQGpJ0x5uMTFB5hcBHDb0WA,441
15
15
  bluecellulab/utils.py,sha256=0NhwlzyLnSi8kziSfDsQf7pokO4qDkMJVAO33kSX4O0,2227
16
16
  bluecellulab/verbosity.py,sha256=T0IgX7DrRo19faxrT4Xzb27gqxzoILQ8FzYKxvUeaPM,1342
17
17
  bluecellulab/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- bluecellulab/analysis/analysis.py,sha256=W5MBCJthuuA7fFEJRZExONjTEWOhgDbtmTq23Cv7fbc,22449
18
+ bluecellulab/analysis/analysis.py,sha256=_ggribmdjerotj8u3qJYUojP7Y2IfKpGLZRBzFX8vdE,22596
19
19
  bluecellulab/analysis/inject_sequence.py,sha256=bpi_C1oz_G5cZv_CvvZG8SnGYaKIlDsIFHdkOAkDm-E,12666
20
20
  bluecellulab/analysis/plotting.py,sha256=PqRoaZz33ULMw8A9YnZXXrxcUd84M_dwlYMTFhG7YT4,3999
21
21
  bluecellulab/analysis/utils.py,sha256=eMirP557D11BuedgSqjripDxOq1haIldNbnYNetV1bg,121
@@ -74,10 +74,10 @@ bluecellulab/stimulus/stimulus.py,sha256=a_hKJUtZmIgjiFjbJf6RzUPokELqn0IHCgIWGw5
74
74
  bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
75
75
  bluecellulab/synapse/synapse_factory.py,sha256=NHwRMYMrnRVm_sHmyKTJ1bdoNmWZNU4UPOGu7FCi-PE,6987
76
76
  bluecellulab/synapse/synapse_types.py,sha256=zs_yBvGTH4QrbQF3nEViidyq1WM_ZcTSFdjUxB3khW0,16871
77
- bluecellulab/validation/validation.py,sha256=csy1xKOOWdlo3NYHdknePPxb7KBRTjoUV-81ZmWo2CM,20041
78
- bluecellulab-2.6.63.dist-info/licenses/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
79
- bluecellulab-2.6.63.dist-info/licenses/LICENSE,sha256=dAMAR2Sud4Nead1wGFleKiwTZfkTNZbzmuGfcTKb3kg,11335
80
- bluecellulab-2.6.63.dist-info/METADATA,sha256=J9j4rWRv1plUDoTz99tw1JxhVUNpJq4f1jk6qbLM5p4,8259
81
- bluecellulab-2.6.63.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
82
- bluecellulab-2.6.63.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
83
- bluecellulab-2.6.63.dist-info/RECORD,,
77
+ bluecellulab/validation/validation.py,sha256=n1KgQo41vFM7DZcVY3Yx8WOIfVE0ke0s7S-EeDDM6mQ,20080
78
+ bluecellulab-2.6.65.dist-info/licenses/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
79
+ bluecellulab-2.6.65.dist-info/licenses/LICENSE,sha256=dAMAR2Sud4Nead1wGFleKiwTZfkTNZbzmuGfcTKb3kg,11335
80
+ bluecellulab-2.6.65.dist-info/METADATA,sha256=7j3p6Wktfp4qD8zwGsVHN6YzOk_AL-uJ4so5Fmfgh0g,8259
81
+ bluecellulab-2.6.65.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
82
+ bluecellulab-2.6.65.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
83
+ bluecellulab-2.6.65.dist-info/RECORD,,