Skip to content

Commit

Permalink
Add version number in TMD installation
Browse files Browse the repository at this point in the history
Change-Id: I3604c15e7ee8bbe6f61f43be84c0aea26d999ded
  • Loading branch information
Benoit Coste committed Jun 26, 2018
1 parent 942fce0 commit c414aa2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""" Distribution configuration for TMD
"""
import os
from setuptools import setup
from setuptools import find_packages
import pip

execfile('tmd/version.py')

config = {
'description': 'TMD: a python package for the topological analysis of neurons',
Expand All @@ -22,6 +22,7 @@
'scripts': [],
'name': 'tmd',
'include_package_data': True,
'version': VERSION, # pylint: disable=undefined-variable
}

setup(**config)
6 changes: 3 additions & 3 deletions tmd/Population/Population.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def try_except(tree, ntree, feature, output_folder, ttype='basal'):
output_file=os.path.join(output_folder, ttype +
'_' + str(ntree) + '.txt'))
except ValueError:
print tree
print(tree)

if neurite_type == 'all':
_ = [try_except(ap, enap, feature, output_folder, ttype='apical')
Expand Down Expand Up @@ -99,7 +99,7 @@ def try_except(tree, ntree, feature, output_folder, ttype='basal'):
output_file=os.path.join(output_folder, ttype +
'_' + str(ntree) + '.txt'))
except ValueError:
print tree
print(tree)

if neurite_type == 'all':
_ = [[try_except(ap, enap, feature, output_folder,
Expand Down Expand Up @@ -137,7 +137,7 @@ def try_except(neuron, feature, output_folder, ttype=neurite_type):
output_file=os.path.join(output_folder, neuron.name + '.txt'))

except ValueError:
print neuron.name
print(neuron.name)

_ = [try_except(n, feature, output_folder, ttype=neurite_type)
for n in self.neurons]
14 changes: 7 additions & 7 deletions tmd/Topology/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_persistence_diagram(tree, feature='radial_distances', **kwargs):

rd[p] = rd[mx_id]

ph.append([rd[np.where(active)[0][0]], 0]) # Add the last alive component
ph.append([rd[np.where(active)[0][0]], 0]) # Add the last alive component

return ph

Expand Down Expand Up @@ -119,10 +119,10 @@ def phi_theta(u, v):
phi2 = np.arctan2(v[1], v[0])
theta2 = np.arccos(v[2] / np.linalg.norm(v))

delta_phi = phi2 - phi1 # np.abs(phi1 - phi2)
delta_theta = theta2 - theta1 # np.abs(theta1 - theta2)
delta_phi = phi2 - phi1 # np.abs(phi1 - phi2)
delta_theta = theta2 - theta1 # np.abs(theta1 - theta2)

return delta_phi, delta_theta # dphi, dtheta
return delta_phi, delta_theta # dphi, dtheta


def get_angles(tree, beg, parents, children):
Expand Down Expand Up @@ -252,7 +252,7 @@ def get_ph_radii(tree, feature='radial_distances', **kwargs):

rd[p] = rd[mx_id]

ph.append([rd[np.where(active)[0][0]], 0, radii[beg[0]]]) # Add the last alive component
ph.append([rd[np.where(active)[0][0]], 0, radii[beg[0]]]) # Add the last alive component

return ph

Expand Down Expand Up @@ -302,7 +302,7 @@ def extract_ph(tree, feature='radial_distances', output_file='test.txt',

write_ph(ph, output_file)

print 'File ' + output_file + ' completed!'
print('File ' + output_file + ' completed!')


def extract_ph_neuron(neuron, feature='radial_distances', output_file=None,
Expand All @@ -319,7 +319,7 @@ def extract_ph_neuron(neuron, feature='radial_distances', output_file=None,

write_ph(ph, output_file)

print 'File ' + output_file + ' completed!'
print('File ' + output_file + ' completed!')


def get_lifetime(tree, feature='point_radial_distances'):
Expand Down
5 changes: 2 additions & 3 deletions tmd/io/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def load_neuron(input_file, line_delimiter='\n', soma_type=None, tree_types=None
# Save soma in Neuron
neuron.set_soma(soma)
p = _np.array(_np.transpose(data)[6], dtype=int) - _np.transpose(data)[0][0]
#return p, soma_ids
# return p, soma_ids
dA = sp.csr_matrix((_np.ones(len(p) - len(soma_ids)),
(range(len(soma_ids), len(p)),
p[len(soma_ids):])), shape=(len(p), len(p)))
Expand Down Expand Up @@ -108,11 +108,10 @@ def load_population(input_directory, tree_types=None):
pop = Population.Population(name=os.path.relpath(input_directory))

for i in files_h5 + files_swc:
#print 'Loading ' + i + ' ...'
try:
pop.append_neuron(load_neuron(os.path.join(input_directory, i),
tree_types=tree_types))
except:
print 'File failed to load: ', i
print('File failed to load: {}'.format(i))

return pop

0 comments on commit c414aa2

Please sign in to comment.