Skip to content

Fix charge validation, bare excepts, and docstring error#9

Open
MichaelLod wants to merge 1 commit intoCortical-Labs:mainfrom
MichaelLod:fix/safety-and-quality-improvements
Open

Fix charge validation, bare excepts, and docstring error#9
MichaelLod wants to merge 1 commit intoCortical-Labs:mainfrom
MichaelLod:fix/safety-and-quality-improvements

Conversation

@MichaelLod
Copy link
Copy Markdown

Summary

Three small fixes across the SDK:

1. Charge injection validation now checks absolute value (src/cl/__init__.py)

StimDesign._validate only checked charge_pC > limit, so a cathodic (negative current) phase could bypass the 3.0 nC safety limit. For example, -3.0 uA × 1200 us = -3.6 nC would pass the check despite exceeding the charge injection limit. Changed to abs(charge_pC) > limit.

2. Bare except: replaced with except Exception: (_criticality.py, _functional_connectivity.py)

Bare except: catches KeyboardInterrupt, SystemExit, and GeneratorExit in addition to regular exceptions. This can mask issues during long-running analysis and prevent users from interrupting stuck computations.

3. Copy-paste docstring fix (_information_entropy.py)

_analyse_information_entropy docstring referenced analyse_lempel_ziv_complexity() instead of analyse_information_entropy().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant