Implements a protocol handler for the protek 608 multimeters which just allows us to read the display. It reports all elements of the display including the bar graph, it does not provide remote control of the multimeter. The protocol handler broadcasts a warning to all clients if the auto-off function is enabled. sct_rfamp.c This is a protocol handler for the Mirrortron 35V 7A AC Generator (ANSFR-83B). sinqhttpprot.c Copied the PSI script context http protocol handler. sct_orhvpsprot.c Ordela high voltage power supply protocol handler now catches unknown commands. sct_eurotherm_2000.tcl Eurotherm controller for the kowari load frame by Douglas Clowes. sct_lakeshore_3xx.tcl Latest update from Arndt. The two control loops are now independent, settletime and tolerance now work properly. common_instrument_dictionary.tcl Make instrument/status saveable. sct_orhvps_common.tcl Provides voltage ramping and implements the dhv1 command for the Ordela HVPS via the sct_orhpsprot.c protocol handler. hmm_configuration_common_1.tcl Adds new "histmem clockscale" subcommand to get and set the clock scale from the fat_clock_scale FAT parameter. You can now upload the FAT FRAME_BUFFER and FRAME_DUTYCYCLE parameters to the histogram memory. The veto commands are now "histmem veto on" and "histmem veto off". hmm_object.tcl The axis order for the histmem object has been restore to t,y,x sct_positmotor_common.tcl Code has been simplified. nxscripts_common_1.tcl Removed obsolete ::nexus::data function. TOF axis now correctly report time_of_flight instead of "time". plc_common_1.tcl Make PLC info saveable. scan_common_1.tcl SICS-385 The scan command should check the final scan variable value against he soft upper and lower limits, not against the hard limits. Make sure that the scan variable axis is saved. platypus, kowari, quokka hmm_configuration.tcl Use the HOR and VER entries in the new histmem_axes hash to select the horizontal and vertical axes for the histmem. kowari motor_configuration.tcl secondary_slit_configuration.tcl Flatten slits motor structure to match old layout in data files. quokka commands.tcl SICS-380 EApPosYmm -> EApPosY quokka detector.tcl Use new script context controller for Ordela HVPS quokka hmm_configuration.tcl Set detector height to 5.08*192 the same as the width quokka motor_configuration.tcl Code cleanup quokka positmotor_configuration.tcl Use new positmotor code. quokka aperture_configuration.tcl Added attenuation factor column to AttRotLookupTable quokka parameters.tcl SICS-380 Refactor nexus, remove redundant parameters. site_ansto.c Added the following protocols, Httpl, Protek608, aand RFAmp. scriptcontext.c SICS-386 SctActionHandler: set "send" string to NULL when a chain of scripts completes with state=idle. It turns out that if none of the scripts in the "read chain" call [sct send] each time the chain is executed, then SICS will hammer the device with calls to AsconWrite(). This can be avoided if SctActionHandler sets the 'send' string to NULL before "goto finish" in the idle state. This will be safer and still let you have chains with multiple [sct send] and read scripts. asyncprotocol.c Fix platypus memory leak. devser.c SICS-387 Started adding code to pass signals on to script context drivers. ascon.c AsconTask(): Make sure we return to the AsconIdle state when sending a command which expect no response, also only reconnect if there is a Timeout when there has been an error. r2888 | ffr | 2010-04-19 14:04:41 +1000 (Mon, 19 Apr 2010) | 90 lines
570 lines
20 KiB
Tcl
570 lines
20 KiB
Tcl
namespace eval histogram_memory {
|
|
variable HMOBJ
|
|
|
|
set HMOBJ hmm
|
|
|
|
}
|
|
proc ::histogram_memory::initialise_dictionary {} {
|
|
variable HMOBJ
|
|
if [catch {
|
|
$HMOBJ configure init 0
|
|
$HMOBJ configure statuscheck true
|
|
$HMOBJ init
|
|
$HMOBJ stop
|
|
$HMOBJ configure statuscheck false
|
|
$HMOBJ init
|
|
# ::histogram_memory::hmm_set_read_type HISTOPERIOD_XY
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
}
|
|
publish ::histogram_memory::initialise_dictionary user
|
|
|
|
proc ::histogram_memory::select_read_type {type} {
|
|
variable HMOBJ
|
|
# Instrument specific X and Y dimension names
|
|
variable INST_NXC
|
|
variable INST_NYC
|
|
|
|
if [catch {
|
|
$HMOBJ configure read_data_period_number 0
|
|
|
|
switch [string toupper $type] {
|
|
"HISTOGRAM_XYT" - "HISTOPERIOD_XYT" {
|
|
$HMOBJ configure rank 3
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
$HMOBJ configure dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
$HMOBJ configure dim2 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
$HMOBJ configure READ_DATA_TYPE "HISTOPERIOD_XYT"
|
|
set hmm_ext ""
|
|
}
|
|
"HISTOGRAM_XY" - "HISTOPERIOD_XY" {
|
|
$HMOBJ configure rank 2
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
$HMOBJ configure dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
$HMOBJ configure READ_DATA_TYPE "HISTOPERIOD_XY"
|
|
set hmm_ext "_xy"
|
|
}
|
|
"HISTOGRAM_XT" - "HISTOPERIOD_XT" {
|
|
$HMOBJ configure rank 2
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
$HMOBJ configure dim1 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
$HMOBJ configure READ_DATA_TYPE "HISTOPERIOD_XT"
|
|
set hmm_ext "_xt"
|
|
}
|
|
"HISTOGRAM_YT" - "HISTOPERIOD_YT" {
|
|
$HMOBJ configure rank 2
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
$HMOBJ configure dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
$HMOBJ configure READ_DATA_TYPE "HISTOPERIOD_YT"
|
|
set hmm_ext "_ty"
|
|
}
|
|
"HISTOGRAM_X" - "HISTOPERIOD_X" {
|
|
$HMOBJ configure rank 1
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
$HMOBJ configure READ_DATA_TYPE "HISTOPERIOD_X"
|
|
set hmm_ext "_x"
|
|
}
|
|
"HISTOGRAM_Y" - "HISTOPERIOD_Y" {
|
|
$HMOBJ configure rank 1
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
$HMOBJ configure READ_DATA_TYPE "HISTOPERIOD_Y"
|
|
set hmm_ext "_y"
|
|
}
|
|
"HISTOGRAM_T" - "HISTOPERIOD_T" {
|
|
$HMOBJ configure rank 1
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
$HMOBJ configure READ_DATA_TYPE "HISTOPERIOD_T"
|
|
set hmm_ext "_t"
|
|
}
|
|
"TOTAL_HISTOGRAM_XY" {
|
|
$HMOBJ configure rank 2
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
$HMOBJ configure dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_xy"
|
|
}
|
|
"TOTAL_HISTOGRAM_XT" {
|
|
$HMOBJ configure rank 2
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
$HMOBJ configure dim1 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_xt"
|
|
}
|
|
"TOTAL_HISTOGRAM_YT" {
|
|
$HMOBJ configure rank 2
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
$HMOBJ configure dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_ty"
|
|
}
|
|
"TOTAL_HISTOGRAM_XP" {
|
|
$HMOBJ configure rank 2
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
$HMOBJ configure dim1 [expr 1 + [SplitReply [$HMOBJ configure maximum_period]]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_xp"
|
|
}
|
|
"TOTAL_HISTOGRAM_YP" {
|
|
$HMOBJ configure rank 2
|
|
$HMOBJ configure dim0 [expr 1 + [SplitReply [$HMOBJ configure maximum_period]]]
|
|
$HMOBJ configure dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_py"
|
|
}
|
|
"TOTAL_HISTOGRAM_X" {
|
|
$HMOBJ configure rank 1
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_x"
|
|
}
|
|
"TOTAL_HISTOGRAM_Y" {
|
|
$HMOBJ configure rank 1
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_y"
|
|
}
|
|
"TOTAL_HISTOGRAM_T" {
|
|
$HMOBJ configure rank 1
|
|
$HMOBJ configure dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_t"
|
|
}
|
|
"TOTAL_HISTOGRAM_P" {
|
|
$HMOBJ configure rank 1
|
|
$HMOBJ configure dim0 [expr 1 + [SplitReply [$HMOBJ configure maximum_period]]]
|
|
$HMOBJ configure READ_DATA_TYPE $type
|
|
set hmm_ext "_total_p"
|
|
}
|
|
default {
|
|
error "ERROR: [info level 0], unknown data type $type"
|
|
}
|
|
}
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
return $hmm_ext
|
|
}
|
|
publish ::histogram_memory::select_read_type user
|
|
|
|
##
|
|
# @brief Instrument specific configurations can redefine this
|
|
# to select extra read data types or override one of the
|
|
# common data types for the histogram memory.
|
|
proc ::histogram_memory::is_select_read_type {type} {
|
|
variable HMOBJ
|
|
# Instrument specific X and Y dimension names
|
|
variable INST_NXC
|
|
variable INST_NYC
|
|
|
|
return "notfound"
|
|
}
|
|
publish ::histogram_memory::is_select_read_type user
|
|
|
|
##
|
|
# @brief Set the read data type, if there is no instrument
|
|
# specific type then set a common type.
|
|
proc ::histogram_memory::hmm_set_read_type {type} {
|
|
variable HMOBJ
|
|
|
|
if [ catch {
|
|
set hmm_ext [is_select_read_type $type]
|
|
if {$hmm_ext == "notfound"} {
|
|
set hmm_ext [select_read_type $type]
|
|
}
|
|
$HMOBJ configure hmm_ext $hmm_ext
|
|
$HMOBJ init
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
}
|
|
|
|
##
|
|
# @brief Generate the "axes" string for NeXus plotable data and
|
|
# link the axes to the data group
|
|
proc ::histogram_memory::gen_axes {alist} {
|
|
variable histmem_axes
|
|
if [ catch {
|
|
foreach axis_ID $alist {
|
|
hsetprop $histmem_axes($axis_ID) link data_set
|
|
set axis_name [lindex [split $histmem_axes($axis_ID) "/" ] end]
|
|
lappend axes_list $axis_name
|
|
}
|
|
set axes [join $axes_list ":"]
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
return $axes
|
|
}
|
|
##
|
|
# @brief Defines axes for each histmem data type
|
|
# @return {rank $rank dimstr $dimstr axis_list $axis_list hmmdatname $hmmdatname}
|
|
proc ::histogram_memory::set_axes {typelist} {
|
|
variable histmem_axes
|
|
variable HMOBJ
|
|
variable HP_HMM
|
|
# Instrument specific X and Y dimension names
|
|
variable INST_NXC
|
|
variable INST_NYC
|
|
|
|
if [catch {
|
|
set signal 1
|
|
foreach type $typelist {
|
|
switch [string toupper $type] {
|
|
"HISTOGRAM_XYT" - "HISTOPERIOD_XYT" {
|
|
lappend rank 3
|
|
set dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
set dim2 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0,$dim1,$dim2"
|
|
lappend hmmslabstart [list 0 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1 $dim2]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1 * $dim2]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR TOF VER HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname $HMOBJ
|
|
}
|
|
"HISTOGRAM_XY" - "HISTOPERIOD_XY" {
|
|
lappend rank 2
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR VER HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_xy"
|
|
}
|
|
"HISTOGRAM_XT" - "HISTOPERIOD_XT" {
|
|
lappend rank 2
|
|
set dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR TOF HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_xt"
|
|
}
|
|
"HISTOGRAM_YT" - "HISTOPERIOD_YT" {
|
|
lappend rank 2
|
|
set dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR TOF VER}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_ty"
|
|
}
|
|
"HISTOGRAM_X" - "HISTOPERIOD_X" {
|
|
lappend rank 1
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0"
|
|
lappend hmmslabstart [list 0]
|
|
lappend hmmslabend [list $dim0]
|
|
lappend hmmperiodsize $dim0
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_x"
|
|
}
|
|
"HISTOGRAM_Y" - "HISTOPERIOD_Y" {
|
|
lappend rank 1
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
lappend dimstr "$dim0"
|
|
lappend hmmslabstart [list 0]
|
|
lappend hmmslabend [list $dim0]
|
|
lappend hmmperiodsize $dim0
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR VER}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_y"
|
|
}
|
|
"HISTOGRAM_T" - "HISTOPERIOD_T" {
|
|
lappend rank 1
|
|
set dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
lappend dimstr "$dim0"
|
|
lappend hmmslabstart [list 0]
|
|
lappend hmmslabend [list $dim0]
|
|
lappend hmmperiodsize $dim0
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR TOF}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_t"
|
|
}
|
|
"TOTAL_HISTOGRAM_XY" {
|
|
lappend rank 2
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR VER HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_xy"
|
|
}
|
|
"TOTAL_HISTOGRAM_XY_CORRECTED" {
|
|
lappend rank 2
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR VER HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_xy_corrected"
|
|
}
|
|
"TOTAL_HISTOGRAM_XT" {
|
|
lappend rank 2
|
|
set dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR TOF HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_xt"
|
|
}
|
|
"TOTAL_HISTOGRAM_YT" {
|
|
lappend rank 2
|
|
set dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR TOF VER}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_ty"
|
|
}
|
|
"TOTAL_HISTOGRAM_XP" {
|
|
lappend rank 2
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
set dim1 [expr 1 + [SplitReply [$HMOBJ configure maximum_period]]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR HOR PER}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_xp"
|
|
}
|
|
"TOTAL_HISTOGRAM_YP" {
|
|
lappend rank 2
|
|
set dim0 [expr 1 + [SplitReply [$HMOBJ configure maximum_period]]]
|
|
set dim1 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
lappend dimstr "$dim0,$dim1"
|
|
lappend hmmslabstart [list 0 0]
|
|
lappend hmmslabend [list $dim0 $dim1]
|
|
lappend hmmperiodsize [expr $dim0 * $dim1]
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR PER VER}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_py"
|
|
}
|
|
"TOTAL_HISTOGRAM_X" {
|
|
lappend rank 1
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0"
|
|
lappend hmmslabstart [list 0]
|
|
lappend hmmslabend [list $dim0]
|
|
lappend hmmperiodsize $dim0
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_x"
|
|
}
|
|
"TOTAL_HISTOGRAM_X_CORRECTED" {
|
|
lappend rank 1
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NXC]]
|
|
lappend dimstr "$dim0"
|
|
lappend hmmslabstart [list 0]
|
|
lappend hmmslabend [list $dim0]
|
|
lappend hmmperiodsize $dim0
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR HOR}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_x_corrected"
|
|
}
|
|
"TOTAL_HISTOGRAM_Y" {
|
|
lappend rank 1
|
|
set dim0 [SplitReply [$HMOBJ configure $INST_NYC]]
|
|
lappend dimstr "$dim0"
|
|
lappend hmmslabstart [list 0]
|
|
lappend hmmslabend [list $dim0]
|
|
lappend hmmperiodsize $dim0
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR VER}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_y"
|
|
}
|
|
"TOTAL_HISTOGRAM_T" {
|
|
lappend rank 1
|
|
set dim0 [SplitReply [$HMOBJ configure oat_ntc_eff]]
|
|
lappend dimstr "$dim0"
|
|
lappend hmmslabstart [list 0]
|
|
lappend hmmslabend [list $dim0]
|
|
lappend hmmperiodsize $dim0
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR TOF}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_t"
|
|
}
|
|
"TOTAL_HISTOGRAM_P" {
|
|
lappend rank 1
|
|
set dim0 [expr 1 + [SplitReply [$HMOBJ configure maximum_period]]]
|
|
lappend dimstr "$dim0"
|
|
lappend hmmslabstart [list 0]
|
|
lappend hmmslabend [list $dim0]
|
|
lappend hmmperiodsize $dim0
|
|
lappend axeslist [::histogram_memory::gen_axes {SVAR PER}]
|
|
lappend siglist $signal
|
|
lappend hmmdatname "${HMOBJ}_total_p"
|
|
}
|
|
default {
|
|
error "ERROR: [info level 0], unknown data type $type"
|
|
}
|
|
}
|
|
incr signal
|
|
}
|
|
hsetprop $HP_HMM hmmrank $rank
|
|
hsetprop $HP_HMM hmmdimstr $dimstr
|
|
hsetprop $HP_HMM hmmslabstart $hmmslabstart
|
|
hsetprop $HP_HMM hmmslabend $hmmslabend
|
|
hsetprop $HP_HMM hmmperiodsize $hmmperiodsize
|
|
hsetprop $HP_HMM hmmdatname $hmmdatname
|
|
hsetprop $HP_HMM @axes $axeslist
|
|
hsetprop $HP_HMM @signal $siglist
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
return ok
|
|
}
|
|
|
|
publish ::histogram_memory::hmm_set_read_type user
|
|
|
|
proc ::histogram_memory::gethmm {type} {
|
|
variable HMOBJ
|
|
if [catch {
|
|
# set currType [SplitReply [$HMOBJ configure READ_DATA_TYPE]]
|
|
::histogram_memory::hmm_set_read_type $type
|
|
set hmdata [hmm get 1]
|
|
# ::histogram_memory::hmm_set_read_type $currType
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
return $hmdata
|
|
}
|
|
publish ::histogram_memory::gethmm user
|
|
|
|
|
|
proc ::histogram_memory::hmm_xy {cmd hmdirect} {
|
|
if [catch {
|
|
if {$cmd == "get" && $hmdirect == 1} {
|
|
return [gethmm HISTOPERIOD_XY]
|
|
}
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
}
|
|
publish ::histogram_memory::hmm_xy user
|
|
|
|
proc ::histogram_memory::hdb_hmget {hpath} {
|
|
if [ catch {
|
|
# set hpath [SplitReply [sicslist ::histogram_memory::hdb_hmget hdb_path]]
|
|
::histogram_memory::hmm_set_read_type [hgetpropval $hpath read_data_type]
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
hmm get 1
|
|
}
|
|
|
|
namespace eval ::nexus::histmem {
|
|
variable HMOBJ
|
|
set HMOBJ hmm
|
|
|
|
proc hmm_set_sdsinfo {} {
|
|
variable HMOBJ
|
|
|
|
if [catch {
|
|
set dim0 [SplitReply [$HMOBJ configure dim0]]
|
|
set dim1 [SplitReply [$HMOBJ configure dim1]]
|
|
set dim2 [SplitReply [$HMOBJ configure dim2]]
|
|
set rank [expr 1 + [SplitReply [$HMOBJ configure rank]]]
|
|
switch $rank {
|
|
2 {
|
|
set dimstr "-1,$dim0"
|
|
set hmslabstart [list 0]
|
|
set hmslabend [list $dim0]
|
|
set hmperiodsize $dim0
|
|
|
|
}
|
|
3 {
|
|
set dimstr "-1,$dim0,$dim1"
|
|
set hmslabstart [list 0 0]
|
|
set hmslabend [list $dim0 $dim1]
|
|
set hmperiodsize [expr $dim0 * $dim1]
|
|
}
|
|
4 {
|
|
set dimstr "-1,$dim0,$dim1,$dim2"
|
|
set hmslabstart [list 0 0 0]
|
|
set hmslabend [list $dim0 $dim1 $dim2]
|
|
set hmperiodsize [expr $dim0 * $dim1 * $dim2]
|
|
}
|
|
default {
|
|
error "ERROR: [info level 0] invalid rank $rank. Must be 2, 3, or 4"
|
|
}
|
|
}
|
|
$HMOBJ configure hmslabstart $hmslabstart
|
|
$HMOBJ configure hmslabend $hmslabend
|
|
$HMOBJ configure hmperiodsize $hmperiodsize
|
|
|
|
set hmm_ext [SplitReply [$HMOBJ configure hmm_ext]]
|
|
broadcast nxscript updatedictvar padimstr $dimstr
|
|
nxscript updatedictvar padimstr $dimstr
|
|
broadcast nxscript updatedictvar parank $rank
|
|
nxscript updatedictvar parank $rank
|
|
broadcast nxscript updatedictvar pahmm_ext $hmm_ext
|
|
nxscript updatedictvar pahmm_ext $hmm_ext
|
|
} msg ] {
|
|
return -code error "([info level 0]) $msg"
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
publish ::nexus::histmem::nxopen user
|
|
publish ::nexus::histmem::hmm_set_sdsinfo user
|
|
publish ::nexus::histmem::savehmm user
|
|
publish ::histogram_memory::hdb_hmget user
|
|
|
|
namespace eval histogram_memory {
|
|
set HMSCOBJ hmscobj
|
|
set HP_HMM /sics/$HMSCOBJ/hmm
|
|
MakeSICSObj hmscobj SCT_OBJECT
|
|
hfactory $HP_HMM script "::histogram_memory::hdb_hmget $HP_HMM" hdbReadOnly intvarar 10
|
|
hsetprop $HP_HMM read_data_type HISTOPERIOD_XY
|
|
hsetprop $HP_HMM savecmd ::nexus::histmem::save
|
|
hsetprop $HP_HMM sdsinfo ::nexus::histmem::sdsinfo
|
|
hsetprop $HP_HMM datatype_savelist HISTOPERIOD_XY
|
|
hsetprop $HP_HMM save_periods single_period
|
|
hsetprop $HP_HMM privilege user
|
|
hsetprop $HP_HMM nxsave false
|
|
hsetprop $HP_HMM mutable true
|
|
hsetprop $HP_HMM control false
|
|
hsetprop $HP_HMM data true
|
|
hsetprop $HP_HMM klass parameter
|
|
hsetprop $HP_HMM nxalias hmscobj_hmm
|
|
hsetprop $HP_HMM sicsdev none
|
|
#hsetprop /sics/hmscobj/data
|
|
#sicspoll add /sics/hmscobj/data hdb
|
|
|
|
sicslist setatt $HMSCOBJ kind scobj
|
|
sicslist setatt $HMSCOBJ klass NXdetector
|
|
sicslist setatt $HMSCOBJ long_name detector
|
|
sicslist setatt $HMSCOBJ privilege user
|
|
}
|
|
|
|
|
|
|