summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-06-05 20:33:46 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-06-05 20:33:46 (GMT)
commit165efffa5b47eaf5cc304ce3c07d2a73ba87f702 (patch)
treef4eaa32d7b902530fad37db54adb83c151f5ec11
parentba82587948e28584b8a6dd348150977c5fd9f705 (diff)
downloadblt-165efffa5b47eaf5cc304ce3c07d2a73ba87f702.zip
blt-165efffa5b47eaf5cc304ce3c07d2a73ba87f702.tar.gz
blt-165efffa5b47eaf5cc304ce3c07d2a73ba87f702.tar.bz2
add multiple plot support
-rw-r--r--ds9/library/markeranalysishist.tcl4
-rw-r--r--ds9/library/markeranalysisplot2d.tcl4
-rw-r--r--ds9/library/markeranalysisplot3d.tcl4
-rw-r--r--ds9/library/markeranalysisradial.tcl6
-rw-r--r--ds9/library/plot.tcl61
-rw-r--r--ds9/library/plotdata.tcl118
-rw-r--r--ds9/library/plotstate.tcl24
7 files changed, 111 insertions, 110 deletions
diff --git a/ds9/library/markeranalysishist.tcl b/ds9/library/markeranalysishist.tcl
index cd1a926..6ca4cda 100644
--- a/ds9/library/markeranalysishist.tcl
+++ b/ds9/library/markeranalysishist.tcl
@@ -84,8 +84,8 @@ proc MarkerAnalysisHistogramCB {frame id} {
set vvar($cc,manage) 0
set vvar($cc,dim) xy
- set vvar($cc,xdata) $xdata
- set vvar($cc,ydata) $ydata
+ set vvar(graph,ds,xdata) $xdata
+ set vvar(graph,ds,ydata) $ydata
blt::vector create $xdata $ydata
}
diff --git a/ds9/library/markeranalysisplot2d.tcl b/ds9/library/markeranalysisplot2d.tcl
index 0fffe24..6b16f14 100644
--- a/ds9/library/markeranalysisplot2d.tcl
+++ b/ds9/library/markeranalysisplot2d.tcl
@@ -173,8 +173,8 @@ proc MarkerAnalysisPlot2dCB {frame id} {
set vvar($cc,manage) 0
set vvar($cc,dim) xy
- set vvar($cc,xdata) $xdata
- set vvar($cc,ydata) $ydata
+ set vvar(graph,ds,xdata) $xdata
+ set vvar(graph,ds,ydata) $ydata
blt::vector create $xdata $ydata $xcdata $ycdata
}
diff --git a/ds9/library/markeranalysisplot3d.tcl b/ds9/library/markeranalysisplot3d.tcl
index 3546fba..80b50be 100644
--- a/ds9/library/markeranalysisplot3d.tcl
+++ b/ds9/library/markeranalysisplot3d.tcl
@@ -178,8 +178,8 @@ proc MarkerAnalysisPlot3dCB {frame id} {
set vvar($cc,manage) 0
set vvar($cc,dim) xy
- set vvar($cc,xdata) $xdata
- set vvar($cc,ydata) $ydata
+ set vvar(graph,ds,xdata) $xdata
+ set vvar(graph,ds,ydata) $ydata
blt::vector create $xdata $ydata
}
diff --git a/ds9/library/markeranalysisradial.tcl b/ds9/library/markeranalysisradial.tcl
index aea882a..c489820 100644
--- a/ds9/library/markeranalysisradial.tcl
+++ b/ds9/library/markeranalysisradial.tcl
@@ -111,9 +111,9 @@ proc MarkerAnalysisRadialCB {frame id} {
set vvar($cc,manage) 0
set vvar($cc,dim) xyey
- set vvar($cc,xdata) $xdata
- set vvar($cc,ydata) $ydata
- set vvar($cc,yedata) $yedata
+ set vvar(graph,ds,xdata) $xdata
+ set vvar(graph,ds,ydata) $ydata
+ set vvar(graph,ds,yedata) $yedata
blt::vector create $xdata $ydata $yedata
}
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl
index 486fb27..7f0d098 100644
--- a/ds9/library/plot.tcl
+++ b/ds9/library/plot.tcl
@@ -100,19 +100,19 @@ proc PlotAddData {varname} {
}
}
- global $var($cc,xdata) $var($cc,ydata)
+ global $var(graph,ds,xdata) $var(graph,ds,ydata)
$var($cc) element create "d-${nn}" \
- -xdata $var($cc,xdata) -ydata $var($cc,ydata)
- if {$var($cc,xedata) != {}} {
- if {[$var($cc,xedata) length] != 0} {
+ -xdata $var(graph,ds,xdata) -ydata $var(graph,ds,ydata)
+ if {$var(graph,ds,xedata) != {}} {
+ if {[$var(graph,ds,xedata) length] != 0} {
$var($cc) element configure "d-${nn}" \
- -xerror $var($cc,xedata)
+ -xerror $var(graph,ds,xedata)
}
}
- if {$var($cc,yedata) != {}} {
- if {[$var($cc,yedata) length] != 0} {
+ if {$var(graph,ds,yedata) != {}} {
+ if {[$var(graph,ds,yedata) length] != 0} {
$var($cc) element configure "d-${nn}" \
- -yerror $var($cc,yedata)
+ -yerror $var(graph,ds,yedata)
}
}
}
@@ -167,10 +167,10 @@ proc PlotDeleteData {varname} {
set var($cc,data,current) 0
set var(graph,ds,name) {}
- set var($cc,xdata) {}
- set var($cc,ydata) {}
- set var($cc,xedata) {}
- set var($cc,yedata) {}
+ set var(graph,ds,xdata) {}
+ set var(graph,ds,ydata) {}
+ set var(graph,ds,xedata) {}
+ set var(graph,ds,yedata) {}
# reset other variables
set var($cc,axis,x,auto) 1
@@ -347,11 +347,12 @@ proc PlotListGenerate {varname} {
set cc $var(graph,current)
set rr {}
- if {$var($cc,xdata) != {}} {
- global $var($cc,xdata) $var($cc,ydata) $var($cc,xedata) $var($cc,yedata)
- set ll [$var($cc,xdata) length]
- set xx [$var($cc,xdata) range]
- set yy [$var($cc,ydata) range]
+ if {$var(graph,ds,xdata) != {}} {
+ global $var(graph,ds,xdata) $var(graph,ds,ydata) \
+ $var(graph,ds,xedata) $var(graph,ds,yedata)
+ set ll [$var(graph,ds,xdata) length]
+ set xx [$var(graph,ds,xdata) range]
+ set yy [$var(graph,ds,ydata) range]
switch $var($cc,dim) {
xy {
@@ -360,20 +361,20 @@ proc PlotListGenerate {varname} {
}
}
xyex {
- set xe [$var($cc,xedata) range]
+ set xe [$var(graph,ds,xedata) range]
for {set ii 0} {$ii<$ll} {incr ii} {
append rr "[lindex $xx $ii] [lindex $yy $ii] [lindex $xe $ii]\n"
}
}
xyey {
- set ye [$var($cc,yedata) range]
+ set ye [$var(graph,ds,yedata) range]
for {set ii 0} {$ii<$ll} {incr ii} {
append rr "[lindex $xx $ii] [lindex $yy $ii] [lindex $ye $ii]\n"
}
}
xyexey {
- set xe [$var($cc,xedata) range]
- set ye [$var($cc,yedata) range]
+ set xe [$var(graph,ds,xedata) range]
+ set ye [$var(graph,ds,yedata) range]
for {set ii 0} {$ii<$ll} {incr ii} {
append rr "[lindex $xx $ii] [lindex $yy $ii] [lindex $xe $ii] [lindex $ye $ii]\n"
}
@@ -440,14 +441,14 @@ proc PlotStatsGenerate {varname} {
set varr {}
set sdev {}
- if {$var($cc,ydata) != {}} {
- if {[$var($cc,ydata) length] > 0} {
- set min [format "%6.3f" [blt::vector expr min($var($cc,ydata))]]
- set max [format "%6.3f" [blt::vector expr max($var($cc,ydata))]]
- set mean [format "%6.3f" [blt::vector expr mean($var($cc,ydata))]]
- set median [format "%6.3f" [blt::vector expr median($var($cc,ydata))]]
- set varr [format "%6.3f" [expr [blt::vector expr var($var($cc,ydata))]]]
- set sdev [format "%6.3f" [expr [blt::vector expr sdev($var($cc,ydata))]]]
+ if {$var(graph,ds,ydata) != {}} {
+ if {[$var(graph,ds,ydata) length] > 0} {
+ set min [format "%6.3f" [blt::vector expr min($var(graph,ds,ydata))]]
+ set max [format "%6.3f" [blt::vector expr max($var(graph,ds,ydata))]]
+ set mean [format "%6.3f" [blt::vector expr mean($var(graph,ds,ydata))]]
+ set median [format "%6.3f" [blt::vector expr median($var(graph,ds,ydata))]]
+ set varr [format "%6.3f" [expr [blt::vector expr var($var(graph,ds,ydata))]]]
+ set sdev [format "%6.3f" [expr [blt::vector expr sdev($var(graph,ds,ydata))]]]
}
}
@@ -539,7 +540,7 @@ proc PlotUpdateGraph {varname} {
}
# Menus
- if {$var($cc,xdata) != {}} {
+ if {$var(graph,ds,xdata) != {}} {
$var(mb).file entryconfig "[msgcat::mc {Save Data}]..." -state normal
$var(mb).file entryconfig [msgcat::mc {Clear Data}] -state normal
$var(mb).file entryconfig [msgcat::mc {Statistics}] -state normal
diff --git a/ds9/library/plotdata.tcl b/ds9/library/plotdata.tcl
index 15d76e8..b4c58be 100644
--- a/ds9/library/plotdata.tcl
+++ b/ds9/library/plotdata.tcl
@@ -87,13 +87,13 @@ proc PlotDataSetOne {varname dim data} {
set var(graph,ds,name) "Dataset $nn"
# vectors
- set var($cc,xdata) $xdata
- set var($cc,ydata) $ydata
- set var($cc,xedata) {}
- set var($cc,yedata) {}
+ set var(graph,ds,xdata) $xdata
+ set var(graph,ds,ydata) $ydata
+ set var(graph,ds,xedata) {}
+ set var(graph,ds,yedata) {}
- global $var($cc,xdata) $var($cc,ydata)
- blt::vector create $var($cc,xdata) $var($cc,ydata)
+ global $var(graph,ds,xdata) $var(graph,ds,ydata)
+ blt::vector create $var(graph,ds,xdata) $var(graph,ds,ydata)
# substitute all separtors
regsub -all {[\n\r\t, ]+} $data { } data
@@ -113,52 +113,52 @@ proc PlotDataSetOne {varname dim data} {
lappend x [lindex $data $ii]
lappend y [lindex $data [expr $ii+1]]
}
- $var($cc,xdata) set $x
- $var($cc,ydata) set $y
+ $var(graph,ds,xdata) set $x
+ $var(graph,ds,ydata) set $y
}
xyex {
set var($cc,dim) xyex
- set var($cc,xedata) $xedata
+ set var(graph,ds,xedata) $xedata
- global $var($cc,xedata)
- blt::vector create $var($cc,xedata)
+ global $var(graph,ds,xedata)
+ blt::vector create $var(graph,ds,xedata)
for {set ii 0} {$ii<$ll} {incr ii 3} {
lappend x [lindex $data $ii]
lappend y [lindex $data [expr $ii+1]]
lappend xe [lindex $data [expr $ii+2]]
}
- $var($cc,xdata) set $x
- $var($cc,ydata) set $y
- $var($cc,xedata) set $xe
+ $var(graph,ds,xdata) set $x
+ $var(graph,ds,ydata) set $y
+ $var(graph,ds,xedata) set $xe
}
3 -
xyey {
set var($cc,dim) xyey
- set var($cc,yedata) $yedata
+ set var(graph,ds,yedata) $yedata
- global $var($cc,yedata)
- blt::vector create $var($cc,yedata)
+ global $var(graph,ds,yedata)
+ blt::vector create $var(graph,ds,yedata)
for {set ii 0} {$ii<$ll} {incr ii 3} {
lappend x [lindex $data $ii]
lappend y [lindex $data [expr $ii+1]]
lappend ye [lindex $data [expr $ii+2]]
}
- $var($cc,xdata) set $x
- $var($cc,ydata) set $y
- $var($cc,yedata) set $ye
+ $var(graph,ds,xdata) set $x
+ $var(graph,ds,ydata) set $y
+ $var(graph,ds,yedata) set $ye
}
xyexey {
set var($cc,dim) xyexey
- set var($cc,xedata) $xedata
- set var($cc,yedata) $yedata
+ set var(graph,ds,xedata) $xedata
+ set var(graph,ds,yedata) $yedata
- global $var($cc,xedata) $var($cc,yedata)
- blt::vector create $var($cc,xedata) $var($cc,yedata)
+ global $var(graph,ds,xedata) $var(graph,ds,yedata)
+ blt::vector create $var(graph,ds,xedata) $var(graph,ds,yedata)
for {set ii 0} {$ii<$ll} {incr ii 4} {
lappend x [lindex $data $ii]
@@ -166,27 +166,27 @@ proc PlotDataSetOne {varname dim data} {
lappend xe [lindex $data [expr $ii+2]]
lappend ye [lindex $data [expr $ii+3]]
}
- $var($cc,xdata) set $x
- $var($cc,ydata) set $y
- $var($cc,xedata) set $xe
- $var($cc,yedata) set $ye
+ $var(graph,ds,xdata) set $x
+ $var(graph,ds,ydata) set $y
+ $var(graph,ds,xedata) set $xe
+ $var(graph,ds,yedata) set $ye
}
4.1 {
set var($cc,dim) xyey
- set var($cc,yedata) $yedata
+ set var(graph,ds,yedata) $yedata
- global $var($cc,yedata)
- blt::vector create $var($cc,yedata)
+ global $var(graph,ds,yedata)
+ blt::vector create $var(graph,ds,yedata)
for {set ii 0} {$ii<$ll} {incr ii 4} {
lappend x [lindex $data $ii]
lappend y [lindex $data [expr $ii+1]]
lappend ye [lindex $data [expr $ii+2]]
}
- $var($cc,xdata) set $x
- $var($cc,ydata) set $y
- $var($cc,yedata) set $ye
+ $var(graph,ds,xdata) set $x
+ $var(graph,ds,ydata) set $y
+ $var(graph,ds,yedata) set $ye
}
4.2 {
@@ -196,42 +196,42 @@ proc PlotDataSetOne {varname dim data} {
lappend x [lindex $data $ii]
lappend y [lindex $data [expr $ii+3]]
}
- $var($cc,xdata) set $x
- $var($cc,ydata) set $y
+ $var(graph,ds,xdata) set $x
+ $var(graph,ds,ydata) set $y
}
5.1 {
set var($cc,dim) xyey
- set var($cc,yedata) $yedata
+ set var(graph,ds,yedata) $yedata
- global $var($cc,yedata)
- blt::vector create $var($cc,yedata)
+ global $var(graph,ds,yedata)
+ blt::vector create $var(graph,ds,yedata)
for {set ii 0} {$ii<$ll} {incr ii 5} {
lappend x [lindex $data $ii]
lappend y [lindex $data [expr $ii+1]]
lappend ye [lindex $data [expr $ii+2]]
}
- $var($cc,xdata) set $x
- $var($cc,ydata) set $y
- $var($cc,yedata) set $ye
+ $var(graph,ds,xdata) set $x
+ $var(graph,ds,ydata) set $y
+ $var(graph,ds,yedata) set $ye
}
5.2 {
set var($cc,dim) xyey
- set var($cc,yedata) $yedata
+ set var(graph,ds,yedata) $yedata
- global $var($cc,yedata)
- blt::vector create $var($cc,yedata)
+ global $var(graph,ds,yedata)
+ blt::vector create $var(graph,ds,yedata)
for {set ii 0} {$ii<$ll} {incr ii 5} {
lappend x [lindex $data $ii]
lappend y [lindex $data [expr $ii+3]]
lappend ye [lindex $data [expr $ii+4]]
}
- $var($cc,xdata) set $x
- $var($cc,ydata) set $y
- $var($cc,yedata) set $ye
+ $var(graph,ds,xdata) set $x
+ $var(graph,ds,ydata) set $y
+ $var(graph,ds,yedata) set $ye
}
}
@@ -374,7 +374,7 @@ proc PlotSaveData {varname} {
set cc $var(graph,current)
- if {$var($cc,xdata) == {}} {
+ if {$var(graph,ds,xdata) == {}} {
return
}
@@ -387,7 +387,7 @@ proc PlotSaveDataFile {varname filename} {
set cc $var(graph,current)
- if {$var($cc,xdata) == {}} {
+ if {$var(graph,ds,xdata) == {}} {
return
}
@@ -395,11 +395,11 @@ proc PlotSaveDataFile {varname filename} {
return
}
- global $var($cc,xdata) $var($cc,ydata) \
- $var($cc,xedata) $var($cc,yedata)
- set ll [$var($cc,xdata) length]
- set xx [$var($cc,xdata) range]
- set yy [$var($cc,ydata) range]
+ global $var(graph,ds,xdata) $var(graph,ds,ydata) \
+ $var(graph,ds,xedata) $var(graph,ds,yedata)
+ set ll [$var(graph,ds,xdata) length]
+ set xx [$var(graph,ds,xdata) range]
+ set yy [$var(graph,ds,ydata) range]
set ch [open $filename w]
switch $var($cc,dim) {
@@ -409,20 +409,20 @@ proc PlotSaveDataFile {varname filename} {
}
}
xyex {
- set xe [$var($cc,xedata) range]
+ set xe [$var(graph,ds,xedata) range]
for {set ii 0} {$ii<$ll} {incr ii} {
puts $ch "[lindex $xx $ii] [lindex $yy $ii] [lindex $xe $ii]"
}
}
xyey {
- set ye [$var($cc,yedata) range]
+ set ye [$var(graph,ds,yedata) range]
for {set ii 0} {$ii<$ll} {incr ii} {
puts $ch "[lindex $xx $ii] [lindex $yy $ii] [lindex $ye $ii]"
}
}
xyexey {
- set xe [$var($cc,xedata) range]
- set ye [$var($cc,yedata) range]
+ set xe [$var(graph,ds,xedata) range]
+ set ye [$var(graph,ds,yedata) range]
for {set ii 0} {$ii<$ll} {incr ii} {
puts $ch "[lindex $xx $ii] [lindex $yy $ii] [lindex $xe $ii] [lindex $ye $ii]"
}
diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl
index ed0ab97..c75b14a 100644
--- a/ds9/library/plotstate.tcl
+++ b/ds9/library/plotstate.tcl
@@ -113,10 +113,10 @@ proc PlotInitGraph {varname} {
set var(graph,axis,y,format) $pap(graph,axis,y,format)
# per DataSet
- set var(graph1,xdata) {}
- set var(graph1,ydata) {}
- set var(graph1,xedata) {}
- set var(graph1,yedata) {}
+ set var(graph,ds,xdata) {}
+ set var(graph,ds,ydata) {}
+ set var(graph,ds,xedata) {}
+ set var(graph,ds,yedata) {}
set var(graph,ds,name) $pap(graph,ds,name)
set var(graph,ds,show) $pap(graph,ds,show)
@@ -172,10 +172,10 @@ proc PlotSaveState {varname} {
set var($cc,axis,y,format) $var(graph,axis,y,format)
# per DataSet
- set var($cc,$nn,xdata) $var($cc,xdata)
- set var($cc,$nn,ydata) $var($cc,ydata)
- set var($cc,$nn,xedata) $var($cc,xedata)
- set var($cc,$nn,yedata) $var($cc,yedata)
+ set var($cc,$nn,xdata) $var(graph,ds,xdata)
+ set var($cc,$nn,ydata) $var(graph,ds,ydata)
+ set var($cc,$nn,xedata) $var(graph,ds,xedata)
+ set var($cc,$nn,yedata) $var(graph,ds,yedata)
set var($cc,$nn,name) $var(graph,ds,name)
set var($cc,$nn,show) $var(graph,ds,show)
@@ -231,10 +231,10 @@ proc PlotRestoreState {varname nn} {
set var(graph,axis,y,format) $var($cc,axis,y,format)
# per DataSet
- set var($cc,xdata) $var($cc,$nn,xdata)
- set var($cc,ydata) $var($cc,$nn,ydata)
- set var($cc,xedata) $var($cc,$nn,xedata)
- set var($cc,yedata) $var($cc,$nn,yedata)
+ set var(graph,ds,xdata) $var($cc,$nn,xdata)
+ set var(graph,ds,ydata) $var($cc,$nn,ydata)
+ set var(graph,ds,xedata) $var($cc,$nn,xedata)
+ set var(graph,ds,yedata) $var($cc,$nn,yedata)
set var(graph,ds,name) $var($cc,$nn,name)
set var(graph,ds,show) $var($cc,$nn,show)