Changelog

Version 0.5.2

Key Updates:

  • Added tree path methods for retrieving ordered node sequences in tree graphs. These methods enable path distance calculations between any two nodes by returning the path length. See the tutorial for details.

  • Refactored path distance calculations in Section, Point, and Segment to use the new tree path methods.

  • Updated dependency versions: neuron >= 9.0.1; removed numpy < 2.0.0 constraint.

Minor Updates:

  • Added pairwise_synaptic_distances() function to the morphometric analysis module. This function uses the new path methods to calculate pairwise distances between synapses, which can be used for analyses such as synaptic clustering.

  • Added Section.get_location_coordinates() method returning 3D coordinates at a normalized position along a section. Added Synapse.xyz property derived from this, that enables synapse visualization on morphology plots.

  • Added Node.is_root cached property (with cache invalidation on parent changes). Replaces node.parent is None checks for more explicit root identification.

  • Added Section.domain_root property: traverses toward the root and returns the shallowest ancestor still belonging to the same domain. Replaces the within_domain parameter pattern.

  • Updated default parameters in the code generator to use the independent variable from the AST.

  • Removed hasattr checks in parameter setter (replaced with EAFP-style setattr).

Version 0.5.1

This release includes several minor bug fixes and improvements to MOD file parsing and conversion. It addresses issues #6 and #7.

Minor Updates:

  • Fixed an issue where the power operator (^) was not recognized when parsing MOD files.

  • Added a heuristic to the MOD file reader that moves misplaced assigned variables from PARAMETER to ASSIGNED blocks (e.g., v (mV) commonly found in PARAMETER blocks).

  • Updated the Jaxley template to properly access calcium concentration for Ca-dependent channels.

  • Modified code generators to fall back to default parameters in procedure calls, primarily for Jaxley-compatible code generation (e.g., compute_kinetic_variables(v) instead of compute_kinetic_variables()).

Version 0.5.0

Key Updates:

  • Updated the project license and added SPDX identifiers. See README and LICENSE for details.

  • Revised the tree-sorting algorithm to achieve deterministic indexing based solely on topology. Removed _sort_children from SectionTree and PointTree; both now use the inherited Tree sorting. Sorting is based only on subtree bifurcation counts; domain information is no longer used.

  • Added support for user-defined domain names and colors. Added a header to SWC files mapping types to names and colors. Refactored domain methods into clearer steps (add, update, extend).

  • Added per-synapse seeds to spike-generation functions to enable reproducible simulations.

  • Flattened model.population by removing sorting by synapse type. Replaced auto-generated names such as AMPA_0 with user-defined population names.

  • Reorganized how simulation stimuli are stored and referenced. Each protocol now has its own subfolder with a config.json plus three CSV files (recordings.csv, iclamps.csv, and synapses.csv). Added automatic handling of legacy stimuli formats.

Minor Updates:

  • Points now require domain_name and domain_color; sections and segments derive these from their first point. When domain attributes are updated, changes propagate to their points (e.g., domain.color updates point.domain_color for each point in the domain).

  • Moved domain creation to a dedicated factory function create_domains; domains now belong to Model, not SectionTree.

  • Renamed domain_idx to idx_within_domain in Section.

  • Ensured deterministic ordering of synapses within populations (sorted by section index and location).

  • Fixed “phantom synapses” via a new _clear_syn() method that fully removes NEURON instances.

  • Added a power distribution function for channel distribution models.

  • Replaced MSE with max_error as the metric for distribution fitting. Enforced low_val < high_val for step distributions.

  • download_example_data now fetches version-specific examples instead of always using the latest.

  • Enhanced PathManager to support the updated stimuli directory structure.

Version 0.4.6

This release resolves issues with fitting step-like distributions, introduces a workaround for channels with KINETIC blocks, adds prerun functionality for simulation stabilization, and further modularizes the model class implementation.

Key Updates:

  • Enhanced the fit_distribution method to support multiple candidate distribution types (polynomial and step functions by default), enabling accurate fitting of step-like distributions (e.g., for Ca2+ channels).

  • Implemented a workaround for MOD files containing a KINETIC block by introducing a FallbackChannel class. When a KINETIC block is detected, a FallbackChannel instance is created as a placeholder, allowing simulations to run. The fallback channel does not support typical visualization or standardization features, but it enables modification of the gbar parameter.

  • Added a prerun context manager for simulation stabilization, allowing users to run a pre-simulation period before the main simulation. For example, use model.run(duration=300, prerun_time=100) to stabilize the model for a period of 100 ms before running the main simulation for 300 ms.

  • Refactored the Model class by introducing IOMixin and SimulationMixin classes, separating file I/O operations as well as simulation and stimulus management from the core model functionality. This modular approach improves code maintainability while preserving a flat model interface.

Minor Updates:

  • Updated the path_to_data property of PathManager to ensure it returns the correct parent directory of path_to_model.

  • Updated vecstim.mod in the default MOD files for compatibility with Windows.

Version 0.4.5

This release introduces refined validation protocols, improvements in morphology reduction, and updates to the NMODL-to-Jaxley conversion template, along with several minor enhancements and bug fixes.

Key Updates:

  • Enhanced the time constant protocol by adopting a double exponential function for improved fitting precision.

  • Added a new analysis function for calculating the sag ratio, enabling better characterization of neuronal responses.

  • Updated the (plain) Jaxley template.

  • Improved iteration over dataframes using the itertuples method for better performance and type safety.

Minor Updates:

  • Enhanced the download_example_data function to include templates and default MOD files.

  • Added a tutorial for converting MOD files to Jaxley-compatible classes.

  • Improved parameter fitting when reducing morphologies by properly escaping cases where the mechanism is not in the domain (or if an equilibrium potential is not set for the domain).

  • Improved the logic to ensure the domains in a subtree have the same mechanisms when reducing morphologies.

  • Fixed minor issues with exporting distributions in reduced models.

Known Issues:

  • Polynomial fitting fails to accurately represent step-like distributions when reducing morphologies (fixed in version 0.4.6).

Version 0.4.4

This release addresses a bug introduced in version 0.4.3, where vectorized inputs to some distribution functions caused errors during parameter distribution using the model.distribute method. The issue has been addressed by reverting to the non-vectorized implementation, as the performance impact is minimal.

Version 0.4.3

This release improves performance and resolves several bugs.

Updates:

  • Fixed a bug where population loading ignored synapse types.

  • Enhanced parameter distribution performance by introducing cached properties for path distances: section.path_distance_to_root and section.path_distance_within_domain.

  • Resolved issues with re-segmentation involving stimuli and recordings. The model.set_segmentation method now correctly updates segments, preserving existing stimuli and recordings by temporarily exporting and reloading their configurations.

  • Renamed “Test” model to “Toy” model and refined its morphologies.

Version 0.4.2

This release fixes a bug introduced in version 0.4.1 where segments were not properly updated in the set_segmentation method.

Version 0.4.1

This release addresses minor bugs and improves the separation of NEURON-specific code from core classes.

Key Updates:

  • New NeuronSection and NeuronSegment subclasses encapsulating NEURON-specific functionality and separating it from the base Section and Segment classes.

  • Proper CVode handling and dt updates during simulation initialization.

Minor Updates:

  • Enhanced the PythonCodeGenerator class to handle MOD file procedures with no parameters, defaulting to ‘v’.

Version 0.4.0

This release enhances cross-platform compatibility and introduces a redesigned data structure for recording multiple variables, such as voltage and ion channel currents.

Key Updates:

  • Redesigned data structure for recordings with support for multiple variables. The model.recordings attribute now uses a nested dictionary to store variable names (e.g., ‘v’, ‘i_Na’) and their corresponding segment values. To record a variable, use the model.add_recording method, which now accepts var argument.

  • Improved cross-platform compatibility with resolved installation and MOD file compilation issues on Windows.

Minor Updates:

  • Renamed the ‘membrane’ subpackage and folder to ‘biophys’, along with updated methods for exporting and importing biophysical properties, such as model.export_biophys and model.load_biophys.

  • Renamed the model.export_stimuli_config method to model.export_stimuli.

  • Added a current_available attribute to each Mechanism to indicate whether the current through the channel can be recorded.

Version 0.3.1

This release includes a minor update to resolve issues encountered during the distribution upload process to PyPI.

Version 0.3.0

This release focuses on extending and reorganizing examples, and addressing minor bugs.

Key Updates:

  • Reorganized example notebooks and a new example model (Hay 2011).

  • Utility function for downloading examples from the repository.

  • Default MOD files and templates included in the distribution.

Minor Updates:

  • Replaced the prefix for standard channels.

  • Fixed the issue with parsing MOD files without TITLE.

  • Updated the standard CaDyn MOD file.

  • Improved SWC-to-domain mapping, resolving domains mismatched during export to NEURON.

  • Refined the template for exporting models to plain NEURON code.

  • Removed Jupyter from the dependencies.

Version 0.2.0

This release reintroduces morphology reduction functionality and provides the capability to export models in plain Python NEURON code.

Key Updates:

  • Morphology reduction subpackage for simplifying dendritic trees (based on neuron_reduce, Amsalem et al., 2020).

  • New functionality for fitting resultant distributions in reduced models with a polynomial (for easy I/O and post-reduction modifications).

  • New model_io module for exporting models in plain NEURON code using a Jinja2 template.

Minor Updates:

  • Updated the lambda_f function to align with NEURON’s implementation.

  • Added domain_idx to sections when adding a section to a domain.

  • Changed sorting algorithm to maintain SWC order by default when building morphological graphs, with an option to sort each node’s children by subtree size (smallest first).

  • Fixed a bug that caused failures in selecting synaptic locations.

  • Added an option to modify nseg per section.

  • Added node._tree reference to each node in the tree graph.

Version 0.1.0

This release marks a step forward in modularizing DendroTweaks, separating the core functionalities into a standalone Python library that integrates with the web-based app. The codebase is now more coherent and robust, with improved handling of neuronal morphology, ion channel kinetics, and model validation.

Key Updates:

  • New morphology subpackage for SWC file processing and model representation.

  • Improved MOD-to-Python converter

  • Improved modular I/O for morphologies, membrane mechanisms, and stimuli