-
Notifications
You must be signed in to change notification settings - Fork 35
For 2d plots #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
For 2d plots #182
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3ad40b3
feat(interactive-plot): use gl variant for performance
sanjayankur31 39e791b
test(plot): add more points to test performance
sanjayankur31 8563506
Merge pull request #181 from NeuroML/feat/use-webgl-interactive-plot
sanjayankur31 b28a429
Merge branch 'feat/nml2matplotlib' into experimental
pgleeson 2ba9c2a
Improved scaling of thickness
pgleeson bff3499
Improve scalebar
pgleeson d5fc312
Further improvements in colouring & soma drawing
pgleeson 7e8cf01
Add support for 2d network plots
pgleeson f90260e
To plot cells/networks, all includes need to be findable
pgleeson c48feb4
Better support for setting axes to see cells
pgleeson 00922e7
Plotting point neuron networks
pgleeson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import neuroml | ||
|
|
||
| def extract_position_info(nml_model, verbose): | ||
|
|
||
| cell_id_vs_cell = {} | ||
| positions = {} | ||
| pop_id_vs_cell = {} | ||
| pop_id_vs_color = {} | ||
|
|
||
| cell_elements = [] | ||
| cell_elements.extend(nml_model.cells) | ||
| cell_elements.extend(nml_model.cell2_ca_poolses) | ||
|
|
||
| for cell in cell_elements: | ||
| cell_id_vs_cell[cell.id] = cell | ||
|
|
||
| if len(nml_model.networks)>0: | ||
| popElements = nml_model.networks[0].populations | ||
| else: | ||
| popElements = [] | ||
| net = neuroml.Network(id='x') | ||
| nml_model.networks.append(net) | ||
| cell_str = '' | ||
| for cell in cell_elements: | ||
| pop = neuroml.Population(id='dummy_population_%s'%cell.id, size=1, component=cell.id) | ||
| net.populations.append(pop) | ||
| cell_str+=cell.id+'__' | ||
| net.id=cell_str[:-2] | ||
|
|
||
| popElements = nml_model.networks[0].populations | ||
|
|
||
|
|
||
| for pop in popElements: | ||
| name = pop.id | ||
| celltype = pop.component | ||
| instances = pop.instances | ||
|
|
||
| if pop.component in cell_id_vs_cell.keys(): | ||
| pop_id_vs_cell[pop.id] = cell_id_vs_cell[pop.component] | ||
|
|
||
| info = "Population: %s has %i positioned cells of type: %s" % ( | ||
| name, | ||
| len(instances), | ||
| celltype, | ||
| ) | ||
| if verbose: print(info) | ||
|
|
||
| colour = "b" | ||
| substitute_radius = None | ||
|
|
||
| props = [] | ||
| props.extend(pop.properties) | ||
| ''' TODO | ||
| if pop.annotation: | ||
| props.extend(pop.annotation.properties)''' | ||
|
|
||
| for prop in props: | ||
| print(prop) | ||
| if prop.tag == "color": | ||
| color = prop.value | ||
| color = (float(color.split(' ')[0]), | ||
| float(color.split(' ')[1]), | ||
| float(color.split(' ')[2])) | ||
|
|
||
| pop_id_vs_color[pop.id]=color | ||
| print("Colour determined to be: %s"%str(color)) | ||
| if prop.tag == "radius": | ||
| substitute_radius = float(prop.value) | ||
|
|
||
| pop_positions = {} | ||
|
|
||
| if len(instances)>0: | ||
| for instance in instances: | ||
| location = instance.location | ||
| id = int(instance.id) | ||
|
|
||
| x = float(location.x) | ||
| y = float(location.y) | ||
| z = float(location.z) | ||
| pop_positions[id] = (x, y, z) | ||
| else: | ||
| for id in range(pop.size): | ||
| pop_positions[id] = (0,0,0) | ||
|
|
||
| positions[name] = pop_positions | ||
|
|
||
| return cell_id_vs_cell, pop_id_vs_cell, positions, pop_id_vs_color | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.