From 307e29e60eedbf1c6cfd3c868267c862e73719ab Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Thu, 16 Aug 2007 16:31:37 +1000 Subject: [PATCH] Added instrument specific initialisation function. r2122 | ffr | 2007-08-16 16:31:37 +1000 (Thu, 16 Aug 2007) | 2 lines --- .../hipd/config/hmm/hmm_configuration.tcl | 46 +++++++++++++++++-- .../hrpd/config/hmm/hmm_configuration.tcl | 46 +++++++++++++++++-- .../config/hmm/hmm_configuration.tcl | 38 +++++++++++++-- .../rsd/config/hmm/hmm_configuration.tcl | 37 +++++++++++++-- .../sans/config/hmm/hmm_configuration.tcl | 37 +++++++++++++-- 5 files changed, 187 insertions(+), 17 deletions(-) diff --git a/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl index f0ce0f10..69ec5d4f 100644 --- a/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl @@ -1,6 +1,8 @@ set sim_mode [SplitReply [hmm_simulation]] if {$sim_mode == "true"} { MakeHM hmm SIM; + hmm configure daq Stopped + hmm configure statuscheck false namespace eval histogram_memory { proc hmc {_start _preset _mode _pause} { bm mode $_mode; @@ -13,9 +15,10 @@ if {$sim_mode == "true"} { MakeHMControl_ANSTO hmc bm hmm; } -source $cfPath(hmm)/hmm_configuration_common_1.tcl +source $cfPath(hmm)/hmm_configuration_common_1.tcl +source $cfPath(hmm)/hmm_cylindrical_detector_configuration.tcl if {$sim_mode == "true"} { - proc ::histogram_memory::hmm_initialize {} { + proc ::histogram_memory::initialize {} { hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080; hmm configure username spy; hmm configure password 007; @@ -34,7 +37,6 @@ if {$sim_mode == "true"} { # - Or, no configuration at all could be uploaded, the # histogram server can configure itself using its default config files. proc ::histogram_memory::setmode {mode} { - global cfPath; hmm_mode $mode; set sim_mode [SplitReply [hmm_simulation]]; @@ -77,7 +79,43 @@ proc ::histogram_memory::setmode {mode} { _hmm_hor_axis_alias dtheta; _hmm_vert_axis y_pixel_offset; _hmm_vert_axis_alias dvaxis; - hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full_small.xml"; + ::histogram_memory::configure_server Filler_defaults } } } + +##\brief Return the detector position +proc ::histogram_memory::detector_posn_degrees {} { + return [SplitReply [stth]] +} +proc ::histogram_memory::initialize {} { + ::histogram_memory::_initialize + ::histogram_memory::two_theta -centres + + detector_active_height_mm 200 + detector_active_width_mm 500 + detector_radius_mm 700.0 + set x_bin0 991.5; set x_binmax -0.5 + set y_bin0 0; set y_binmax 511.5 + set x_binwidth 1 + if {[expr {$x_binmax - $x_bin0}] > 0} { + set x_bin1 [expr {$x_bin0+$x_binwidth}] + } else { + set x_bin1 [expr {$x_bin0-$x_binwidth}] + } + set y_binwidth 1 + if {[expr {$y_binmax - $y_bin0}] > 0} { + set y_bin1 [expr {$y_bin0+$y_binwidth}] + } else { + set y_bin1 [expr {$y_bin0-$y_binwidth}] + } + OAT_TABLE -init X_min $x_bin0 X_max $x_binmax Y_min $y_bin0 Y_max $y_binmax + # We default to one big bin for time + set t_bin0 [OAT_TABLE -get T_min] + set t_bin1 [OAT_TABLE -get T_max] + OAT_TABLE X "$x_bin0 $x_bin1" Y "$y_bin0 $y_bin1" T "$t_bin0 $t_bin1" + ::histogram_memory::configure_server Filler_defaults + + ::nexus::data alias ::histogram_memory::vertical_axis ::histogram_memory::y_pixel_offset + ::nexus::data alias ::histogram_memory::horizontal_axis ::histogram_memory::two_theta +} diff --git a/site_ansto/instrument/hrpd/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/hrpd/config/hmm/hmm_configuration.tcl index 9900657c..3e528d38 100644 --- a/site_ansto/instrument/hrpd/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/hrpd/config/hmm/hmm_configuration.tcl @@ -1,6 +1,8 @@ set sim_mode [SplitReply [hmm_simulation]] if {$sim_mode == "true"} { MakeHM hmm SIM; + hmm configure daq Stopped + hmm configure statuscheck false namespace eval histogram_memory { proc hmc {_start _preset _mode _pause} { bm mode $_mode; @@ -13,9 +15,10 @@ if {$sim_mode == "true"} { MakeHMControl_ANSTO hmc bm hmm; } -source $cfPath(hmm)/hmm_configuration_common_1.tcl +source $cfPath(hmm)/hmm_configuration_common_1.tcl +source $cfPath(hmm)/hmm_cylindrical_detector_configuration.tcl if {$sim_mode == "true"} { - proc ::histogram_memory::hmm_initialize {} { + proc ::histogram_memory::initialize {} { hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080; hmm configure username spy; hmm configure password 007; @@ -34,7 +37,6 @@ if {$sim_mode == "true"} { # - Or, no configuration at all could be uploaded, the # histogram server can configure itself using its default config files. proc ::histogram_memory::setmode {mode} { - global cfPath; hmm_mode $mode; set sim_mode [SplitReply [hmm_simulation]]; @@ -77,7 +79,43 @@ proc ::histogram_memory::setmode {mode} { _hmm_hor_axis_alias dtheta _hmm_vert_axis vertical_channel_number _hmm_vert_axis_alias drowindex - hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full_folding.xml" + ::histogram_memory::configure_server Filler_defaults } } } + +##\brief Return the detector position +proc ::histogram_memory::detector_posn_degrees {} { + return [SplitReply [stth]] +} +proc ::histogram_memory::initialize {} { + ::histogram_memory::_initialize + ::histogram_memory::two_theta -centres + + detector_active_height_mm 335 + detector_active_width_mm 500 + detector_radius_mm 1250.0 + set x_bin0 63.5; set x_binmax -0.5 + set y_bin0 -0.5; set y_binmax 1023.5 + set x_binwidth 1 + if {[expr {$x_binmax - $x_bin0}] > 0} { + set x_bin1 [expr {$x_bin0+$x_binwidth}] + } else { + set x_bin1 [expr {$x_bin0-$x_binwidth}] + } + set y_binwidth 1 + if {[expr {$y_binmax - $y_bin0}] > 0} { + set y_bin1 [expr {$y_bin0+$y_binwidth}] + } else { + set y_bin1 [expr {$y_bin0-$y_binwidth}] + } + OAT_TABLE -init X_min $x_bin0 X_max $x_binmax Y_min $y_bin0 Y_max $y_binmax + # We default to one big bin for time + set t_bin0 [OAT_TABLE -get T_min] + set t_bin1 [OAT_TABLE -get T_max] + OAT_TABLE X "$x_bin0 $x_bin1" Y "$y_bin0 $y_bin1" T "$t_bin0 $t_bin1" + ::histogram_memory::configure_server Filler_defaults + + ::nexus::data alias ::histogram_memory::vertical_axis ::histogram_memory::y_pixel_offset + ::nexus::data alias ::histogram_memory::horizontal_axis ::histogram_memory::two_theta +} diff --git a/site_ansto/instrument/reflectometer/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/reflectometer/config/hmm/hmm_configuration.tcl index 2053788f..2e539674 100644 --- a/site_ansto/instrument/reflectometer/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/reflectometer/config/hmm/hmm_configuration.tcl @@ -1,6 +1,8 @@ set sim_mode [SplitReply [hmm_simulation]] if {$sim_mode == "true"} { MakeHM hmm SIM; + hmm configure daq Stopped + hmm configure statuscheck false namespace eval histogram_memory { proc hmc {_start _preset _mode _pause} { bm mode $_mode; @@ -15,7 +17,7 @@ if {$sim_mode == "true"} { source $cfPath(hmm)/hmm_configuration_common_1.tcl if {$sim_mode == "true"} { - proc ::histogram_memory::hmm_initialize {} { + proc ::histogram_memory::initialize {} { hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080; hmm configure username spy; hmm configure password 007; @@ -76,9 +78,39 @@ proc ::histogram_memory::setmode {mode} { _hmm_hor_axis_alias dtheta _hmm_vert_axis vertical_channel_number _hmm_vert_axis_alias drowindex - OAT_TABLE X {-210.5 -209.5} Y {-110.5 -109.5} T {0 20000} NTC 5 - ::histogram_memory::configure_server Filler_defaults FASTCOMTEC + #OAT_TABLE X {-210.5 -208.5} Y {-110.5 -109.5} T {0 20000} NTC 2 + ::histogram_memory::configure_server Filler_defaults } } } +proc ::histogram_memory::initialize {} { + ::histogram_memory::_initialize + + detector_active_height_mm 257.5 + detector_active_width_mm 500 + + set x_bin0 -210.5; set x_binmax 210.5 + set y_bin0 -110.5; set y_binmax 110.5 + set x_binwidth 1 + if {[expr {$x_binmax - $x_bin0}] > 0} { + set x_bin1 [expr {$x_bin0+$x_binwidth}] + } else { + set x_bin1 [expr {$x_bin0-$x_binwidth}] + } + set y_binwidth 1 + if {[expr {$y_binmax - $y_bin0}] > 0} { + set y_bin1 [expr {$y_bin0+$y_binwidth}] + } else { + set y_bin1 [expr {$y_bin0-$y_binwidth}] + } + OAT_TABLE -init X_min $x_bin0 X_max $x_binmax Y_min $y_bin0 Y_max $y_binmax + # We default to one big bin for time + set t_bin0 [OAT_TABLE -get T_min] + set t_bin1 [OAT_TABLE -get T_max] + OAT_TABLE X "$x_bin0 $x_bin1" Y "$y_bin0 $y_bin1" T "$t_bin0 $t_bin1" + ::histogram_memory::configure_server Filler_defaults + + ::nexus::data alias ::histogram_memory::vertical_axis ::histogram_memory::y_pixel_offset + ::nexus::data alias ::histogram_memory::horizontal_axis ::histogram_memory::x_pixel_offset +} diff --git a/site_ansto/instrument/rsd/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/rsd/config/hmm/hmm_configuration.tcl index 2053788f..9dd8d0c5 100644 --- a/site_ansto/instrument/rsd/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/rsd/config/hmm/hmm_configuration.tcl @@ -1,6 +1,8 @@ set sim_mode [SplitReply [hmm_simulation]] if {$sim_mode == "true"} { MakeHM hmm SIM; + hmm configure daq Stopped + hmm configure statuscheck false namespace eval histogram_memory { proc hmc {_start _preset _mode _pause} { bm mode $_mode; @@ -15,7 +17,7 @@ if {$sim_mode == "true"} { source $cfPath(hmm)/hmm_configuration_common_1.tcl if {$sim_mode == "true"} { - proc ::histogram_memory::hmm_initialize {} { + proc ::histogram_memory::initialize {} { hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080; hmm configure username spy; hmm configure password 007; @@ -76,9 +78,38 @@ proc ::histogram_memory::setmode {mode} { _hmm_hor_axis_alias dtheta _hmm_vert_axis vertical_channel_number _hmm_vert_axis_alias drowindex - OAT_TABLE X {-210.5 -209.5} Y {-110.5 -109.5} T {0 20000} NTC 5 - ::histogram_memory::configure_server Filler_defaults FASTCOMTEC + ::histogram_memory::configure_server Filler_defaults } } } +proc ::histogram_memory::initialize {} { + ::histogram_memory::_initialize + + detector_active_height_mm 500 + detector_active_width_mm 500 + + set x_bin0 -210.5; set x_binmax 210.5 + set y_bin0 -210.5; set y_binmax 210.5 + set x_binwidth 1 + if {[expr {$x_binmax - $x_bin0}] > 0} { + set x_bin1 [expr {$x_bin0+$x_binwidth}] + } else { + set x_bin1 [expr {$x_bin0-$x_binwidth}] + } + set y_binwidth 1 + if {[expr {$y_binmax - $y_bin0}] > 0} { + set y_bin1 [expr {$y_bin0+$y_binwidth}] + } else { + set y_bin1 [expr {$y_bin0-$y_binwidth}] + } + OAT_TABLE -init X_min $x_bin0 X_max $x_binmax Y_min $y_bin0 Y_max $y_binmax + # We default to one big bin for time + set t_bin0 [OAT_TABLE -get T_min] + set t_bin1 [OAT_TABLE -get T_max] + OAT_TABLE X "$x_bin0 $x_bin1" Y "$y_bin0 $y_bin1" T "$t_bin0 $t_bin1" + ::histogram_memory::configure_server Filler_defaults + + ::nexus::data alias ::histogram_memory::vertical_axis ::histogram_memory::y_pixel_offset + ::nexus::data alias ::histogram_memory::horizontal_axis ::histogram_memory::x_pixel_offset +} diff --git a/site_ansto/instrument/sans/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/sans/config/hmm/hmm_configuration.tcl index 2053788f..6cf2e7e1 100644 --- a/site_ansto/instrument/sans/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/sans/config/hmm/hmm_configuration.tcl @@ -1,6 +1,8 @@ set sim_mode [SplitReply [hmm_simulation]] if {$sim_mode == "true"} { MakeHM hmm SIM; + hmm configure daq Stopped + hmm configure statuscheck false namespace eval histogram_memory { proc hmc {_start _preset _mode _pause} { bm mode $_mode; @@ -15,7 +17,7 @@ if {$sim_mode == "true"} { source $cfPath(hmm)/hmm_configuration_common_1.tcl if {$sim_mode == "true"} { - proc ::histogram_memory::hmm_initialize {} { + proc ::histogram_memory::initialize {} { hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080; hmm configure username spy; hmm configure password 007; @@ -76,9 +78,38 @@ proc ::histogram_memory::setmode {mode} { _hmm_hor_axis_alias dtheta _hmm_vert_axis vertical_channel_number _hmm_vert_axis_alias drowindex - OAT_TABLE X {-210.5 -209.5} Y {-110.5 -109.5} T {0 20000} NTC 5 - ::histogram_memory::configure_server Filler_defaults FASTCOMTEC + ::histogram_memory::configure_server Filler_defaults } } } +proc ::histogram_memory::initialize {} { + ::histogram_memory::_initialize + + detector_active_height_mm 500 + detector_active_width_mm 500 + + set x_bin0 -0.5; set x_binmax 500.5 + set y_bin0 -0.5; set y_binmax 500.5 + set x_binwidth 1 + if {[expr {$x_binmax - $x_bin0}] > 0} { + set x_bin1 [expr {$x_bin0+$x_binwidth}] + } else { + set x_bin1 [expr {$x_bin0-$x_binwidth}] + } + set y_binwidth 1 + if {[expr {$y_binmax - $y_bin0}] > 0} { + set y_bin1 [expr {$y_bin0+$y_binwidth}] + } else { + set y_bin1 [expr {$y_bin0-$y_binwidth}] + } + OAT_TABLE -init X_min $x_bin0 X_max $x_binmax Y_min $y_bin0 Y_max $y_binmax + # We default to one big bin for time + set t_bin0 [OAT_TABLE -get T_min] + set t_bin1 [OAT_TABLE -get T_max] + OAT_TABLE X "$x_bin0 $x_bin1" Y "$y_bin0 $y_bin1" T "$t_bin0 $t_bin1" + ::histogram_memory::configure_server Filler_defaults + + ::nexus::data alias ::histogram_memory::vertical_axis ::histogram_memory::y_pixel_offset + ::nexus::data alias ::histogram_memory::horizontal_axis ::histogram_memory::x_pixel_offset +}