Exemplo n.º 1
0
# DeNSE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DeNSE. If not, see <http://www.gnu.org/licenses/>.

import matplotlib.pyplot as plt
import nngt

import dense as ds
from dense.units import *
from dense.elements import Population

pop = Population.from_swc(ds.NeuronsFromSimulation("2culture_swc"))

graph, intersections = ds.generate_network(pop)

for key in intersections:
    intersections[key] = list(set(intersections[key]))

### Plot the graph in 2 subplots:
fig, (ax1, ax2, ax3) = plt.subplots(3, 1)
nngt.plot.draw_network(graph, spatial=True, axis=ax3)
for neuron in pop:
    if neuron < 100:
        try:
            ax1.plot(neuron.axon.xy[:, 0], neuron.axon.xy[:, 1], c='b')
        except:
            pass
Exemplo n.º 2
0
# You should have received a copy of the GNU General Public License
# along with DeNSE. If not, see <http://www.gnu.org/licenses/>.

import sys

import matplotlib.pyplot as plt

import dense as ds
from dense.elements import Population

try:
    culture_folder = sys.argv[1]
except:
    raise ("add culture folder as first argument")

pop = Population.from_swc(ds.NeuronsFromSimulation(culture_folder))

graph, intersections, synapses = ds.generate_network(
    pop, intersection_positions=True)

### Plot the graph in 2 subplots:
fig, (ax1, ax2) = plt.subplots(2, 1)
ax2.set_title("Connections as a directed graph")
# nngt.plot.draw_network(graph,spatial = True,
# nsize="out-degree",
# ncolor="betweenness",
# esize=0.01,
# decimate =2,
# axis = ax2,
# dpi = 400)
Exemplo n.º 3
0
# DeNSE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DeNSE. If not, see <http://www.gnu.org/licenses/>.

import matplotlib.pyplot as plt

import dense as ds
from dense.units import *
from dense.elements import Population


pop = Population.from_swc(ds.NeuronsFromSimulation("circular_swc"))

graph, intersections, synapses = ds.generate_network(pop, intersection_positions=True)


### Plot the graph in 2 subplots:
fig, (ax1,ax2) = plt.subplots(2,1)
ax2.set_title("Connections as a directed graph")
graph.to_file("circular.el")
# nngt.plot.draw_network(graph,spatial = True,
                       # nsize="out-degree",
                       # ncolor="betweenness",
                       # esize=0.01,
                       # decimate =2,
                       # axis = ax2,
                       # dpi = 400)
Exemplo n.º 4
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DeNSE. If not, see <http://www.gnu.org/licenses/>.

import matplotlib.pyplot as plt

import dense as ds
from dense.units import *
from dense.elements import Population


# pop = Population.from_swc(ds.NeuronsFromSimulation("circular_swc"))
pop = Population.from_swc(ds.io.load_swc("circular_swc"))

graph, intersections, synapses = ds.morphology.generate_network(pop, intersection_positions=True)


### Plot the graph in 2 subplots:
fig, (ax1,ax2) = plt.subplots(2,1)
ax2.set_title("Connections as a directed graph")
graph.to_file("circular.el")
# nngt.plot.draw_network(graph,spatial = True,
                       # nsize="out-degree",
                       # ncolor="betweenness",
                       # esize=0.01,
                       # decimate =2,
                       # axis = ax2,
                       # dpi = 400)
Exemplo n.º 5
0
            ha='left',
            va='top')
    dx.text(np.radians(-30),
            dx.get_rmax(),
            label,
            rotation=0.,
            ha='left',
            va='top')
    plt.tight_layout()
    plt.show()
    # plt.savefig("sholl_analysis.png", format='png',ppi=300)
    # axes.scatter(0,0,c='k')


if __name__ == "__main__":
    pop = Population(sys.argv[1])
    import argparse
    parser = argparse.ArgumentParser(description='Sholl analysis')
    parser.add_argument('--culture', type=str, help='folder with swc files')
    parser.add_argument('--no_import',
                        action='store_false',
                        default=True,
                        help='do not import the population from file')
    args = parser.parse_args()

    if args.no_import:
        for n in range(6):
            swc_culture = ds.NeuronsFromSimulation(args.culture + str(n))
            pop.info = swc_culture["info"]
            pop.add_swc_population(swc_culture['neurons'])
Exemplo n.º 6
0
# (at your option) any later version.
#
# DeNSE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DeNSE. If not, see <http://www.gnu.org/licenses/>.

import matplotlib.pyplot as plt

import dense as ds
from dense.elements import Population

pop = Population.from_swc("2chambers_test.swc")

graph, intersections, synapses = ds.generate_network(pop)

### Plot the graph in 2 subplots:
fig, (ax1, ax2) = plt.subplots(2, 1)
# nngt.plot.draw_network(graph,spatial = True,
# nsize="out-degree",
# ncolor="betweenness",
# esize=0.01,
# decimate =2,
# axis = ax2,
# dpi = 400)
ax1.set_title("Soma position")
for neuron in pop:
    if neuron >= 100: