Added configuration file changes from ics1-pelican

This commit is contained in:
Ferdi Franceschini
2013-04-20 17:53:17 +10:00
parent 1d7681e326
commit b98ff24528
3 changed files with 128 additions and 27 deletions

View File

@@ -8,14 +8,15 @@ set sim_mode [SplitReply [hmm_simulation]]
# Elastic peak index and time of flight channel width
::utility::mkVar elpk int user elpk true detector true true
sicslist setatt elpk link data_set
::utility::mkVar tofw int user tofw true detector true true
::utility::mkVar tofw float user tofw true detector true true
sicslist setatt tofw link data_set
sicslist setatt tofw units [::histogram_memory::clock_scale units]
proc ::histogram_memory::init_OAT_TABLE {} {
variable INST_NXC "oat_nxc_eff"
variable INST_NYC "oat_nyc_eff"
if [ catch {
set twidth 3333
OAT_TABLE X -setdata MAX_CHAN 200
OAT_TABLE Y -setdata MAX_CHAN 1024
OAT_TABLE X -setdata BMIN -0.5
@@ -23,8 +24,32 @@ proc ::histogram_memory::init_OAT_TABLE {} {
OAT_TABLE Y -setdata BMIN -0.5
OAT_TABLE Y -setdata BMAX 1023.5
OAT_TABLE -set X { 199.5 198.5 } NXC 200 Y { -0.5 0.5 } NYC 64 T " 0 $twidth " NTC 1024
tofw $twidth
set clock_scale 1000
set freq 200
set tbins 1000
set xbins 200
set ybins 64
set period [expr 1.0/$freq]
set tbinwidth_ns [expr $period/$tbins * 1e9]
hmm configure fat_clock_scale $clock_scale
hmm configure fat_frame_frequency $freq
# The entries in the time bin array are in nanoseconds/clock_scale because the clock base is in nanoseconds
set tbb0 0.0
set tbb1 [expr $tbb0 + $tbinwidth_ns / $clock_scale]
OAT_TABLE -set X { 199.5 198.5 } NXC $xbins Y { -0.5 15.5 } NYC $ybins T "$tbb0 $tbb1" NTC $tbins
# Use the ::histogram_memory::clock_scale function to make sure that the value in the
# time of flight channel width is consistent with its units
sicslist setatt tofw units [::histogram_memory::clock_scale units]
tofw [expr ($tbb1 - $tbb0) * [::histogram_memory::clock_scale]]
if {$::sim_mode == "true"} {
hmm configure oat_ntc_eff $tbins
hmm configure $INST_NYC $ybins
hmm configure $INST_NXC $xbins
}
} message ] {
if {$::errorCode=="NONE"} {return $message}
return -code error $message
@@ -151,16 +176,9 @@ proc ::histogram_memory::pre_count {} {}
proc ::histogram_memory::post_count {} {}
proc ::histogram_memory::isc_initialize {} {
# Instrument specific X and Y dimension names
variable INST_NXC "oat_nxc_eff"
variable INST_NYC "oat_nyc_eff"
if [ catch {
::histogram_memory::init_hmm_objs
if {$::sim_mode == "true"} {
hmm configure oat_ntc_eff 1024
hmm configure $INST_NYC 64
hmm configure $INST_NXC 200
}
BAT_TABLE -init
# CAT_TABLE -init
SAT_TABLE -init
@@ -197,7 +215,69 @@ proc ::histogram_memory::isc_initialize {} {
}
proc histmem {cmd args} {
eval "_histmem $cmd $args"
set catch_status [ catch {
switch $cmd {
"tbins" {
if {$args == ""} {
set reply [OAT_TABLE -get NTC]
} else {
if {[llength $args] != 2} {
error "There should be two arguments in $args, the number of time bins and the desired frame frequency"
} else {
foreach {numbins freq} $args {}
if { ![string is integer $numbins]} {
error "$numbins should be an integer"
}
if { ![string is double $freq]} {
error "$freq should be a number"
}
set period [expr 1.0/$freq]
set tbinwidth_us [expr $period/$numbins * 1e6]
set clock_scale [::histogram_memory::clock_scale]
set tbb0 0.0
set tbb1 [expr $tbb0 + $tbinwidth_us / $clock_scale]
hmm configure fat_frame_frequency $freq
OAT_TABLE -set T "$tbb0 $tbb1" NTC $numbins
set reply [_histmem loadconf]
}
}
}
"twidth" {
if {$args == ""} {
set tbins [OAT_TABLE -get T]
set tb0 [lindex $tbins 0]
set tb1 [lindex $tbins 1]
set reply [expr {($tb1 - $tb0) / [::histogram_memory::clock_scale]}]
} else {
if {[llength $args] != 2} {
error "There should be two arguments in $args, the desired time bin width and the frame frequency"
} else {
foreach {binw_us freq} $args {}
if { ![string is double $binw_us]} {
error "$binw_us should be a number"
}
if { ![string is double $freq]} {
error "$freq should be a number"
}
set period_us [expr {1e6/$freq}]
set numbins [expr {round(0.5 + $period_us/$binw_us)}]
set clock_scale [::histogram_memory::clock_scale]
set tbinwidth [expr {$binw_us / $clock_scale}]
set tbb0 0.0
set tbb1 [expr $tbb0 + $tbinwidth]
hmm configure fat_frame_frequency $freq
OAT_TABLE -set T "$tbb0 $tbb1" NTC $numbins
set reply [_histmem loadconf]
}
}
}
default {
set reply [eval "_histmem $cmd $args"]
}
}
return $reply
} msg ]
handle_exception $catch_status $msg
}
publish histmem user