HOC CODE TO COLLAPSE A DENDRITIC TREE ===================================== Collapse a dendritic tree into 3 compartments "proximal", "middle" and "distal". The collapse is made such as the collapsed dendritic structure preserves the axial resistance of the original structure. The algorithm works by merging successive pairs of dendritic branches into an equivalent branch (a branch that preserves the axial resistance of the two original branches). This merging of branches can be done according to different methods selectable in the present code: AREABYLONG The code rejects the smallest original branch if it is more than 5 times smaller than the long orginal branch. If AREABYLONG is set to 1, then the small branch is rescaled to the longest one (a new diameter is assigned such that the small branch conserves its axial resistance). This minimizes errors for dendritic structures where branches have a large range of possible lengths. AREABYLONG = 0 is the default. AVGLENGTH, AVGLENGTHWDIAM, AVGLENGTHWSURF During the merging of two branches, the length of the equivalent branch is calculated by one out of three possible methods. First, a simple average of the two branch length: L = (L1+L2)/2 This is the method originally used by Bush and Sejnowski (J. Neurosci. Methods 46: 159-166, 1993). It is selected by setting AVGLENGTH=1. Second, by weighting this average with the diameters of each branch L = (diam1*L1 + diam2*L2)/(diam1+diam2) This algorithm produces more fair merging in the case two branches of very different diameters are to be merged. It is selected by setting AVGLENGTHWDIAM=1. Third, by weighting the average with membrane area: L = (area1*L1 + area2*L2)/(area1+area2) This algorithm is better in the case two branches of very different areas are to be merged. It is selected by setting AVGLENGTHWSURF=1. CUTOFF1, CUTOFF2 The dendritic branches are assigned to one of the three compartments ("proximal", "middle" or "distal") based on their path axial resistance (in Meg-Ohms) to the soma. The cutoff values (CUTOFF1 and CUTOFF2) determine these cut-offs. For example, CUTOFF1=10 means that all branches laying within 10 Meg-Ohm of axial resistance from the soma will be merged together into the same ("proximal") section. Written by M. Neubig & A. Destexhe Laval University, 1997; CNRS 2000 The run this example, enter: nrniv collapse.hoc - it should give the following output: Section Length (um) Diameter (um) 1 70.69612 7.9574464 2 28.123442 8.0002892 3 12.49237 10.281249