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 :doc:`tutorial` for details. - Refactored path distance calculations in :code:`Section`, :code:`Point`, and :code:`Segment` to use the new tree path methods. - Updated dependency versions: :code:`neuron >= 9.0.1`; removed :code:`numpy < 2.0.0` constraint. Minor Updates: - Added :code:`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 :code:`Section.get_location_coordinates()` method returning 3D coordinates at a normalized position along a section. Added :code:`Synapse.xyz` property derived from this, that enables synapse visualization on morphology plots. - Added :code:`Node.is_root` cached property (with cache invalidation on parent changes). Replaces :code:`node.parent is None` checks for more explicit root identification. - Added :code:`Section.domain_root` property: traverses toward the root and returns the shallowest ancestor still belonging to the same domain. Replaces the :code:`within_domain` parameter pattern. - Updated default parameters in the code generator to use the independent variable from the AST. - Removed :code:`hasattr` checks in parameter setter (replaced with EAFP-style :code:`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 (:code:`^`) 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., :code:`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., :code:`compute_kinetic_variables(v)` instead of :code:`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 :code:`_sort_children` from :code:`SectionTree` and :code:`PointTree`; both now use the inherited :code:`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 :code:`model.population` by removing sorting by synapse type. Replaced auto-generated names such as :code:`AMPA_0` with user-defined population names. - Reorganized how simulation stimuli are stored and referenced. Each protocol now has its own subfolder with a :file:`config.json` plus three CSV files (:file:`recordings.csv`, :file:`iclamps.csv`, and :file:`synapses.csv`). Added automatic handling of legacy stimuli formats. Minor Updates: - Points now require :code:`domain_name` and :code:`domain_color`; sections and segments derive these from their first point. When domain attributes are updated, changes propagate to their points (e.g., :code:`domain.color` updates :code:`point.domain_color` for each point in the domain). - Moved domain creation to a dedicated factory function :code:`create_domains`; domains now belong to :code:`Model`, not :code:`SectionTree`. - Renamed :code:`domain_idx` to :code:`idx_within_domain` in :code:`Section`. - Ensured deterministic ordering of synapses within populations (sorted by section index and location). - Fixed "phantom synapses" via a new :code:`_clear_syn()` method that fully removes NEURON instances. - Added a power distribution function for channel distribution models. - Replaced MSE with :code:`max_error` as the metric for distribution fitting. Enforced :code:`low_val < high_val` for step distributions. - :code:`download_example_data` now fetches version-specific examples instead of always using the latest. - Enhanced :code:`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 :code:`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 :code:`FallbackChannel` class. When a KINETIC block is detected, a :code:`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 :code:`gbar` parameter. - Added a :code:`prerun` context manager for simulation stabilization, allowing users to run a pre-simulation period before the main simulation. For example, use :code:`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 :code:`Model` class by introducing :code:`IOMixin` and :code:`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 :code:`path_to_data` property of :code:`PathManager` to ensure it returns the correct parent directory of :code:`path_to_model`. - Updated :code:`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 :code:`itertuples` method for better performance and type safety. Minor Updates: - Enhanced the :code:`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 :code:`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: :code:`section.path_distance_to_root` and :code:`section.path_distance_within_domain`. - Resolved issues with re-segmentation involving stimuli and recordings. The :code:`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 :code:`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 :code:`NeuronSection` and :code:`NeuronSegment` subclasses encapsulating NEURON-specific functionality and separating it from the base :code:`Section` and :code:`Segment` classes. - Proper :code:`CVode` handling and :code:`dt` updates during simulation initialization. Minor Updates: - Enhanced the :code:`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 :code:`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 :code:`model.add_recording` method, which now accepts :code:`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 :code:`model.export_biophys` and :code:`model.load_biophys`. - Renamed the :code:`model.export_stimuli_config` method to :code:`model.export_stimuli`. - Added a :code:`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 :code:`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 :code:`model_io` module for exporting models in plain NEURON code using a Jinja2 template. Minor Updates: - Updated the :code:`lambda_f` function to align with NEURON's implementation. - Added :code:`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 :code:`nseg` per section. - Added :code:`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