version 1.40 | version 1.41 |
---|
| |
## VND -- Visual Neuronal Dynamics I/O, parsing, selection, and data storage | ## VND -- Visual Neuronal Dynamics I/O, parsing, selection, and data storage |
## | ## |
## $Id: vnd_read.tcl,v 1.40 2023/12/14 04:47:45 barryi Exp $ | ## $Id: vnd_read.tcl,v 1.41 2024/04/30 23:53:00 barryi Exp $ |
## | ## |
## | ## |
## Home Page | ## Home Page |
| |
# XX later, add type_xrot and type_yrot if these are ever used | # XX later, add type_xrot and type_yrot if these are ever used |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] |
# negative type_zrot: | # negative type_zrot: |
set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] |
#set m [transaxis z $type_zrot rad] | #set m [transaxis z $type_zrot rad] |
#set m [transaxis z 0 rad] | #set m [transaxis z 0 rad] |
| |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
# XX later, add type_xrot and type_yrot if these are ever used | # XX later, add type_xrot and type_yrot if these are ever used |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] |
# negative type_zrot: | set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] |
#set m [transaxis z $type_zrot rad] | #set m [transaxis z $type_zrot rad] |
#set m [transaxis z 0 rad] | #set m [transaxis z 0 rad] |
| |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
# XX later, add type_xrot and type_yrot if these are ever used | # XX later, add type_xrot and type_yrot if these are ever used |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] |
# negative type_zrot: | set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] |
#set m [transaxis z $type_zrot rad] | #set m [transaxis z $type_zrot rad] |
#set m [transaxis z 0 rad] | #set m [transaxis z 0 rad] |
| |
puts "node_type= $node_type type_zrot= $type_zrot" | puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
| |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
# XX later, add type_xrot and type_yrot if these are ever used | # XX later, add type_xrot and type_yrot if these are ever used |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] |
# negative type_zrot: | |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] |
#set m [transmult [transoffset $x $y $z] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | #set m [transmult [transoffset $x $y $z] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] |
| |
puts "node_type= $node_type type_zrot= $type_zrot" | puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
| |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
# XX later, add type_xrot and type_yrot if these are ever used | # XX later, add type_xrot and type_yrot if these are ever used |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] |
# negative type_zrot: | |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] |
#set m [transmult [transoffset $x $y $z] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | #set m [transmult [transoffset $x $y $z] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] |
| |
#puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
#set pointcount 0 | #set pointcount 0 |
| |
foreach e $pointList { | foreach e $pointList { |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
# XX later, add type_xrot and type_yrot if these are ever used | # XX later, add type_xrot and type_yrot if these are ever used |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad]] |
# negative type_zrot: | |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] |
#set m [transmult [transoffset $x $y $z] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | #set m [transmult [transoffset $x $y $z] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] |
#set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] | #set m [transmult [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z $type_zrot rad]] |
| |
# the "isolated_" term reminds this is really a point-cloud-like pointlist, without parent and other info in each element | # the "isolated_" term reminds this is really a point-cloud-like pointlist, without parent and other info in each element |
set isolated_rotPointList "" | set isolated_rotPointList "" |
set type_zrot $typeHash(rot_zaxis,$fileset_num,$node_type) | set type_zrot $typeHash(rot_zaxis,$fileset_num,$node_type) |
#note the corrective -type_zrot, not true for all data sets | #No longer true: note the corrective -type_zrot, not true for all data sets |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | #Now:type z_rot now being added to zrot |
| set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
foreach {en etype ex ey ez eradius eparent} $e {} | foreach {en etype ex ey ez eradius eparent} $e {} |
set v [list $ex $ey $ez] | set v [list $ex $ey $ez] |
| |
#puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
foreach {en etype ex ey ez eradius eparent} $e {} | foreach {en etype ex ey ez eradius eparent} $e {} |
#if {$en < 4} { | #if {$en < 4} { |
| |
#puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
foreach {en etype ex ey ez eradius eparent} $e {} | foreach {en etype ex ey ez eradius eparent} $e {} |
#if {$en < 4} { | #if {$en < 4} { |
| |
#puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
foreach {en etype ex ey ez eradius eparent} $e {} | foreach {en etype ex ey ez eradius eparent} $e {} |
#if {$en < 4} { | #if {$en < 4} { |
| |
#puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
foreach {en etype ex ey ez eradius eparent} $e {} | foreach {en etype ex ey ez eradius eparent} $e {} |
#if {$en < 4} { | #if {$en < 4} { |
| |
#puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
foreach {en etype ex ey ez eradius eparent} $e {} | foreach {en etype ex ey ez eradius eparent} $e {} |
#if {$en < 4} { | #if {$en < 4} { |
| |
#puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
foreach {eid etype ex ey ez eradius eparent} $e {} | foreach {eid etype ex ey ez eradius eparent} $e {} |
if {($eid >= $swc_beg) && ($eid <= $swc_end) } { | if {($eid >= $swc_beg) && ($eid <= $swc_end) } { |
| |
#puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
| |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
| |
| |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
| |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
| |
| |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
#puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | #puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
| |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
| |
#draw color $c | #draw color $c |
#puts "in show_morph_moved, color set to $c" | #puts "in show_morph_moved, color set to $c" |
set type_zrot $typeHash(rot_zaxis,$fileset_num,$node_type) | set type_zrot $typeHash(rot_zaxis,$fileset_num,$node_type) |
puts "node_type= $node_type type_zrot= $type_zrot" | #puts "node_type= $node_type type_zrot= $type_zrot" |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" | puts "transoffset $x $y $z = [transoffset [list $x $y $z]]" |
set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $x $y $z]] [transaxis x $xrot rad ] [transaxis y $yrot rad] [transaxis z $zrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach e $pointList { | foreach e $pointList { |
| |
# need sequential type_zrot, zrot, yrot, xrot | # need sequential type_zrot, zrot, yrot, xrot |
| |
set rotPointList "" | set rotPointList "" |
set type_zrot $typeHash(rot_zaxis,$efileset_num,$etype) | set type_zrot $typeHash(rot_zaxis,$efileset_num,$etype) |
#note the corrective -type_zrot, not true for all data sets | #note the corrective -type_zrot, not true for all data sets |
set m [transmult [transoffset [list $ex $ey $ez]] [transaxis x $exrot rad ] [transaxis y $eyrot rad] [transaxis z $ezrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $ex $ey $ez]] [transaxis x $exrot rad ] [transaxis y $eyrot rad] [transaxis z $ezrot rad] [transaxis z [expr $type_zrot] rad]] |
foreach pe $pointList { | foreach pe $pointList { |
set v [list [lindex $pe 2] [lindex $pe 3] [lindex $pe 4]] | set v [list [lindex $pe 2] [lindex $pe 3] [lindex $pe 4]] |
set vr [coordtrans $m $v] | set vr [coordtrans $m $v] |
| |
return $pop_group_list | return $pop_group_list |
} | } |
| |
| |
| proc ::neuro::hdf5_list_nwb_spike_datasets {filename} { |
| |
| #h5dump output into array |
| #heuristic to find paths. |
| #first find directories inside nodes/ |
| #from there, take: |
| #0/x |
| #0/y |
| #0/z |
| #0/rotation_angle_xaxis |
| #0/rotation_angle_yaxis |
| #0/rotation_angle_zaxis |
| # ... defaults if needed |
| # XXX hacky 'exec h5dump' must be replaced with better startup method |
| puts "about to get attribute: exec h5dump -n $filename" |
| set result [exec h5dump -n $filename] |
| set file_lines [split $result "\n"] |
| #puts "Result for $filename: $result" |
| #puts "file_lines length: [llength $file_lines]" |
| set linenum 0 |
| set val_list "" |
| foreach line $file_lines { |
| if {$linenum > 1} { |
| #puts "linenum: $linenum follows:" |
| #puts $line |
| if {[regexp {^\s*dataset\s+(\S*)\s*$} $line thematch submatch1]} { |
| if {[regexp {/processing/(.*)/spike_train/(.*)/data} $submatch1 thematch2 submatch2a submatch2b ]} { |
| puts "matched >$submatch2a< >$submatch2b< in $submatch1" |
| lappend val_list [list $submatch2a $submatch2b $submatch1] |
| puts "linenum= $linenum added >$submatch1< to val_list, length of val_list = [llength $val_list]" |
| } |
| } |
| } |
| incr linenum |
| } |
| #puts "val_list to return: $val_list" |
| return $val_list |
| } |
| |
| |
| proc ::neuro::write_nwb_spike_pop {spike_filename pop} { |
| variable node |
| variable spikeHash |
| #first, get a list of all neuron_ids in the pop |
| #make a temp working dir |
| set tmp_dir [file join "/tmp" "vnd.[pid]" ] |
| file mkdir $tmp_dir |
| #get complete path of spike_filename |
| set spike_filename_normalized [file normalize $spike_filename] |
| #get basename of spike_filename (basename will appear inside the file itself) |
| set spike_filename_basename [file tail $spike_filename] |
| set spike_filename_working [file join $tmp_dir $spike_filename_basename] |
| #get the globl node ids for this population |
| set myGlobalNodeIdList [parse_full_selection_string "population == $pop"] |
| set myNodeIdList "" |
| foreach e $myGlobalNodeIdList { |
| foreach {ex ey ez exrot eyrot ezrot etype efileset_num epop enode_id egroup_id egroup_index ecartesian} $node($e) {} |
| lappend myNodeIdList $enode_id |
| } |
| puts "for population $pop, myNodeIdList= >$myNodeIdList<" |
| #now make list of spike times for each nodeId |
| |
| array unset spike_by_node |
| foreach spike $spikeHash(spikeList,$pop) { |
| foreach {enode_id spike_time} $spike {} |
| lappend spike_by_node($enode_id) $spike_time |
| #puts "lappending $enode_id $spike_time" |
| } |
| set i 0 |
| # create the new file |
| # delete working (tempdir) spike filename if present |
| file delete $spike_filename_working |
| foreach n $myNodeIdList { |
| if {1} { |
| # h5import to the working output file |
| if [info exists spike_by_node($n)] { |
| set spike_train_length [llength $spike_by_node($n)] |
| set conf_filename_working [file join $tmp_dir "$spike_filename_basename.$i.conf"] |
| set data_filename_working [file join $tmp_dir "$spike_filename_basename.$i.data"] |
| set attrib_filename_working [file join $tmp_dir "$spike_filename_basename.$i.attrib"] |
| puts "i= $i localNode= $n spike_train_length= $spike_train_length" |
| |
| set ATTRIB_FILE [open $conf_filename_working w] |
| #write out file-wide unit info. to attrib file |
| # write out the current conf file |
| set CONF_FILE [open $conf_filename_working w] |
| # write out the current data |
| puts $CONF_FILE "PATH /processing/trial_0/spike_train/$n/data" |
| puts $CONF_FILE " INPUT-CLASS TEXTFP" |
| puts $CONF_FILE " RANK 1" |
| puts $CONF_FILE " DIMENSION-SIZES $spike_train_length" |
| puts $CONF_FILE " OUTPUT-CLASS FP" |
| puts $CONF_FILE " OUTPUT-SIZE 64" |
| puts $CONF_FILE " OUTPUT-ARCHITECTURE IEEE" |
| puts $CONF_FILE " OUTPUT-BYTE-ORDER LE" |
| puts $CONF_FILE " CHUNKED-DIMENSION-SIZES $spike_train_length" |
| puts $CONF_FILE " MAXIMUM-DIMENSIONS $spike_train_length" |
| close $CONF_FILE |
| |
| set DATA_FILE [open $data_filename_working w] |
| foreach e $spike_by_node($n) { |
| puts $DATA_FILE $e |
| } |
| close $DATA_FILE |
| puts "about to exec: h5import $data_filename_working -c $conf_filename_working -o $spike_filename_working" |
| set result [exec h5import $data_filename_working -c $conf_filename_working -o $spike_filename_working] |
| #add commands to attrib file for this group |
| } else { |
| puts "i= $i localNode= $n spike_by_node($n) does not exist" |
| } |
| } else { |
| break |
| } |
| #close working conf and data files |
| |
| #delete the conf and data files for this round |
| #file delete $conf_filename_working |
| #file delete $data_filename_working |
| |
| incr i |
| } |
| #edit the nwb file with the attrib file |
| |
| #copy out the nwb file |
| puts "Now to: file copy $spike_filename_working $spike_filename_normalized" |
| file copy $spike_filename_working $spike_filename_normalized |
| #delete the attrib file (preserve for diagnostics) |
| #file delete $attrib_filename_working |
| } |
| |
| proc ::neuro::read_store_nwb_spike_pop {spike_filename pop} { |
| |
| variable spikeHash |
| variable file_piece_size |
| #read in data for a single population within a simple nwb spike file |
| #take all the datasets in processing/*/spike_train/* |
| set avail_datasets [hdf5_list_datasets $spike_filename] |
| set spike_datasets [hdf5_list_nwb_spike_datasets $spike_filename] |
| |
| set i 0 |
| set the_spikeList "" |
| # we will fill spikelist with N lists, each list containing {node_id timestamp} |
| foreach d $spike_datasets { |
| #this is node id in pop, not globalNodeId, |
| foreach {trial_name node_id data_path} $d {} |
| if {[lsearch -exact $avail_datasets $data_path]==-1} { |
| showError "ERROR: required hdf5 dataset $data_path was not found" |
| return |
| } |
| |
| if {$i < 3} { |
| puts "trial= $trial_name node_id= $node_id data_path= $data_path" |
| } |
| #now get data from each fileset and add to spikeHash |
| #puts "about to hdf5_piecewise_dataset $spike_filename $data_path $file_piece_size]" |
| |
| set vec [hdf5_piecewise_dataset $spike_filename $data_path $file_piece_size] |
| puts "i=$i" |
| foreach spike_timestamp $vec { |
| lappend the_spikeList [list $node_id $spike_timestamp] |
| } |
| incr i |
| } |
| |
| set spikeHash(spikeList,$pop) $the_spikeList |
| |
| #take units from final data_path |
| #XX really should check that all match and check for consistency and/or convert if needed |
| set spikeHash(units,$pop) "SET UNITS" |
| #set spikeHash(units,$pop) [hdf5_simple_attribute $spike_filename $data_path "unit"] |
| |
| |
| puts "spikeHash(units,$pop) is $spikeHash(units,$pop) " |
| puts "length spikeHash(spikeList,$pop) is [llength $spikeHash(spikeList,$pop)]" |
| |
| } |
| |
| |
| |
proc ::neuro::hdf5_list_datasets {filename} { | proc ::neuro::hdf5_list_datasets {filename} { |
| |
#h5dump output into array | #h5dump output into array |
| |
#heuristic to find paths. | #heuristic to find paths. |
# ... defaults if needed | # ... defaults if needed |
# XXX hacky 'exec h5dump' must be replaced with better startup method | # XXX hacky 'exec h5dump' must be replaced with better startup method |
puts "about to get size of simple 2-D dataset" | #puts "about to get size of simple 2-D dataset" |
set header_result [exec h5dump -d $dataset -H $filename] | set header_result [exec h5dump -d $dataset -H $filename] |
set header_lines [split $header_result "\n"] | set header_lines [split $header_result "\n"] |
foreach line $header_lines { | foreach line $header_lines { |
| |
set data_size_y $submatch1 | set data_size_y $submatch1 |
set data_size_x $submatch2 | set data_size_x $submatch2 |
set testval [expr 2 * $data_size_x] | set testval [expr 2 * $data_size_x] |
puts "thematch= $thematch submatch1= $submatch1 submatch2= $submatch2 data_size_x= $data_size_x data_size_y= $data_size_y testval= $testval" | #puts "thematch= $thematch submatch1= $submatch1 submatch2= $submatch2 data_size_x= $data_size_x data_size_y= $data_size_y testval= $testval" |
break | break |
} | } |
} | } |
#noww loop, taking chunks of piece_size elements | #noww loop, taking chunks of piece_size elements |
set full_val_list "" | set full_val_list "" |
set y_start 0 | set y_start 0 |
puts "about to: loop over dataset with several h5dump calls. y_start= $y_start piece_size= $piece_size data_size_y= $data_size_y" | #puts "about to: loop over dataset with several h5dump calls. y_start= $y_start piece_size= $piece_size data_size_y= $data_size_y" |
while { $y_start + $piece_size < $data_size_y} { | while { $y_start + $piece_size < $data_size_y} { |
#read in piece_size elements | #read in piece_size elements |
puts "about to hdf5_simple_2d_dataset_range $filename $dataset $data_size_x $y_start $piece_size data_size_x = $data_size_x y_start= $y_start" | puts "about to hdf5_simple_2d_dataset_range $filename $dataset $data_size_x $y_start $piece_size data_size_x = $data_size_x y_start= $y_start" |
| |
if { [regexp {\s*DATASPACE\s+SIMPLE\s*\{\s*\(\s*([0-9]*)\s*\)} $line thematch submatch1 ]} { | if { [regexp {\s*DATASPACE\s+SIMPLE\s*\{\s*\(\s*([0-9]*)\s*\)} $line thematch submatch1 ]} { |
set data_size $submatch1 | set data_size $submatch1 |
set testval [expr 2 * $data_size] | set testval [expr 2 * $data_size] |
puts "thematch= $thematch submatch1= $submatch1 data_size= $data_size testval= $testval" | #puts "thematch= $thematch submatch1= $submatch1 data_size= $data_size testval= $testval" |
break | break |
} | } |
} | } |
puts "about to: loop over dataset with several h5dump calls.exec h5dump -d $dataset --start XXX -count YYY -w1 -y $filename" | #puts "about to: loop over dataset with several h5dump calls.exec h5dump -d $dataset --start XXX -count YYY -w1 -y $filename" |
#noww loop, taking chunks of piece_size elements | #noww loop, taking chunks of piece_size elements |
set val_list "" | set val_list "" |
set start 0 | set start 0 |
| |
} | } |
# now read the remaining elements | # now read the remaining elements |
set remain_size [expr $data_size % $piece_size ] | set remain_size [expr $data_size % $piece_size ] |
puts "now for final read, dataset= $dataset remain_size= $remain_size start= $start length val_list= [llength $val_list] " | #puts "now for final read, dataset= $dataset remain_size= $remain_size start= $start length val_list= [llength $val_list] " |
lappend val_list {*}[hdf5_simple_dataset_range $filename $dataset $start $remain_size ] | lappend val_list {*}[hdf5_simple_dataset_range $filename $dataset $start $remain_size ] |
| |
puts "finished final read, length val_list= [llength $val_list] " | #puts "finished final read, length val_list= [llength $val_list] " |
| |
return $val_list | return $val_list |
| |
| |
foreach etype $typev esource_node_id $source_node_idv etarget_node_id $target_node_idv egroup_id $group_idv egroup_index $group_indexv { | foreach etype $typev esource_node_id $source_node_idv etarget_node_id $target_node_idv egroup_id $group_idv egroup_index $group_indexv { |
lappend popEdges [list $etype $esource_node_id $etarget_node_id $egroup_id $egroup_index] | lappend popEdges [list $etype $esource_node_id $etarget_node_id $egroup_id $egroup_index] |
} | } |
puts "about to loop over group_list. group_list=>$group_list<" | #puts "about to loop over group_list. group_list=>$group_list<" |
foreach edge_group $group_list { | foreach edge_group $group_list { |
# second, read in the group specific fields | # second, read in the group specific fields |
# puts "starting edge_group $edge_group" | # puts "starting edge_group $edge_group" |
| |
puts "Now to read in pop= >$pop< from spike_filename= $spike_filename" | puts "Now to read in pop= >$pop< from spike_filename= $spike_filename" |
| |
set avail_datasets [hdf5_list_datasets $spike_filename] | set avail_datasets [hdf5_list_datasets $spike_filename] |
| puts $avail_datasets |
set timestamps_path "/spikes/${pop}/timestamps" | set timestamps_path "/spikes/${pop}/timestamps" |
set node_ids_path "/spikes/${pop}/node_ids" | set node_ids_path "/spikes/${pop}/node_ids" |
| |
| |
} | } |
#get attributes | #get attributes |
| |
set spikeHash(units,$pop) [hdf5_simple_attribute $spike_filename $timestamps_path "units"] | # find units |
set spikeHash(sorting,$pop) [hdf5_simple_attribute $spike_filename "/spikes/${pop}" "sorting"]) | #set spikeHash(units,$pop) [hdf5_simple_attribute $spike_filename $timestamps_path "units"] |
| |
| #set spikeHash(sorting,$pop) [hdf5_simple_attribute $spike_filename "/spikes/${pop}" "sorting"]) |
} | } |
#assign vectors to list | #assign vectors to list |
set spikeList "" | set spikeList "" |
| |
puts "morph_point_num= $morph_point_num morph_point_parent_num= $morph_point_parent_num mp_x= $mp_x $mp_y= $mp_y mp_z= $mp_z mp_par_x= $mp_par_x $mp_par_y= $mp_par_y mp_par_z= $mp_par_z" | puts "morph_point_num= $morph_point_num morph_point_parent_num= $morph_point_parent_num mp_x= $mp_x $mp_y= $mp_y mp_z= $mp_z mp_par_x= $mp_par_x $mp_par_y= $mp_par_y mp_par_z= $mp_par_z" |
| |
set type_zrot $typeHash(rot_zaxis,$t_efileset_num,$t_etype) | set type_zrot $typeHash(rot_zaxis,$t_efileset_num,$t_etype) |
set m [transmult [transoffset [list $t_ex $t_ey $t_ez]] [transaxis x $t_exrot rad ] [transaxis y $t_eyrot rad] [transaxis z $t_ezrot rad] [transaxis z [expr -1.0 * $type_zrot] rad]] | set m [transmult [transoffset [list $t_ex $t_ey $t_ez]] [transaxis x $t_exrot rad ] [transaxis y $t_eyrot rad] [transaxis z $t_ezrot rad] [transaxis z [expr $type_zrot] rad]] |
set v [list $mp_x $mp_y $mp_z] | set v [list $mp_x $mp_y $mp_z] |
set v_par [list $mp_par_x $mp_par_y $mp_par_z] | set v_par [list $mp_par_x $mp_par_y $mp_par_z] |
#move the points | #move the points |
| |
| |
set pointList [proto_retrieve_morphology $efileset_num $etype ] | set pointList [proto_retrieve_morphology $efileset_num $etype ] |
| |
# note ($ezrot - $type_zrot) | # note ($ezrot + $type_zrot) |
set morph_details [list $theId [list $ex $ey $ez] [list $exrot $eyrot [expr $ezrot - $type_zrot] ] [llength $pointList] ] | set morph_details [list $theId [list $ex $ey $ez] [list $exrot $eyrot [expr $ezrot + $type_zrot] ] [llength $pointList] ] |
lappend ll $morph_details | lappend ll $morph_details |
incr n | incr n |
} | } |
| |
| |
set isolated_pointList [proto_calc_morph_original_pos_isolated_points $etype $efileset_num ] | set isolated_pointList [proto_calc_morph_original_pos_isolated_points $etype $efileset_num ] |
| |
# note ($ezrot - $type_zrot) | # note ($ezrot + $type_zrot) |
set morph_details [list $theId [list $ex $ey $ez] [list $exrot $eyrot [expr $ezrot - $type_zrot] ] $isolated_pointList ] | set morph_details [list $theId [list $ex $ey $ez] [list $exrot $eyrot [expr $ezrot + $type_zrot] ] $isolated_pointList ] |
lappend ll $morph_details | lappend ll $morph_details |
incr n | incr n |
} | } |
| |
#only report if this node has Cartesian coordinates for soma | #only report if this node has Cartesian coordinates for soma |
| |
| |
# note ($ezrot - $type_zrot) | # note ($ezrot + $type_zrot) |
set isolated_pointList [proto_calc_morph_moved_isolated_points $etype $efileset_num $ex $ey $ez $exrot $eyrot [expr $ezrot - $type_zrot] ] | # XX Note ezrot alone sent, the type_zrot addition is done within proto_calc_morph_moved_isolated_points |
| set isolated_pointList [proto_calc_morph_moved_isolated_points $etype $efileset_num $ex $ey $ez $exrot $eyrot $ezrot ] |
puts "morph_moved: llength isolated_pointList is [llength $isolated_pointList]" | puts "morph_moved: llength isolated_pointList is [llength $isolated_pointList]" |
# note ($ezrot - $type_zrot) | # note ($ezrot + $type_zrot) |
set morph_details [list $theId [list $ex $ey $ez] [list $exrot $eyrot [expr $ezrot - $type_zrot] ] $isolated_pointList ] | # XX note the addition for type_zrot. Reporting what happens in proto_calc_morph_moved_isolated_points. When switch zrot handling from addition to override-able, change this |
| set morph_details [list $theId [list $ex $ey $ez] [list $exrot $eyrot [expr $ezrot + $type_zrot] ] $isolated_pointList ] |
lappend ll $morph_details | lappend ll $morph_details |
incr n | incr n |
} | } |