dendra 0.27.2__tar.gz
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.
- dendra-0.27.2/LICENSE.md +39 -0
- dendra-0.27.2/PKG-INFO +161 -0
- dendra-0.27.2/README.md +106 -0
- dendra-0.27.2/dendra/__init__.py +257 -0
- dendra-0.27.2/dendra/__main__.py +5 -0
- dendra-0.27.2/dendra/_bootstrap.py +217 -0
- dendra-0.27.2/dendra/cli.py +51 -0
- dendra-0.27.2/dendra/const.py +34 -0
- dendra-0.27.2/dendra/data/__init__.py +5 -0
- dendra-0.27.2/dendra/data/h5.py +145 -0
- dendra-0.27.2/dendra/diagnostics.py +367 -0
- dendra-0.27.2/dendra/func/__init__.py +53 -0
- dendra-0.27.2/dendra/func/_binding.py +116 -0
- dendra-0.27.2/dendra/func/_callbacks.py +1326 -0
- dendra-0.27.2/dendra/func/_compiled.py +394 -0
- dendra-0.27.2/dendra/func/_execution.py +94 -0
- dendra-0.27.2/dendra/func/_lowered.py +163 -0
- dendra-0.27.2/dendra/func/_population.py +11505 -0
- dendra-0.27.2/dendra/func/_runners.py +1257 -0
- dendra-0.27.2/dendra/func/_scan.py +185 -0
- dendra-0.27.2/dendra/func/_scan_autograd.py +57 -0
- dendra-0.27.2/dendra/func/_scan_compat.py +233 -0
- dendra-0.27.2/dendra/func/_stimuli.py +1574 -0
- dendra-0.27.2/dendra/func/_types.py +227 -0
- dendra-0.27.2/dendra/helpers.py +849 -0
- dendra-0.27.2/dendra/models/__init__.py +31 -0
- dendra-0.27.2/dendra/models/_class_declarations.py +173 -0
- dendra-0.27.2/dendra/models/_morphology_scene.py +536 -0
- dendra-0.27.2/dendra/models/analysis/__init__.py +139 -0
- dendra-0.27.2/dendra/models/analysis/activation_witness.py +211 -0
- dendra-0.27.2/dendra/models/analysis/batched_threshold_protocol.py +373 -0
- dendra-0.27.2/dendra/models/analysis/branch_conditioned_metrics.py +738 -0
- dendra-0.27.2/dendra/models/analysis/callback_horizon.py +134 -0
- dendra-0.27.2/dendra/models/analysis/callback_margin.py +262 -0
- dendra-0.27.2/dendra/models/analysis/descriptors.py +6532 -0
- dendra-0.27.2/dendra/models/analysis/event_margin_training.py +283 -0
- dendra-0.27.2/dendra/models/analysis/firing_rate_trajectory.py +179 -0
- dendra-0.27.2/dendra/models/analysis/hard_threshold_gradient.py +252 -0
- dendra-0.27.2/dendra/models/analysis/hard_transition_table.py +169 -0
- dendra-0.27.2/dendra/models/analysis/hard_transition_validation.py +337 -0
- dendra-0.27.2/dendra/models/analysis/spike_timing.py +300 -0
- dendra-0.27.2/dendra/models/analysis/threshold_event_root.py +348 -0
- dendra-0.27.2/dendra/models/analysis/threshold_noise_metrics.py +182 -0
- dendra-0.27.2/dendra/models/analysis/threshold_protocol.py +182 -0
- dendra-0.27.2/dendra/models/analysis/threshold_trace_probe.py +429 -0
- dendra-0.27.2/dendra/models/analysis/threshold_trace_tangent.py +549 -0
- dendra-0.27.2/dendra/models/analysis/threshold_transition_jets.py +103 -0
- dendra-0.27.2/dendra/models/analysis/threshold_transition_metrics.py +162 -0
- dendra-0.27.2/dendra/models/backend.py +78 -0
- dendra-0.27.2/dendra/models/callbacks.py +1947 -0
- dendra-0.27.2/dendra/models/core.py +10320 -0
- dendra-0.27.2/dendra/models/distributions.py +218 -0
- dendra-0.27.2/dendra/models/extcell.py +311 -0
- dendra-0.27.2/dendra/models/fields/__init__.py +64 -0
- dendra-0.27.2/dendra/models/fields/analytic.py +390 -0
- dendra-0.27.2/dendra/models/fields/line.py +199 -0
- dendra-0.27.2/dendra/models/fields/precomputed.py +1143 -0
- dendra-0.27.2/dendra/models/fields/quasipotentials.py +158 -0
- dendra-0.27.2/dendra/models/fields/spherical_cartesian.py +41 -0
- dendra-0.27.2/dendra/models/graph.py +163 -0
- dendra-0.27.2/dendra/models/heterogeneous/__init__.py +5 -0
- dendra-0.27.2/dendra/models/heterogeneous/compartments.py +141 -0
- dendra-0.27.2/dendra/models/initialization.py +247 -0
- dendra-0.27.2/dendra/models/instruments/__init__.py +3 -0
- dendra-0.27.2/dendra/models/instruments/thresholder.py +1154 -0
- dendra-0.27.2/dendra/models/integrators/__init__.py +86 -0
- dendra-0.27.2/dendra/models/integrators/cable.py +108 -0
- dendra-0.27.2/dendra/models/integrators/core.py +905 -0
- dendra-0.27.2/dendra/models/integrators/explicit.py +811 -0
- dendra-0.27.2/dendra/models/integrators/imex.py +369 -0
- dendra-0.27.2/dendra/models/integrators/implicit.py +1038 -0
- dendra-0.27.2/dendra/models/integrators/tree.py +1841 -0
- dendra-0.27.2/dendra/models/integrators/tree_bt.py +600 -0
- dendra-0.27.2/dendra/models/integrators/tridiag/__init__.py +3 -0
- dendra-0.27.2/dendra/models/integrators/tridiag/block.py +219 -0
- dendra-0.27.2/dendra/models/integrators/tridiag/pcr.py +203 -0
- dendra-0.27.2/dendra/models/integrators/triton/__init__.py +28 -0
- dendra-0.27.2/dendra/models/integrators/triton/_contracts.py +351 -0
- dendra-0.27.2/dendra/models/integrators/triton/bt_kernel.py +298 -0
- dendra-0.27.2/dendra/models/integrators/triton/bt_spd_kernel.py +733 -0
- dendra-0.27.2/dendra/models/integrators/triton/dhs_kernel.py +654 -0
- dendra-0.27.2/dendra/models/integrators/triton/dhs_kernel_bt.py +479 -0
- dendra-0.27.2/dendra/models/integrators/triton/dhs_kernel_multi.py +889 -0
- dendra-0.27.2/dendra/models/integrators/triton/pcr_kernel_thomas.py +226 -0
- dendra-0.27.2/dendra/models/integrators/triton/t_kernel_thomas.py +232 -0
- dendra-0.27.2/dendra/models/intrinsic.py +139 -0
- dendra-0.27.2/dendra/models/io.py +1238 -0
- dendra-0.27.2/dendra/models/mechanisms/__init__.py +46 -0
- dendra-0.27.2/dendra/models/mechanisms/_bufferimplicit.py +420 -0
- dendra-0.27.2/dendra/models/mechanisms/_cnexp.py +143 -0
- dendra-0.27.2/dendra/models/mechanisms/_derivimplicit.py +831 -0
- dendra-0.27.2/dendra/models/mechanisms/_euler_heun.py +199 -0
- dendra-0.27.2/dendra/models/mechanisms/_euler_maruyama.py +152 -0
- dendra-0.27.2/dendra/models/mechanisms/_handler.py +2946 -0
- dendra-0.27.2/dendra/models/mechanisms/_ions.py +316 -0
- dendra-0.27.2/dendra/models/mechanisms/_kinetic.py +365 -0
- dendra-0.27.2/dendra/models/mechanisms/_linearimplicit.py +595 -0
- dendra-0.27.2/dendra/models/mechanisms/_material_process.py +2545 -0
- dendra-0.27.2/dendra/models/mechanisms/_materials.py +407 -0
- dendra-0.27.2/dendra/models/mechanisms/_mechanism.py +4340 -0
- dendra-0.27.2/dendra/models/mechanisms/_numerical.py +431 -0
- dendra-0.27.2/dendra/models/mechanisms/_rosenbrock.py +456 -0
- dendra-0.27.2/dendra/models/mechanisms/_solve_utils.py +284 -0
- dendra-0.27.2/dendra/models/mechanisms/_solvers.py +129 -0
- dendra-0.27.2/dendra/models/mechanisms/_spatial.py +1799 -0
- dendra-0.27.2/dendra/models/mechanisms/_state.py +2410 -0
- dendra-0.27.2/dendra/models/mechanisms/_support.py +760 -0
- dendra-0.27.2/dendra/models/mechanisms/_support_registry.py +466 -0
- dendra-0.27.2/dendra/models/mechanisms/_symbolic.py +246 -0
- dendra-0.27.2/dendra/models/mechanisms/compilers/__init__.py +0 -0
- dendra-0.27.2/dendra/models/mechanisms/compilers/ast.py +363 -0
- dendra-0.27.2/dendra/models/mechanisms/compilers/source.py +121 -0
- dendra-0.27.2/dendra/models/mechanisms/ode.py +515 -0
- dendra-0.27.2/dendra/models/mechanisms/ops.py +133 -0
- dendra-0.27.2/dendra/models/mechanisms/validate.py +6 -0
- dendra-0.27.2/dendra/models/mod/ALPHASYNAPSE.py +63 -0
- dendra-0.27.2/dendra/models/mod/ALPHASYNAPSE_D.py +77 -0
- dendra-0.27.2/dendra/models/mod/APCOUNT.py +42 -0
- dendra-0.27.2/dendra/models/mod/APCOUNT_D.py +132 -0
- dendra-0.27.2/dendra/models/mod/EXP2SYN.py +138 -0
- dendra-0.27.2/dendra/models/mod/EXPSYN.py +60 -0
- dendra-0.27.2/dendra/models/mod/FIRE.py +23 -0
- dendra-0.27.2/dendra/models/mod/FIRE_D.py +84 -0
- dendra-0.27.2/dendra/models/mod/FIRE_R.py +51 -0
- dendra-0.27.2/dendra/models/mod/FIRE_R_D.py +124 -0
- dendra-0.27.2/dendra/models/mod/GRADED_SYNAPSE.py +414 -0
- dendra-0.27.2/dendra/models/mod/HH.py +96 -0
- dendra-0.27.2/dendra/models/mod/PAS.py +25 -0
- dendra-0.27.2/dendra/models/mod/SPIKEDETECT.py +160 -0
- dendra-0.27.2/dendra/models/mod/__init__.py +117 -0
- dendra-0.27.2/dendra/models/modular.py +232 -0
- dendra-0.27.2/dendra/models/morphology.py +3539 -0
- dendra-0.27.2/dendra/models/morphology_io.py +606 -0
- dendra-0.27.2/dendra/models/morphology_visualization.py +3244 -0
- dendra-0.27.2/dendra/models/multi.py +1049 -0
- dendra-0.27.2/dendra/models/networks/__init__.py +3 -0
- dendra-0.27.2/dendra/models/networks/net.py +5125 -0
- dendra-0.27.2/dendra/models/networks/netcon.py +6063 -0
- dendra-0.27.2/dendra/models/networks/netcon_bitpack_contracts.py +160 -0
- dendra-0.27.2/dendra/models/networks/netcon_bitpack_kernel.cpp +149 -0
- dendra-0.27.2/dendra/models/networks/netcon_bitpack_kernel.cu +228 -0
- dendra-0.27.2/dendra/models/networks/netcon_bitpack_ops.py +712 -0
- dendra-0.27.2/dendra/models/networks/netcon_bitpack_ops_triton.py +285 -0
- dendra-0.27.2/dendra/models/networks/netstim.py +1603 -0
- dendra-0.27.2/dendra/models/networks/spiking.py +96 -0
- dendra-0.27.2/dendra/models/networks/utils.py +36 -0
- dendra-0.27.2/dendra/models/parametric.py +4182 -0
- dendra-0.27.2/dendra/models/random_parameters.py +423 -0
- dendra-0.27.2/dendra/models/rng.py +429 -0
- dendra-0.27.2/dendra/models/slice.py +2445 -0
- dendra-0.27.2/dendra/models/stim/__init__.py +4 -0
- dendra-0.27.2/dendra/models/stim/extra.py +200 -0
- dendra-0.27.2/dendra/models/stim/intra.py +278 -0
- dendra-0.27.2/dendra/models/stim/waveform/__init__.py +25 -0
- dendra-0.27.2/dendra/models/stim/waveform/_gates.py +65 -0
- dendra-0.27.2/dendra/models/stim/waveform/core.py +708 -0
- dendra-0.27.2/dendra/models/stim/waveform/implementations.py +860 -0
- dendra-0.27.2/dendra/models/tree.py +1269 -0
- dendra-0.27.2/dendra/models/utils.py +134 -0
- dendra-0.27.2/dendra/models/visualization.py +1791 -0
- dendra-0.27.2/dendra/opt/__init__.py +5 -0
- dendra-0.27.2/dendra/opt/utils.py +103 -0
- dendra-0.27.2/dendra/stepping.py +158 -0
- dendra-0.27.2/dendra/units.py +151 -0
- dendra-0.27.2/dendra/utils/__init__.py +21 -0
- dendra-0.27.2/dendra/utils/dynamic_compilation.py +82 -0
- dendra-0.27.2/dendra/utils/gpu.py +49 -0
- dendra-0.27.2/dendra/utils/interpolation.py +4418 -0
- dendra-0.27.2/dendra/utils/neuron.py +151 -0
- dendra-0.27.2/dendra/utils/tensor_ops.py +287 -0
- dendra-0.27.2/dendra.egg-info/PKG-INFO +161 -0
- dendra-0.27.2/dendra.egg-info/SOURCES.txt +328 -0
- dendra-0.27.2/dendra.egg-info/dependency_links.txt +1 -0
- dendra-0.27.2/dendra.egg-info/entry_points.txt +2 -0
- dendra-0.27.2/dendra.egg-info/requires.txt +46 -0
- dendra-0.27.2/dendra.egg-info/top_level.txt +1 -0
- dendra-0.27.2/pyproject.toml +96 -0
- dendra-0.27.2/setup.cfg +4 -0
- dendra-0.27.2/setup.py +19 -0
- dendra-0.27.2/tests/test_accelerator_dispatch_contracts.py +396 -0
- dendra-0.27.2/tests/test_activation_witness.py +98 -0
- dendra-0.27.2/tests/test_analysis.py +632 -0
- dendra-0.27.2/tests/test_analysis_public_api.py +56 -0
- dendra-0.27.2/tests/test_analysis_reference_matrix.py +1184 -0
- dendra-0.27.2/tests/test_analysis_training_integration.py +112 -0
- dendra-0.27.2/tests/test_batched_extracellular_contract.py +468 -0
- dendra-0.27.2/tests/test_batched_intracellular_contract.py +325 -0
- dendra-0.27.2/tests/test_batched_threshold_protocol.py +252 -0
- dendra-0.27.2/tests/test_block_pcr_solver.py +212 -0
- dendra-0.27.2/tests/test_bootstrap.py +275 -0
- dendra-0.27.2/tests/test_branch_conditioned_metrics.py +475 -0
- dendra-0.27.2/tests/test_builtin_spike_mechanisms.py +253 -0
- dendra-0.27.2/tests/test_callback_horizon.py +93 -0
- dendra-0.27.2/tests/test_callback_margin.py +227 -0
- dendra-0.27.2/tests/test_callbacks.py +637 -0
- dendra-0.27.2/tests/test_compartment_id_model_helper.py +172 -0
- dendra-0.27.2/tests/test_compile_device_policy.py +185 -0
- dendra-0.27.2/tests/test_coverage_policy.py +111 -0
- dendra-0.27.2/tests/test_cuda_adversarial_solvers.py +462 -0
- dendra-0.27.2/tests/test_cuda_multi_compile.py +71 -0
- dendra-0.27.2/tests/test_cuda_solver_parity.py +439 -0
- dendra-0.27.2/tests/test_cuda_solver_vmap.py +230 -0
- dendra-0.27.2/tests/test_cuda_tree_solver_vmap.py +356 -0
- dendra-0.27.2/tests/test_current_expression_robustness.py +614 -0
- dendra-0.27.2/tests/test_delayed_state_metadata_validation.py +234 -0
- dendra-0.27.2/tests/test_derivimplicit_robustness.py +408 -0
- dendra-0.27.2/tests/test_diagnostics.py +81 -0
- dendra-0.27.2/tests/test_distribution_checks.py +113 -0
- dendra-0.27.2/tests/test_docs_gradient_descent.py +93 -0
- dendra-0.27.2/tests/test_dufort_trajectory_correctness.py +466 -0
- dendra-0.27.2/tests/test_event_margin_training.py +255 -0
- dendra-0.27.2/tests/test_exp2syn_normalization.py +191 -0
- dendra-0.27.2/tests/test_firing_rate_trajectory.py +123 -0
- dendra-0.27.2/tests/test_h5_persistence.py +274 -0
- dendra-0.27.2/tests/test_handler_initialization_transaction.py +231 -0
- dendra-0.27.2/tests/test_hard_threshold_gradient.py +127 -0
- dendra-0.27.2/tests/test_hard_transition_table.py +79 -0
- dendra-0.27.2/tests/test_hard_transition_validation.py +190 -0
- dendra-0.27.2/tests/test_helpers.py +391 -0
- dendra-0.27.2/tests/test_imex_rng_lifecycle.py +839 -0
- dendra-0.27.2/tests/test_initialization_transforms.py +303 -0
- dendra-0.27.2/tests/test_integrator_explicit_implicit.py +1243 -0
- dendra-0.27.2/tests/test_integrator_krylov.py +204 -0
- dendra-0.27.2/tests/test_interpolation_coverage.py +620 -0
- dendra-0.27.2/tests/test_intrinsic_activity.py +293 -0
- dendra-0.27.2/tests/test_io.py +50 -0
- dendra-0.27.2/tests/test_io_from_neuron_topology.py +325 -0
- dendra-0.27.2/tests/test_ion_current_read_synchronization.py +500 -0
- dendra-0.27.2/tests/test_ion_material_holistic_correctness.py +370 -0
- dendra-0.27.2/tests/test_ions.py +276 -0
- dendra-0.27.2/tests/test_material_extracellular_relaxation.py +317 -0
- dendra-0.27.2/tests/test_material_holistic_correctness.py +644 -0
- dendra-0.27.2/tests/test_material_initialization_correctness.py +260 -0
- dendra-0.27.2/tests/test_material_process_author_protocol.py +176 -0
- dendra-0.27.2/tests/test_material_registry_contracts.py +319 -0
- dendra-0.27.2/tests/test_mechanism_checkpoint_support_identity.py +143 -0
- dendra-0.27.2/tests/test_mechanism_deletion_contract.py +691 -0
- dendra-0.27.2/tests/test_mechanism_lifecycle_matrix.py +1918 -0
- dendra-0.27.2/tests/test_mechanism_ops.py +85 -0
- dendra-0.27.2/tests/test_mechanism_solver_matrix.py +785 -0
- dendra-0.27.2/tests/test_mechanism_spatial_material.py +963 -0
- dendra-0.27.2/tests/test_mechanism_support_spec.py +811 -0
- dendra-0.27.2/tests/test_mechanism_symbolic_correctness_wave.py +617 -0
- dendra-0.27.2/tests/test_modular_parameter_controls.py +101 -0
- dendra-0.27.2/tests/test_morphology_asc.py +361 -0
- dendra-0.27.2/tests/test_morphology_composition.py +411 -0
- dendra-0.27.2/tests/test_morphology_d_lambda.py +497 -0
- dendra-0.27.2/tests/test_morphology_deletion.py +315 -0
- dendra-0.27.2/tests/test_morphology_import.py +546 -0
- dendra-0.27.2/tests/test_morphology_swc.py +292 -0
- dendra-0.27.2/tests/test_morphology_updates.py +890 -0
- dendra-0.27.2/tests/test_morphology_visualization.py +2562 -0
- dendra-0.27.2/tests/test_mps_population_runtime.py +181 -0
- dendra-0.27.2/tests/test_multi_component_label_registry.py +154 -0
- dendra-0.27.2/tests/test_native_cable.py +1522 -0
- dendra-0.27.2/tests/test_native_morphology.py +418 -0
- dendra-0.27.2/tests/test_native_morphology_contract.py +513 -0
- dendra-0.27.2/tests/test_neuron_required_matrix.py +448 -0
- dendra-0.27.2/tests/test_numerical_current_contract.py +475 -0
- dendra-0.27.2/tests/test_ode.py +107 -0
- dendra-0.27.2/tests/test_ode_symbolic_portability.py +215 -0
- dendra-0.27.2/tests/test_opt_sanitize_grad.py +152 -0
- dendra-0.27.2/tests/test_packaging_policy.py +47 -0
- dendra-0.27.2/tests/test_parametric.py +454 -0
- dendra-0.27.2/tests/test_parametric_contracts.py +996 -0
- dendra-0.27.2/tests/test_passive_end_diameter.py +171 -0
- dendra-0.27.2/tests/test_passive_end_nodes.py +472 -0
- dendra-0.27.2/tests/test_population_axis_mechanism_lifecycle.py +401 -0
- dendra-0.27.2/tests/test_population_axis_mechanism_storage.py +747 -0
- dendra-0.27.2/tests/test_population_find_names.py +253 -0
- dendra-0.27.2/tests/test_population_lifecycle_state_machine.py +298 -0
- dendra-0.27.2/tests/test_population_preserve_multiplicity.py +157 -0
- dendra-0.27.2/tests/test_population_run_duration_contract.py +351 -0
- dendra-0.27.2/tests/test_population_runtime.py +547 -0
- dendra-0.27.2/tests/test_population_single_pass_initialization.py +342 -0
- dendra-0.27.2/tests/test_random_parameter_distributions.py +105 -0
- dendra-0.27.2/tests/test_random_parameters.py +205 -0
- dendra-0.27.2/tests/test_recorder_h5_integration.py +265 -0
- dendra-0.27.2/tests/test_regional_material_diffusion.py +494 -0
- dendra-0.27.2/tests/test_repeat_gradients.py +281 -0
- dendra-0.27.2/tests/test_repeat_serialization.py +128 -0
- dendra-0.27.2/tests/test_restart_replay_matrix.py +379 -0
- dendra-0.27.2/tests/test_retained_helper_utilities.py +233 -0
- dendra-0.27.2/tests/test_runtime_noise_and_state_sde.py +520 -0
- dendra-0.27.2/tests/test_safe_source_robustness.py +176 -0
- dendra-0.27.2/tests/test_scalar_multi_universal.py +456 -0
- dendra-0.27.2/tests/test_scaled_waveform_frequency.py +203 -0
- dendra-0.27.2/tests/test_shared_support_current_aggregation.py +883 -0
- dendra-0.27.2/tests/test_shared_support_field_reads.py +295 -0
- dendra-0.27.2/tests/test_slice_indexing_contract.py +616 -0
- dendra-0.27.2/tests/test_slice_injection_simulation_contract.py +279 -0
- dendra-0.27.2/tests/test_slice_label_propagation.py +386 -0
- dendra-0.27.2/tests/test_slice_label_propagation_index_forms.py +239 -0
- dendra-0.27.2/tests/test_slice_mutation_contract.py +501 -0
- dendra-0.27.2/tests/test_slice_state_machine.py +436 -0
- dendra-0.27.2/tests/test_slice_structure_simulation_contract.py +212 -0
- dendra-0.27.2/tests/test_spatial_solver_selection.py +304 -0
- dendra-0.27.2/tests/test_spike_timing.py +215 -0
- dendra-0.27.2/tests/test_spiking_and_distributions.py +121 -0
- dendra-0.27.2/tests/test_state.py +67 -0
- dendra-0.27.2/tests/test_state_author_protocol.py +221 -0
- dendra-0.27.2/tests/test_state_transition_output_validation.py +279 -0
- dendra-0.27.2/tests/test_step_api.py +136 -0
- dendra-0.27.2/tests/test_stim_execution_matrix.py +882 -0
- dendra-0.27.2/tests/test_support_registry.py +402 -0
- dendra-0.27.2/tests/test_temperature_lifecycle_contracts.py +281 -0
- dendra-0.27.2/tests/test_threshold_descriptor_example.py +52 -0
- dendra-0.27.2/tests/test_threshold_event_root.py +217 -0
- dendra-0.27.2/tests/test_threshold_noise_metrics.py +113 -0
- dendra-0.27.2/tests/test_threshold_protocol.py +222 -0
- dendra-0.27.2/tests/test_threshold_trace_probe.py +369 -0
- dendra-0.27.2/tests/test_threshold_trace_tangent.py +362 -0
- dendra-0.27.2/tests/test_threshold_transition_jets.py +78 -0
- dendra-0.27.2/tests/test_threshold_transition_metrics.py +300 -0
- dendra-0.27.2/tests/test_thresholder.py +715 -0
- dendra-0.27.2/tests/test_topology_transformations.py +761 -0
- dendra-0.27.2/tests/test_tree_axon_invariant_regressions.py +208 -0
- dendra-0.27.2/tests/test_tree_geometry_dtype_precision.py +141 -0
- dendra-0.27.2/tests/test_tree_integrator_dense_reference.py +655 -0
- dendra-0.27.2/tests/test_tree_integrator_reference_matrix.py +608 -0
- dendra-0.27.2/tests/test_tree_multi_reference_matrix.py +712 -0
- dendra-0.27.2/tests/test_tree_named_material_geometry.py +724 -0
- dendra-0.27.2/tests/test_units.py +96 -0
- dendra-0.27.2/tests/test_utils.py +904 -0
- dendra-0.27.2/tests/test_utils_neuron_tree_paths.py +158 -0
- dendra-0.27.2/tests/test_visualization.py +617 -0
- dendra-0.27.2/tests/test_voltage_solvers.py +311 -0
- dendra-0.27.2/tests/test_waveform.py +44 -0
- dendra-0.27.2/tests/test_waveform_gradients.py +229 -0
- dendra-0.27.2/tests/test_waveform_timing.py +286 -0
dendra-0.27.2/LICENSE.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
This Agreement, effective as of the date the software is downloaded (“EFFECTIVE DATE”) is between Duke University ("DUKE"), a non-profit institution of higher education, and you (“YOU”), an individual accessing, downloading, or using the software.
|
|
2
|
+
|
|
3
|
+
WHEREAS, DUKE owns and holds certain rights, title and interest to copyrighted software pertaining to OTC File T-008477 (“PROGRAM”); and
|
|
4
|
+
|
|
5
|
+
WHEREAS, DUKE owns and holds certain rights, title, and interest to the following patent application/issued patent (PATENT APPLICATION NO. 18/182,018) for the technology described in OTC File T-007793 (“PATENT RIGHTS"); and
|
|
6
|
+
|
|
7
|
+
WHEREAS, DUKE desires to distribute the PROGRAM for academic, non-commercial research use and testing, and to promote marketing and commercialization of the PATENT RIGHTS, DUKE herein agrees to grant a limited license to the PROGRAM for research, non-commercial purposes only, with DUKE retaining all other rights and uses to both the PATENT RIGHTS and the PROGRAM;
|
|
8
|
+
|
|
9
|
+
THEREFORE, DUKE hereby agrees to make the PROGRAM available to YOU, subject to the following terms and conditions:
|
|
10
|
+
|
|
11
|
+
1. Grant.
|
|
12
|
+
|
|
13
|
+
(a) Subject to the terms of this Agreement, DUKE hereby grants YOU a royalty-free, non-transferable, non-exclusive, worldwide license under its copyright to use, reproduce, modify, publicly display, and perform the PROGRAM solely for non-commercial research and/or academic testing purposes.
|
|
14
|
+
|
|
15
|
+
(b) In order to obtain any further license rights, including the right to use the PROGRAM, any modifications or derivatives made by YOU, and/or PATENT RIGHTS for commercial purposes, (including using modifications as part of an industrially sponsored research project), YOU must contact DUKE’s Office for Translation and Commercialization (Digital Innovations Team) about additional commercial license agreements.
|
|
16
|
+
|
|
17
|
+
2. Disclaimer. THE PROGRAM MADE AVAILABLE HEREUNDER IS "AS IS", WITHOUT WARRANTY OF ANY KIND EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR REPRESENTATION THAT THE PROGRAM DOES NOT INFRINGE THE INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY. DUKE has no obligation to assist in your installation or use of the PROGRAM or to provide services or maintenance of any type with respect to the PROGRAM. The entire risk as to the quality and performance of the PROGRAM is borne by YOU. YOU acknowledge that the PROGRAM may contain errors or bugs. YOU must determine whether the PROGRAM sufficiently meets your requirements. This disclaimer of warranty constitutes an essential part of this Agreement.
|
|
18
|
+
|
|
19
|
+
3. No Consequential Damages; Indemnification. IN NO EVENT SHALL DUKE BE LIABLE TO YOU FOR ANY LOST PROFITS OR OTHER DIRECT, INDIRECT, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL DAMAGES RELATING TO THE SUBJECT MATTER OF THIS AGREEMENT.
|
|
20
|
+
|
|
21
|
+
4. Copyright. YOU agree to retain DUKE’S copyright notice: “Copyright 2024 Duke University. All Rights Reserved” on all copies of the PROGRAM or portions thereof.
|
|
22
|
+
|
|
23
|
+
5. Term and Termination. The Term of this Agreement shall be five (5) years from the date YOU accept the terms of this license. If YOU at any time fail to abide by the terms of this Agreement, DUKE shall have the right to immediately terminate the license granted herein, require the return or destruction of all copies of the PROGRAM from YOU, and obtain certification in writing as to such return or destruction, and pursue any other legal or equitable remedies available.
|
|
24
|
+
|
|
25
|
+
6. Export Control. YOU agree to comply with all United States export control laws and regulations controlling the export of the PROGRAM, including, without limitation, all Export Administration Regulations of the United States Department of Commerce. Among other things, these laws and regulations prohibit, or require a license for, the export of certain types of software to specified countries.
|
|
26
|
+
|
|
27
|
+
7. Notices or Additional Licenses. Any notice, communication or commercial license requests shall be directed to:
|
|
28
|
+
|
|
29
|
+
Duke University\
|
|
30
|
+
Office for Translation and Commercialization\
|
|
31
|
+
Physical Address: 2812 Erwin Rd #406, Durham, NC 27705\
|
|
32
|
+
Mailing Address: PO Box 90083, Durham, NC 27708\
|
|
33
|
+
ATTENTION: Daniel Dardani, Director of Physical Sciences and Digital Innovations Licensing daniel.dardani@duke.edu
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
8. General. This Agreement shall be governed by the laws of the State of North Carolina. The parties acknowledge that this Agreement sets forth the entire Agreement and understanding of the parties as to the subject matter.
|
|
38
|
+
|
|
39
|
+
PROCEEDING WITH DOWNLOADING / FORKING / CLONING THE SOFTWARE CONSTITUTES ACCEPTANCE OF THIS AGREEMENT. YOU ARE CONSENTING TO BE BOUND BY ALL OF THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL THE TERMS OF THIS AGREEMENT DISCONTINUE THE INSTALLATION / CLONING / FORKING / DOWNLOAD PROCESS.
|
dendra-0.27.2/PKG-INFO
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dendra
|
|
3
|
+
Version: 0.27.2
|
|
4
|
+
Summary: Differentiable neuronal simulation and macroscopic descriptor optimization
|
|
5
|
+
License-Expression: LicenseRef-Duke-Research-NonCommercial
|
|
6
|
+
Project-URL: Documentation, https://wmglab-duke.github.io/dendra/
|
|
7
|
+
Project-URL: Repository, https://github.com/wmglab-duke/dendra
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE.md
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: sympy>=1.2
|
|
13
|
+
Requires-Dist: torch>=2.12.0
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: h5py
|
|
16
|
+
Requires-Dist: tqdm
|
|
17
|
+
Requires-Dist: natsort
|
|
18
|
+
Requires-Dist: dask
|
|
19
|
+
Requires-Dist: networkx
|
|
20
|
+
Requires-Dist: pandas
|
|
21
|
+
Requires-Dist: neuron
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: ninja
|
|
24
|
+
Provides-Extra: solvers
|
|
25
|
+
Requires-Dist: dendra-solvers>=0.3.1; extra == "solvers"
|
|
26
|
+
Provides-Extra: jupyter
|
|
27
|
+
Requires-Dist: ipympl>=0.9.5; extra == "jupyter"
|
|
28
|
+
Provides-Extra: doc
|
|
29
|
+
Requires-Dist: jupyter_contrib_nbextensions; extra == "doc"
|
|
30
|
+
Requires-Dist: notebook<=6.4.12; extra == "doc"
|
|
31
|
+
Requires-Dist: traitlets<=5.9.0; extra == "doc"
|
|
32
|
+
Requires-Dist: ipython<=8.9.0; extra == "doc"
|
|
33
|
+
Requires-Dist: mkdocs; extra == "doc"
|
|
34
|
+
Requires-Dist: mkdocs-material; extra == "doc"
|
|
35
|
+
Requires-Dist: markdown-include; extra == "doc"
|
|
36
|
+
Requires-Dist: mkdocs-redirects; extra == "doc"
|
|
37
|
+
Requires-Dist: mkdocstrings[python]>=0.18; extra == "doc"
|
|
38
|
+
Requires-Dist: mike; extra == "doc"
|
|
39
|
+
Requires-Dist: sphinx; extra == "doc"
|
|
40
|
+
Requires-Dist: sphinx-autobuild; extra == "doc"
|
|
41
|
+
Requires-Dist: sphinx_autodoc_typehints; extra == "doc"
|
|
42
|
+
Requires-Dist: sphinx-math-dollar; extra == "doc"
|
|
43
|
+
Requires-Dist: myst-nb; extra == "doc"
|
|
44
|
+
Requires-Dist: jupytext; extra == "doc"
|
|
45
|
+
Requires-Dist: shibuya; extra == "doc"
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
48
|
+
Requires-Dist: pytest; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
50
|
+
Requires-Dist: hypothesis; extra == "dev"
|
|
51
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
52
|
+
Requires-Dist: commitizen; extra == "dev"
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
Dynamic: requires-dist
|
|
55
|
+
|
|
56
|
+
<div align="center">
|
|
57
|
+
<img src="https://raw.githubusercontent.com/wmglab-duke/dendra/main/docs/_static/logo-light.png" alt="Dendra">
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
***
|
|
61
|
+
|
|
62
|
+
[](https://pytorch.org/)
|
|
63
|
+
[](https://www.python.org/downloads/)
|
|
64
|
+
[](https://docs.astral.sh/ruff/)
|
|
65
|
+
|
|
66
|
+
Dendra is a differentiable biophysical neuron and network simulator built on
|
|
67
|
+
PyTorch. It supports CPU and GPU execution, extracellular fields, event-based
|
|
68
|
+
networks, and macroscopic descriptors for gradient-based model training.
|
|
69
|
+
|
|
70
|
+
## Documentation
|
|
71
|
+
|
|
72
|
+
The complete documentation is published at
|
|
73
|
+
[wmglab-duke.github.io/dendra](https://wmglab-duke.github.io/dendra/). Start
|
|
74
|
+
with the [installation guide](https://wmglab-duke.github.io/dendra/installation.html),
|
|
75
|
+
then see the tutorials and the
|
|
76
|
+
[unit conventions](https://wmglab-duke.github.io/dendra/units.html).
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
Dendra requires Python 3.11 or newer and PyTorch 2.12 or newer. On Windows,
|
|
81
|
+
install inside WSL2 because the required NEURON dependency does not publish
|
|
82
|
+
native Windows wheels on PyPI.
|
|
83
|
+
|
|
84
|
+
Install Dendra with the recommended native CPU solvers:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python -m pip install --upgrade pip
|
|
88
|
+
python -m pip install --only-binary=dendra-solvers "dendra[solvers]"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The `solvers` extra installs
|
|
92
|
+
[`dendra-solvers`](https://pypi.org/project/dendra-solvers/), which provides
|
|
93
|
+
native CPU solvers for block and tree models. If a compatible solver wheel is
|
|
94
|
+
unavailable, install the base package:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python -m pip install dendra
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The base package retains Dendra's PyTorch CPU solver for unbranched cables and
|
|
101
|
+
all GPU solvers. To select a particular CPU, CUDA, or ROCm build, install
|
|
102
|
+
PyTorch first using its
|
|
103
|
+
[installation selector](https://pytorch.org/get-started/locally/), then install
|
|
104
|
+
Dendra.
|
|
105
|
+
|
|
106
|
+
For interactive Matplotlib figures in Jupyter, install the Jupyter extra:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python -m pip install "dendra[jupyter]"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Verify the installed dependencies and inspect the deployment environment:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
python -m pip check
|
|
116
|
+
python -m dendra doctor
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The [installation guide](https://wmglab-duke.github.io/dendra/installation.html)
|
|
120
|
+
explains solver-wheel support, source installations, upgrades, and Jupyter
|
|
121
|
+
setup. For CUDA deployment checks, see the
|
|
122
|
+
[GPU deployment guide](https://wmglab-duke.github.io/dendra/gpu-deployment.html).
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
The [contribution guide](https://github.com/wmglab-duke/dendra/blob/main/CONTRIBUTING.md)
|
|
127
|
+
describes development setup and the GitHub pull-request workflow. The
|
|
128
|
+
[testing and code coverage guide](https://wmglab-duke.github.io/dendra/testing.html)
|
|
129
|
+
covers the CPU, NEURON, CUDA, sanitizer, and coverage lanes.
|
|
130
|
+
|
|
131
|
+
## Citation
|
|
132
|
+
|
|
133
|
+
A citation for Dendra and its accompanying manuscript will be added when it is
|
|
134
|
+
available. Please also consider citing the work where geometric and topological
|
|
135
|
+
surrogates and gradient-based design of selective neurostimulation are
|
|
136
|
+
discussed in detail:
|
|
137
|
+
|
|
138
|
+
Minhaj A. Hussain, Warren M. Grill, Nicole A. Pelot. "Highly efficient
|
|
139
|
+
modeling and optimization of neural fiber responses to electrical
|
|
140
|
+
stimulation." *Nature Communications.* 2024.
|
|
141
|
+
[doi:10.1038/s41467-024-51709-8](https://doi.org/10.1038/s41467-024-51709-8)
|
|
142
|
+
|
|
143
|
+
```bibtex
|
|
144
|
+
@article{hussain_highly_2024,
|
|
145
|
+
title = {Highly efficient modeling and optimization of neural fiber responses to electrical stimulation},
|
|
146
|
+
doi = {10.1038/s41467-024-51709-8},
|
|
147
|
+
journal = {Nature Communications},
|
|
148
|
+
author = {Hussain, Minhaj A. and Grill, Warren M. and Pelot, Nicole A.},
|
|
149
|
+
year = {2024}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
Dendra is distributed under Duke University's custom license for non-commercial
|
|
156
|
+
research and academic testing. Commercial use, including industrially
|
|
157
|
+
sponsored research, requires a separate agreement with Duke's Office for
|
|
158
|
+
Translation and Commercialization. The
|
|
159
|
+
[license](https://github.com/wmglab-duke/dendra/blob/main/LICENSE.md) governs
|
|
160
|
+
all use; downloading, cloning, or forking the software constitutes acceptance
|
|
161
|
+
of those terms.
|
dendra-0.27.2/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/wmglab-duke/dendra/main/docs/_static/logo-light.png" alt="Dendra">
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
***
|
|
6
|
+
|
|
7
|
+
[](https://pytorch.org/)
|
|
8
|
+
[](https://www.python.org/downloads/)
|
|
9
|
+
[](https://docs.astral.sh/ruff/)
|
|
10
|
+
|
|
11
|
+
Dendra is a differentiable biophysical neuron and network simulator built on
|
|
12
|
+
PyTorch. It supports CPU and GPU execution, extracellular fields, event-based
|
|
13
|
+
networks, and macroscopic descriptors for gradient-based model training.
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
The complete documentation is published at
|
|
18
|
+
[wmglab-duke.github.io/dendra](https://wmglab-duke.github.io/dendra/). Start
|
|
19
|
+
with the [installation guide](https://wmglab-duke.github.io/dendra/installation.html),
|
|
20
|
+
then see the tutorials and the
|
|
21
|
+
[unit conventions](https://wmglab-duke.github.io/dendra/units.html).
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
Dendra requires Python 3.11 or newer and PyTorch 2.12 or newer. On Windows,
|
|
26
|
+
install inside WSL2 because the required NEURON dependency does not publish
|
|
27
|
+
native Windows wheels on PyPI.
|
|
28
|
+
|
|
29
|
+
Install Dendra with the recommended native CPU solvers:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python -m pip install --upgrade pip
|
|
33
|
+
python -m pip install --only-binary=dendra-solvers "dendra[solvers]"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The `solvers` extra installs
|
|
37
|
+
[`dendra-solvers`](https://pypi.org/project/dendra-solvers/), which provides
|
|
38
|
+
native CPU solvers for block and tree models. If a compatible solver wheel is
|
|
39
|
+
unavailable, install the base package:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -m pip install dendra
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The base package retains Dendra's PyTorch CPU solver for unbranched cables and
|
|
46
|
+
all GPU solvers. To select a particular CPU, CUDA, or ROCm build, install
|
|
47
|
+
PyTorch first using its
|
|
48
|
+
[installation selector](https://pytorch.org/get-started/locally/), then install
|
|
49
|
+
Dendra.
|
|
50
|
+
|
|
51
|
+
For interactive Matplotlib figures in Jupyter, install the Jupyter extra:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python -m pip install "dendra[jupyter]"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Verify the installed dependencies and inspect the deployment environment:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
python -m pip check
|
|
61
|
+
python -m dendra doctor
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The [installation guide](https://wmglab-duke.github.io/dendra/installation.html)
|
|
65
|
+
explains solver-wheel support, source installations, upgrades, and Jupyter
|
|
66
|
+
setup. For CUDA deployment checks, see the
|
|
67
|
+
[GPU deployment guide](https://wmglab-duke.github.io/dendra/gpu-deployment.html).
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
The [contribution guide](https://github.com/wmglab-duke/dendra/blob/main/CONTRIBUTING.md)
|
|
72
|
+
describes development setup and the GitHub pull-request workflow. The
|
|
73
|
+
[testing and code coverage guide](https://wmglab-duke.github.io/dendra/testing.html)
|
|
74
|
+
covers the CPU, NEURON, CUDA, sanitizer, and coverage lanes.
|
|
75
|
+
|
|
76
|
+
## Citation
|
|
77
|
+
|
|
78
|
+
A citation for Dendra and its accompanying manuscript will be added when it is
|
|
79
|
+
available. Please also consider citing the work where geometric and topological
|
|
80
|
+
surrogates and gradient-based design of selective neurostimulation are
|
|
81
|
+
discussed in detail:
|
|
82
|
+
|
|
83
|
+
Minhaj A. Hussain, Warren M. Grill, Nicole A. Pelot. "Highly efficient
|
|
84
|
+
modeling and optimization of neural fiber responses to electrical
|
|
85
|
+
stimulation." *Nature Communications.* 2024.
|
|
86
|
+
[doi:10.1038/s41467-024-51709-8](https://doi.org/10.1038/s41467-024-51709-8)
|
|
87
|
+
|
|
88
|
+
```bibtex
|
|
89
|
+
@article{hussain_highly_2024,
|
|
90
|
+
title = {Highly efficient modeling and optimization of neural fiber responses to electrical stimulation},
|
|
91
|
+
doi = {10.1038/s41467-024-51709-8},
|
|
92
|
+
journal = {Nature Communications},
|
|
93
|
+
author = {Hussain, Minhaj A. and Grill, Warren M. and Pelot, Nicole A.},
|
|
94
|
+
year = {2024}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
Dendra is distributed under Duke University's custom license for non-commercial
|
|
101
|
+
research and academic testing. Commercial use, including industrially
|
|
102
|
+
sponsored research, requires a separate agreement with Duke's Office for
|
|
103
|
+
Translation and Commercialization. The
|
|
104
|
+
[license](https://github.com/wmglab-duke/dendra/blob/main/LICENSE.md) governs
|
|
105
|
+
all use; downloading, cloning, or forking the software constitutes acceptance
|
|
106
|
+
of those terms.
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"""Dendra: A PyTorch-based framework for simulating and modeling neural dynamics."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
__version__ = "0.27.2"
|
|
6
|
+
|
|
7
|
+
os.environ.setdefault("OMP_DYNAMIC", "FALSE")
|
|
8
|
+
os.environ.setdefault("MKL_DYNAMIC", "FALSE")
|
|
9
|
+
os.environ["OMP_PROC_BIND"] = "true"
|
|
10
|
+
os.environ["OMP_PLACES"] = "cores"
|
|
11
|
+
|
|
12
|
+
from ._bootstrap import (
|
|
13
|
+
_should_cache_cpu_isa_for_dendra,
|
|
14
|
+
_should_configure_torchinductor_cache_on_import,
|
|
15
|
+
configure_torchinductor_cache_for_dendra,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
_torchinductor_cache_opt_in = _should_configure_torchinductor_cache_on_import()
|
|
19
|
+
if _torchinductor_cache_opt_in:
|
|
20
|
+
configure_torchinductor_cache_for_dendra()
|
|
21
|
+
|
|
22
|
+
import pickle
|
|
23
|
+
import time
|
|
24
|
+
import warnings
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
|
|
27
|
+
import torch
|
|
28
|
+
|
|
29
|
+
import dendra.func as func
|
|
30
|
+
import dendra.models.callbacks as callbacks
|
|
31
|
+
import dendra.models.mod as mod
|
|
32
|
+
|
|
33
|
+
from .const import FARADAY, PI, TAU, E, R
|
|
34
|
+
from .diagnostics import doctor
|
|
35
|
+
from .helpers import (
|
|
36
|
+
COMPILE_OPTIONS,
|
|
37
|
+
DEVICE,
|
|
38
|
+
DTYPE,
|
|
39
|
+
NATIVE_EXTENSION_POLICY,
|
|
40
|
+
PRESERVE_MECHANISM_POPULATION_AXIS,
|
|
41
|
+
RUNTIME_CONTRACT_VALIDATION,
|
|
42
|
+
TF32,
|
|
43
|
+
allow_tf32,
|
|
44
|
+
ctx,
|
|
45
|
+
current_compile_options,
|
|
46
|
+
current_device,
|
|
47
|
+
current_dtype,
|
|
48
|
+
current_native_extension_policy,
|
|
49
|
+
current_preserve_mechanism_population_axis,
|
|
50
|
+
current_runtime_contract_validation,
|
|
51
|
+
normalize_native_extension_policy,
|
|
52
|
+
normalize_preserve_mechanism_population_axis,
|
|
53
|
+
normalize_runtime_contract_validation,
|
|
54
|
+
set_compile_options,
|
|
55
|
+
set_jit_enabled,
|
|
56
|
+
set_jit_in_network_enabled,
|
|
57
|
+
set_jit_network_ops_enabled,
|
|
58
|
+
set_jit_network_solves_enabled,
|
|
59
|
+
)
|
|
60
|
+
from .models import (
|
|
61
|
+
Axon,
|
|
62
|
+
Cable,
|
|
63
|
+
CompartmentGeometry,
|
|
64
|
+
CompartmentGraph,
|
|
65
|
+
CompartmentMetadata,
|
|
66
|
+
CompartmentTopology,
|
|
67
|
+
DistributionSpec,
|
|
68
|
+
ExtCellAxon,
|
|
69
|
+
ExtCellTree,
|
|
70
|
+
Morphology,
|
|
71
|
+
Myelinated,
|
|
72
|
+
NetStim,
|
|
73
|
+
Network,
|
|
74
|
+
Population,
|
|
75
|
+
RandomParameterSpec,
|
|
76
|
+
RuntimeNoiseSpec,
|
|
77
|
+
Section,
|
|
78
|
+
SectionLocation,
|
|
79
|
+
SingleCompartment,
|
|
80
|
+
SynapseSlots,
|
|
81
|
+
Tree,
|
|
82
|
+
Unmyelinated,
|
|
83
|
+
available_random_distributions,
|
|
84
|
+
concat_models,
|
|
85
|
+
concat_slices,
|
|
86
|
+
connect_morphologies,
|
|
87
|
+
get_random_distribution,
|
|
88
|
+
insert_intrinsic_activity,
|
|
89
|
+
make_random_parameter_spec,
|
|
90
|
+
make_runtime_noise_spec,
|
|
91
|
+
passive_end_nodes_,
|
|
92
|
+
register_random_distribution,
|
|
93
|
+
remove_intrinsic_activity,
|
|
94
|
+
sample_random_parameter,
|
|
95
|
+
sample_runtime_noise,
|
|
96
|
+
)
|
|
97
|
+
from .models.fields import *
|
|
98
|
+
from .models.integrators import (
|
|
99
|
+
bwd_euler_bt,
|
|
100
|
+
bwd_euler_sc,
|
|
101
|
+
bwd_euler_ub,
|
|
102
|
+
df,
|
|
103
|
+
dfh,
|
|
104
|
+
dhs,
|
|
105
|
+
dufort_frankel,
|
|
106
|
+
dufort_frankel_homogeneous,
|
|
107
|
+
euler,
|
|
108
|
+
eulerv1,
|
|
109
|
+
rk1,
|
|
110
|
+
rk2,
|
|
111
|
+
rk4,
|
|
112
|
+
scnv,
|
|
113
|
+
)
|
|
114
|
+
from .models.mod import load_mechanisms
|
|
115
|
+
from .models.stim.waveform import *
|
|
116
|
+
from .stepping import step, step_network, step_population
|
|
117
|
+
|
|
118
|
+
__all__ = [
|
|
119
|
+
"PI",
|
|
120
|
+
"E",
|
|
121
|
+
"TAU",
|
|
122
|
+
"R",
|
|
123
|
+
"FARADAY",
|
|
124
|
+
"ctx",
|
|
125
|
+
"doctor",
|
|
126
|
+
"step",
|
|
127
|
+
"step_population",
|
|
128
|
+
"step_network",
|
|
129
|
+
"DEVICE",
|
|
130
|
+
"DTYPE",
|
|
131
|
+
"NATIVE_EXTENSION_POLICY",
|
|
132
|
+
"PRESERVE_MECHANISM_POPULATION_AXIS",
|
|
133
|
+
"RUNTIME_CONTRACT_VALIDATION",
|
|
134
|
+
"COMPILE_OPTIONS",
|
|
135
|
+
"current_compile_options",
|
|
136
|
+
"current_device",
|
|
137
|
+
"current_dtype",
|
|
138
|
+
"current_native_extension_policy",
|
|
139
|
+
"current_preserve_mechanism_population_axis",
|
|
140
|
+
"current_runtime_contract_validation",
|
|
141
|
+
"normalize_runtime_contract_validation",
|
|
142
|
+
"normalize_native_extension_policy",
|
|
143
|
+
"normalize_preserve_mechanism_population_axis",
|
|
144
|
+
"set_compile_options",
|
|
145
|
+
"set_jit_enabled",
|
|
146
|
+
"set_jit_network_solves_enabled",
|
|
147
|
+
"set_jit_network_ops_enabled",
|
|
148
|
+
"set_jit_in_network_enabled",
|
|
149
|
+
"callbacks",
|
|
150
|
+
"func",
|
|
151
|
+
"mod",
|
|
152
|
+
"load_mechanisms",
|
|
153
|
+
"DistributionSpec",
|
|
154
|
+
"RandomParameterSpec",
|
|
155
|
+
"RuntimeNoiseSpec",
|
|
156
|
+
"available_random_distributions",
|
|
157
|
+
"get_random_distribution",
|
|
158
|
+
"register_random_distribution",
|
|
159
|
+
"make_random_parameter_spec",
|
|
160
|
+
"make_runtime_noise_spec",
|
|
161
|
+
"sample_random_parameter",
|
|
162
|
+
"sample_runtime_noise",
|
|
163
|
+
"insert_intrinsic_activity",
|
|
164
|
+
"remove_intrinsic_activity",
|
|
165
|
+
"passive_end_nodes_",
|
|
166
|
+
"Population",
|
|
167
|
+
"Morphology",
|
|
168
|
+
"Section",
|
|
169
|
+
"SectionLocation",
|
|
170
|
+
"CompartmentTopology",
|
|
171
|
+
"CompartmentGeometry",
|
|
172
|
+
"CompartmentMetadata",
|
|
173
|
+
"CompartmentGraph",
|
|
174
|
+
"SingleCompartment",
|
|
175
|
+
"Cable",
|
|
176
|
+
"Axon",
|
|
177
|
+
"Unmyelinated",
|
|
178
|
+
"Myelinated",
|
|
179
|
+
"Tree",
|
|
180
|
+
"ExtCellAxon",
|
|
181
|
+
"ExtCellTree",
|
|
182
|
+
"NetStim",
|
|
183
|
+
"Network",
|
|
184
|
+
"SynapseSlots",
|
|
185
|
+
"concat_models",
|
|
186
|
+
"concat_slices",
|
|
187
|
+
"connect_morphologies",
|
|
188
|
+
"anisotropic_point",
|
|
189
|
+
"isotropic_point",
|
|
190
|
+
"parametric_efield",
|
|
191
|
+
"PreComputedInterpolate1D",
|
|
192
|
+
"precomputed_interpolate_1d",
|
|
193
|
+
"EfieldInterpolate3DRect",
|
|
194
|
+
"efield_interpolate_3d_rect",
|
|
195
|
+
"PreComputedInterpolate3DRect",
|
|
196
|
+
"precomputed_interpolate_3d_rect",
|
|
197
|
+
"PreComputedInterpolate3DScattered",
|
|
198
|
+
"precomputed_interpolate_3d_scattered",
|
|
199
|
+
"EfieldInterpolate3DScattered",
|
|
200
|
+
"efield_interpolate_3d_scattered",
|
|
201
|
+
"euler",
|
|
202
|
+
"eulerv1",
|
|
203
|
+
"rk1",
|
|
204
|
+
"rk2",
|
|
205
|
+
"rk4",
|
|
206
|
+
"dufort_frankel",
|
|
207
|
+
"dufort_frankel_homogeneous",
|
|
208
|
+
"bwd_euler_sc",
|
|
209
|
+
"bwd_euler_ub",
|
|
210
|
+
"bwd_euler_bt",
|
|
211
|
+
"dhs",
|
|
212
|
+
"df",
|
|
213
|
+
"dfh",
|
|
214
|
+
"scnv",
|
|
215
|
+
]
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def _cache_cpu_isa_list():
|
|
219
|
+
"""
|
|
220
|
+
Checks for a cached CPU ISA string. If not found, runs the slow
|
|
221
|
+
detection and caches the result for future runs.
|
|
222
|
+
"""
|
|
223
|
+
# Use a standard cache location.
|
|
224
|
+
cache_dir = Path.home() / ".cache" / "dendra"
|
|
225
|
+
cache_file = cache_dir / f"cpu_isa_list_{torch.__version__}"
|
|
226
|
+
|
|
227
|
+
def get_valid_vec_isa_list():
|
|
228
|
+
with open(cache_file, "rb") as f:
|
|
229
|
+
return pickle.load(f)
|
|
230
|
+
|
|
231
|
+
# --- Cache Hit ---
|
|
232
|
+
if cache_file.exists():
|
|
233
|
+
# Check if the PyTorch version matches the one used to create the cache.
|
|
234
|
+
torch._inductor.cpu_vec_isa.valid_vec_isa_list = get_valid_vec_isa_list
|
|
235
|
+
return
|
|
236
|
+
|
|
237
|
+
# --- Cache Miss or Stale Cache ---
|
|
238
|
+
print("Dendra: Performing one-time CPU capability check. This may take a minute...")
|
|
239
|
+
try:
|
|
240
|
+
os.makedirs(cache_dir, exist_ok=True)
|
|
241
|
+
start = time.time()
|
|
242
|
+
valid_vec_isa_list = torch._inductor.cpu_vec_isa.valid_vec_isa_list()
|
|
243
|
+
print(f"Dendra: CPU capability check took {(time.time() - start):.3f}s.")
|
|
244
|
+
with open(cache_file, "wb") as f:
|
|
245
|
+
pickle.dump(valid_vec_isa_list, f)
|
|
246
|
+
except Exception as e:
|
|
247
|
+
warnings.warn(
|
|
248
|
+
f"Dendra: CPU capability check failed: {e}. Falling back to default behavior."
|
|
249
|
+
)
|
|
250
|
+
return
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
if _torchinductor_cache_opt_in and _should_cache_cpu_isa_for_dendra():
|
|
254
|
+
_cache_cpu_isa_list()
|
|
255
|
+
|
|
256
|
+
# setup environment
|
|
257
|
+
allow_tf32(bool(TF32))
|