Pull back changes from Dingo
This commit is contained in:
@@ -1,8 +1,152 @@
|
||||
source $cfPath(scan)/scan_common_1.tcl
|
||||
proc ::scan::pre_hmm_scan_prepare {} {}
|
||||
|
||||
proc ::scan::cm_count {sobj uobj point mode preset} {
|
||||
# send "clear meta" command to the camera server
|
||||
clientput "sending clear meta"
|
||||
set cmd "clear meta\r\n"
|
||||
cm1 send $cmd
|
||||
# send motor position
|
||||
foreach m "[sicslist type motor]" {
|
||||
if {$m == "motor" || $m == "dummy_motor"} {
|
||||
# skipit
|
||||
} else {
|
||||
set cmd "set camera, "
|
||||
append cmd "[$m]"
|
||||
append cmd "\r\n"
|
||||
cm1 send $cmd
|
||||
}
|
||||
}
|
||||
cm1 count $preset
|
||||
}
|
||||
|
||||
proc ::scan::cm_scan_prepare {sobj uobj} {
|
||||
|
||||
variable save_filetype
|
||||
variable check_instrument_ready
|
||||
variable force_scan
|
||||
|
||||
# [::plc::inst_ready]
|
||||
if {$force_scan || $check_instrument_ready} {
|
||||
set force_scan false
|
||||
if [catch {
|
||||
::scan::check_scanvar $sobj $uobj
|
||||
::scan::pre_hmm_scan_prepare
|
||||
}] {
|
||||
return -code error "ISCAN ABORTED: $::errorInfo"
|
||||
}
|
||||
|
||||
# send "shutter auto" command over
|
||||
shutter auto
|
||||
# send "focusflight off" command over
|
||||
focuslight off
|
||||
# send "clear meta" command to the camera server
|
||||
clientput "sending clear meta"
|
||||
set cmd "clear meta\r\n"
|
||||
cm1 send $cmd
|
||||
# send motor position
|
||||
foreach m "[sicslist type motor]" {
|
||||
if {$m == "motor" || $m == "dummy_motor"} {
|
||||
# skipit
|
||||
} else {
|
||||
set cmd "set camera, "
|
||||
append cmd "[$m]"
|
||||
append cmd "\r\n"
|
||||
cm1 send $cmd
|
||||
}
|
||||
}
|
||||
|
||||
if [catch {
|
||||
#TODO Parameterise varindex in some way
|
||||
set varindex 0;
|
||||
|
||||
set numpoints [SplitReply [$sobj np]]
|
||||
set vlist [split [$sobj getvarpar $varindex] = ]
|
||||
set scanstart [lindex $vlist 1]
|
||||
set scanstep [lindex $vlist 2]
|
||||
#::scan::camscan_cmd -set NP $numpoints
|
||||
#::scan::camscan_cmd -set scan_variable [string trim [lindex [split [lindex $vlist 0] . ] 1]];
|
||||
#::scan::camscan_cmd -set scan_start $scanstart
|
||||
#::scan::camscan_cmd -set scan_increment $scanstep
|
||||
set scanvar_pts [SplitReply [$sobj getvardata $varindex]]
|
||||
|
||||
#::scan::camscan_cmd -set feedback status BUSY
|
||||
clientput "run_mode camscan"
|
||||
run_mode "camscan"
|
||||
|
||||
#::nexus::newfile BEAM_MONITOR $save_filetype
|
||||
stdscan prepare $sobj $uobj;
|
||||
clientput "Scan start: $scanstart, Scan step: $scanstep, Number of points: $numpoints"
|
||||
}] {
|
||||
run_mode "normal"
|
||||
return -code error $::errorInfo
|
||||
}
|
||||
} else {
|
||||
return -code error "ISCAN ABORTED: Instrument not ready"
|
||||
}
|
||||
}
|
||||
|
||||
proc ::scan::cm_scan_collect {sobj uobj point} {
|
||||
set vlist [split [$sobj getvarpar 0] = ];
|
||||
|
||||
set w(NP) $point
|
||||
set sv [string trim [lindex [split [lindex $vlist 0] . ] 1]]
|
||||
set header [format "%-4.4s %-9.9s %-14s %-7.7s" NP $sv Counts Time]
|
||||
set varval [SplitReply [$sv]]
|
||||
set counts [SplitReply [::histogram_memory::total_counts]]
|
||||
set time [SplitReply [::histogram_memory::time]]
|
||||
set data [format "%-4d %-9.3f %-14d %-7.2f" $point $varval $counts $time]
|
||||
clientput $header
|
||||
clientput $data
|
||||
for {set bmn 1} {$bmn <= $::counter::isc_numchannels} {incr bmn} {
|
||||
set bmon bm$bmn
|
||||
clientput "Monitor $bmn [SplitReply [$bmon getcounts]]"
|
||||
}
|
||||
}
|
||||
|
||||
publish ::scan::cm_count user
|
||||
publish ::scan::cm_scan_prepare user
|
||||
publish ::scan::cm_scan_collect user
|
||||
|
||||
proc ::scan::isc_initialize {} {
|
||||
::scan::ic_initialize
|
||||
#::scan::ic_initialize
|
||||
|
||||
if [ catch {
|
||||
variable ic_runscanpar
|
||||
variable ic_hmm_datatype
|
||||
|
||||
set ic_hmm_datatype HISTOGRAM_XYT
|
||||
|
||||
MakeScanCommand camscan cm1 $::cfPath(scan)/scan_common_1.hdd recover.bin
|
||||
|
||||
camscan configure script
|
||||
#camscan function writeheader ::scan::donothing
|
||||
#camscan function writepoint ::scan:cm_writepoint
|
||||
camscan function count ::scan::cm_count
|
||||
#camscan function collect ::scan::cm_scan_collect
|
||||
camscan function prepare ::scan::cm_scan_prepare
|
||||
#camscan function finish ::scan::cm_scan_finish
|
||||
|
||||
# TODO Use ic_runscanpar to create the ::scan::runscan command and
|
||||
# to validate the "runscan" proc parameters.
|
||||
array set ic_runscanpar [subst {
|
||||
scanvar text=drivable
|
||||
start float
|
||||
stop float
|
||||
numpoints int=0,inf
|
||||
mode text=[join [concat [list time unlimited period count frame] $::counter::isc_beam_monitor_list ] , ]
|
||||
preset float=0,inf
|
||||
datatype text=[join [array names ::nexus::histmem_filetype_spec] , ]
|
||||
savetype text=save,nosave
|
||||
force boolean
|
||||
}]
|
||||
#scriptcallback connect hmscan SCANEND ::scan::hmscanend_event
|
||||
#scriptcallback connect bmonscan SCANEND ::scan::bmonscanend_event
|
||||
scriptcallback connect camscan SCANEND ::scan::cmscanend_event
|
||||
} message ] {
|
||||
if {$::errorCode=="NONE"} {return $message}
|
||||
return -code error $message
|
||||
}
|
||||
|
||||
foreach {n v} {
|
||||
clock 1
|
||||
|
||||
Reference in New Issue
Block a user