Initial bilby configuration.

This commit is contained in:
Ferdi Franceschini
2014-01-15 15:25:55 +11:00
parent b1f09c3dd3
commit e984619d77
24 changed files with 743 additions and 15 deletions

View File

@@ -0,0 +1,31 @@
config/source/source_common.tcl
config/anticollider/anticollider_common.tcl
config/plc/plc_common_1.tcl
config/counter/counter_common_1.tcl
config/hipadaba/hipadaba_configuration_common.tcl
config/hipadaba/common_instrument_dictionary.tcl
config/hipadaba/instdict_specification.tcl
config/hmm/hmm_configuration_common_1.tcl
config/hmm/hmm_object.tcl
config/hmm/anstohm_linked.xml
config/hmm/sct_orhvps_common.tcl
config/scan/scan_common_1.hdd
config/scan/scan_common_1.tcl
config/nexus/nxscripts_common_1.tcl
config/commands/commands_common.tcl
config/commands/pulser.tcl
config/commands/hvcommands.tcl
config/motors/sct_positmotor_common.tcl
config/environment/sct_protek_common.tcl
config/environment/temperature/sct_julabo_lh45.tcl
config/environment/temperature/sct_lakeshore_340.tcl
config/environment/temperature/sct_lakeshore_336.tcl
config/environment/temperature/sct_qlink.tcl
config/environment/temperature/sct_watlow_st4.tcl
config/environment/temperature/sct_rvasm2.tcl
config/environment/temperature/sct_oxford_itc.tcl
config/environment/magneticField/sct_bruker_BEC1.tcl
config/environment/magneticField/sct_oxford_ips.tcl
config/environment/magneticField/sct_oxford_labview.tcl
config/motors/sct_jogmotor_common.tcl

View File

@@ -0,0 +1,14 @@
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
source $cfPath(anticollider)/anticollider_common.tcl
# NOTE: This is called with a list of motorname target pairs
proc ::anticollider::enable {args} {
if {[SplitReply [::anticollider::protect_detector]] == "false"} {
return "false"
} else {
return "true"
}
}
::anticollider::loadscript acscript.txt

View File

@@ -0,0 +1,216 @@
source $cfPath(commands)/commands_common.tcl
namespace eval motor {
# is_homing_list = comma separated list of motors which are safe to send "home"
variable is_homing_list ""
}
#namespace eval sample {
# command select {int=0:8 sampid} {
# SampleNum $sampid
# }
#}
##
# @brief Beamstop select command
# @param bs beamstop, 1,2,3,4,5 or 6
# @param bx beam position in detector coordinates
# @param bz beam position in detector coordinates
# Given
# (Xbf,Zbf) = beam pos in frame coords
# (Xbd,Zbd) = beam pos in detector coords
# (Xbbs, Zbbs) = beam pos in beamstop coords
# (Xdf,Zdf) = detector pos in frame coords
# (Xbsf,Zbsf) = beamstop pos in frame coords
#
# (Xbf,Zbf) = (Xdf+Xbd, Zdf+Zbd) = (Xbsf+Xbbs, Zbsf+Zbbs)
# Origin of detector coords = frame origin
#
# Detector and beamstop motor readings with beamstop disk centers
# overlapping over detector center mark.
# Xdf = 264.542 (7283813) Zdf = 0
# Xbbs = 296.291 (8054270)
# Zbbs = 259.641 (13488244)
# Xbd = dethw, Zbd = (dethh)
#
# 264.542+dethw = Xbsf+296.291
# 0+dethh = Zbsf+259.641
#
# Xbsf = -31.749 + dethw, Zbsf = -259.641 + dethh
proc selbs {bs {bx "UNDEF"} {bz "UNDEF"}} {
set bsdriving false
set dethw [expr {[SplitReply [detector_active_height_mm]]/2.0}]
set dethh [expr {[SplitReply [detector_active_width_mm]]/2.0}]
set Xbsf [expr -31.749 + $dethw]
set Zbsf [expr -259.641 + $dethh]
array set bsl [subst {
1 [SplitReply [bs1 softlowerlim]]
2 [SplitReply [bs2 softlowerlim]]
3 [SplitReply [bs3 softlowerlim]]
4 [SplitReply [bs4 softlowerlim]]
5 [SplitReply [bs5 softlowerlim]]
6 [SplitReply [bs6 softlowerlim]]
}]
if [ catch {
switch $bs {
"1" {
set bsmot "bs1"
set bs_target 93.20
set bs_diameter 110
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
}
"2" {
set bsmot "bs2"
set bs_target 86.84
set bs_diameter 88
set bsdownCmd "drive bs1 $bsl(1) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
}
"3" {
set bsmot "bs3"
set bs_target 93.35
set bs_diameter 66
set bsdownCmd "drive bs2 $bsl(2) bs1 $bsl(1) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
}
"4" {
set bsmot "bs4"
set bs_target 86.85
set bs_diameter 44
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs1 $bsl(1) bs5 $bsl(5) bs6 $bsl(6)"
}
"5" {
set bsmot "bs5"
set bs_target 93.27
set bs_diameter 22
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs1 $bsl(1) bs6 $bsl(6)"
}
"6" {
set bsmot "bs6"
set bs_target 86.98
set bs_diameter 11
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs1 $bsl(1)"
}
default {
error "beamstop selection must be an integer from 1 to 6"
}
}
set detoff_val [SplitReply [detoff]]
if {$bx == "UNDEF" || $bz == "UNDEF"} {
statemon start selbs
if {[info level] > 1} {statemon start [lindex [info level -1] 0]}
set bsdriving true
BeamStop -1
BSdiam -1
drive $bsmot $bs_target
eval $bsdownCmd
BeamStop $bs
BSdiam $bs_diameter
set bsdriving false
statemon stop selbs
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
} else {
if { [string is double $bx] == false } {
if { [string is double $bz] == false } {
error "beam coordinates must be floats"
}
}
set bsx_target [expr {$bx-$Xbsf+$detoff_val}]
set bsz_target [expr {$bz-$Zbsf}]
statemon start selbs
if {[info level] > 1} {statemon start [lindex [info level -1] 0]}
set bsdriving true
BeamStop -1
BSdiam -1
drive $bsmot $bs_target bsx $bsx_target bsz $bsz_target
eval $bsdownCmd
BeamStop $bs
BSdiam $bs_diameter
set bsdriving false
statemon stop selbs
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
}
} msg ] {
if {$bsdriving} {
statemon stop selbs
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
}
return -code error $msg
}
}
publish selbs user
namespace eval beamstops {
command selbsn {int=1,2,3,4,5,6 bs} {
selbs $bs "UNDEF" "UNDEF"
}
command selbsxz {int=1,2,3,4,5,6 bs float bx float bz} {
selbs $bs $bx $bz
}
}
namespace eval optics {
VarMake ::optics::select::section text user
VarMake ::optics::polarizer::in text user
VarMake ::optics::lens::selection text user
command rotary_attenuator {int=0,15,45,90,180 angle} {
drive att $angle
}
command entrance_aperture {
int=0,45,90,135,180,270 angle
} {
drive srce $angle
}
# TODO Do we need this
# command sample_aperture {
# int=25,50 size
# text=circ,squ,open,rect shape
# } {
# SApXmm $size
# SApZmm $size
# SApShape $shape
# }
##############################
##
# @brief The "guide" command uses a lookup table to setup the collimation system
# @param row, selects a row from the guide configuration table
#
# eg\n
# guide ga
command guide "
text=[join [array names ::optics::guide_configuration] , ] configuration
" {
variable guide_configuration
variable guide_configuration_columns
if [ catch {
foreach {compselection position} $guide_configuration($configuration) {
foreach el $compselection guide $guide_configuration_columns {
lappend to_config $guide
lappend to_config [set ::optics::${guide}_map($el)]
}
::optics::guide -set feedback status BUSY
set msg [eval "drive $to_config"]
EApPosY $position
}
GuideConfig $configuration
} message ] {
::optics::guide -set feedback status IDLE
if {$::errorCode=="NONE"} {return $message}
return -code error $message
}
::optics::guide -set feedback status IDLE
}
::optics::guide -addfb text status
::optics::guide -set feedback status IDLE
}
proc ::commands::isc_initialize {} {
::commands::ic_initialize
}

View File

@@ -0,0 +1,32 @@
source $cfPath(counter)/counter_common_1.tcl
## TODO Put all the counter macros in the counter namespace
namespace eval counter {
variable isc_numchannels
variable isc_monitor_address
variable isc_portlist
variable isc_beam_monitor_list
proc set_sobj_attributes {} {
}
}
proc ::counter::isc_initialize {} {
if [catch {
variable isc_numchannels
variable isc_monitor_address
variable isc_portlist
dict for {k v} $::MONITOR_HOSTPORT {
lappend monlist $k
lappend hostlist [dict get $v HOST]
lappend isc_portlist [dict get $v PORT]
}
variable isc_beam_monitor_list $monlist
set isc_monitor_address [lindex $hostlist 0]
set isc_numchannels [llength $isc_beam_monitor_list]
::counter::ic_initialize
} message ] {
if {$::errorCode=="NONE"} {return $message}
return -code error "$message"
}
}

View File

@@ -0,0 +1 @@
source $cfPath(hipadaba)/hipadaba_configuration_common.tcl

View File

@@ -0,0 +1,70 @@
fileeval $cfPath(hmm)/hmm_configuration_common_1.tcl
set sim_mode [SplitReply [hmm_simulation]]
proc ::histogram_memory::init_OAT_TABLE {} {
if [ catch {
# We don't need a MAX_CHAN parameter for time because the time channel
# is scaled by calling the ::histogram_memory::clock_scale function
OAT_TABLE X -setdata MAX_CHAN 192
OAT_TABLE Y -setdata MAX_CHAN 192
OAT_TABLE X -setdata BMIN -0.5
OAT_TABLE X -setdata BMAX 191.5
OAT_TABLE Y -setdata BMIN -0.5
OAT_TABLE Y -setdata BMAX 191.5
set clock_scale 1000
set freq 50
hmm configure fat_clock_scale $clock_scale
hmm configure fat_frame_frequency $freq
hmm configure fat_frame_source INTERNAL
OAT_TABLE -set X { 191.5 190.5 } NXC 192 Y { -0.5 0.5 } NYC 192 T { 0 20000 } NTC 1
} message ] {
return -code error $message
}
}
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 1
hmm configure $INST_NYC 127
hmm configure $INST_NXC 127
}
BAT_TABLE -init
CAT_TABLE -init
SAT_TABLE -init
OAT_TABLE -init
FAT_TABLE -init
::histogram_memory::ic_initialize
detector_active_height_mm [expr 5.08 * 192]
detector_active_width_mm [expr 5.08 * 192]
detector_active_height_mm lock
detector_active_width_mm lock
# hmm configure FAT_SIMULATED_EVENT_Y0 $y_bb0
# hmm configure FAT_SIMULATED_EVENT_Y1 $ybbmax
# hmm configure FAT_SIMULATED_EVENT_X0 $x_bb0
# hmm configure FAT_SIMULATED_EVENT_X1 $xbbmax
::histogram_memory::init_OAT_TABLE
::histogram_memory::upload_config Filler_defaults
set ::histogram_memory::histmem_axes(HOR) /instrument/detector/x_pixel_offset
set ::histogram_memory::histmem_axes(VER) /instrument/detector/y_pixel_offset
} message ] {
return -code error $message
}
}
proc histmem {cmd args} {
eval "_histmem $cmd $args"
}
publish histmem user

View File

@@ -0,0 +1,4 @@
source $cfPath(nexus)/nxscripts_common_1.tcl
proc ::nexus::isc_initialize {} {
::nexus::ic_initialize
}

View File

@@ -0,0 +1 @@
Optical Components: Neutron Guides, Apertures, Polariser, Focussing Lenses and Prisms

View File

@@ -0,0 +1,94 @@
namespace eval optics {
array set AttRotLookupTable {
0 { 0.0 1 }
30 { 1.3 0.498782 }
60 { 3.3 0.176433 }
90 { 4.9 0.0761367 }
120 { 6.4 0.0353985 }
150 { 8.3 0.0137137 }
180 { 9.6 0.00614167 }
210 {11.2 0.00264554 }
240 {13.1 0.000994504 }
270 {15.0 0.000358897 }
300 {18.0 7.2845e-05 }
330 {25.0 1.67827e-06 }
}
array set EApLookupTable {
0 { 5 circ}
30 {10 circ}
60 {20 circ}
90 {30 circ}
120 {40 circ}
150 {50 circ}
180 {50 squ }
210 {open open}
240 {open open}
270 {open open}
300 {open open}
330 {open open}
}
}
proc ::optics::AttRotLookup {angle column tol} {
variable AttRotLookupTable
set catch_status [ catch {
set foundit false
foreach vangle [array names AttRotLookupTable] {
if {$vangle >= [expr {$angle-$tol}] && $vangle <= [expr {$angle+$tol}]} {
set foundit true
break
}
}
if {$foundit == true} {
switch $column {
"plex" { set index 0 }
"attfactor" { set index 1 }
default { error "$column is unknown, allowed values are plex or attfactor" }
}
return [lindex $AttRotLookupTable($vangle) $index]
} else {
return -1
}
} message ]
handle_exception $catch_status $message
}
proc ::optics::EApLookUp {angle param tol} {
variable EApLookupTable
set foundit false
if [ catch {
if {$param == "size"} {
set cgf [SplitReply [GuideConfig]]
if {[string first $cgf "g1 g2 g3 g4 g5 g6 g7 g8 g9 p1 p2 p3 p4 p5 p6 p7 p8 p9"] != -1} {
return 50
}
}
switch $param {
"size" {set index 0}
"shape" {set index 1}
default {
error "ERROR: Invalid lookup parameter $param"
}
}
foreach vangle [array names EApLookupTable] {
if {$vangle >= [expr {$angle-$tol}] && $vangle <= [expr {$angle+$tol}]} {
set foundit true
break
}
}
if {$foundit == true} {
return [lindex $EApLookupTable($vangle) $index]
} else {
switch $param {
"size" {return 0}
"shape" {return "UNKNOWN"}
}
}
} message ] {
if {$::errorCode == "NONE"} {return $message}
return -code error "$message"
}
}

View File

@@ -0,0 +1,66 @@
##
# @file
# A guide configuration table where each line describes the setup
# for a mode of operation.
# The table will have a corresponding interpretation list which provides
# commands to setup the instrument.
namespace eval optics {
##
# @brief These arrays map the component identifiers (G, MT, etc) to the
# position index for each guide motor (c1, c2 ... c9)
array set c1_map {G 1 MT 2 P 3}
array set c2_map {MT 1 G 2 A 3}
array set c3_map {MT 1 G 2 A 3}
array set c4_map {MT 1 G 2 A 3}
array set c5_map {MT 1 G 2 A 3}
array set c6_map {MT 1 G 2 A 3}
array set c7_map {MT 1 G 2 A 3}
array set c8_map {MT 1 G 2 A 3}
array set c9_map {L 1 MT 2 G 3 A 4 LP 5}
# The guide configuration table is indexed by a configuration
# identifier (ga, mt, lp, etc). Each row has two elements,
# 1. A list of components selected for each guide (MT A ... etc)
# 2. The entrance aperature position in mm
# Eg $guide_configuration(p2) returns the following list
# {{P G A A A A A A A } 6934}
array set guide_configuration {
ga {{MT A A A A A A A A } 675}
mt {{MT MT MT MT MT MT MT MT MT} 675}
lp {{MT MT MT MT MT MT MT MT LP} 675}
lens {{MT A A A A A A A L } 675}
p1 {{P A MT MT MT MT MT MT MT} 4621}
p1lp {{P A MT MT MT MT MT MT LP} 4621}
p1lens {{P A MT MT MT MT MT MT L } 4621}
g1 {{G A A A A A A A A } 4929}
p2 {{P G A A A A A A A } 6934}
g2 {{G G A A A A A A A } 6934}
p3 {{P G G A A A A A A } 8949}
g3 {{G G G A A A A A A } 8949}
p4 {{P G G G A A A A A } 10955}
g4 {{G G G G A A A A A } 10955}
p5 {{P G G G G A A A A } 12943}
g5 {{G G G G G A A A A } 12943}
p6 {{P G G G G G A A A } 14970}
g6 {{G G G G G G A A A } 14970}
p7 {{P G G G G G G A A } 16971}
g7 {{G G G G G G G A A } 16971}
p8 {{P G G G G G G G A } 18937}
g8 {{G G G G G G G G A } 18937}
p9 {{P G G G G G G G G } 19925}
g9 {{G G G G G G G G G } 19925}
}
# This list maps the motor names to columns of the
# guide_configuration table.
set guide_configuration_columns {
c1 c2 c3 c4 c5 c6 c7 c8 c9
}
}
namespace eval optics {
variable guide_configuration
variable guide_configuration_columns
}

View File

@@ -0,0 +1,2 @@
fileeval $cfPath(optics)/guide_configuration.tcl
fileeval $cfPath(optics)/aperture_configuration.tcl

View File

@@ -0,0 +1,6 @@
source $cfPath(scan)/scan_common_1.tcl
proc ::scan::pre_hmm_scan_prepare {} {}
proc ::scan::isc_initialize {} {
::scan::ic_initialize
}

View File

@@ -0,0 +1,6 @@
source $cfPath(source)/source_common.tcl
proc ::source::isc_initialize {} {
::source::ic_initialize "cold"
}