- Added polarisation support for TAS
This commit is contained in:
95
tascom.tcl
95
tascom.tcl
@@ -5,7 +5,7 @@
|
||||
# This file contains the procedures and command definitions for this syntax
|
||||
# adaption from SICS to MAD.
|
||||
#
|
||||
# Mark Koennecke, December 2000, March 2001
|
||||
# Mark Koennecke, December 2000, March 2001, April 2002
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ if { [info exists tasinit] == 0 } {
|
||||
Publish log User
|
||||
Publish sz User
|
||||
Publish sw User
|
||||
Publish pa User
|
||||
Publish on User
|
||||
Publish off User
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
@@ -988,10 +991,44 @@ proc powdersw args {
|
||||
}
|
||||
}
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
# switch polarisation
|
||||
proc polsw args {
|
||||
if { [llength $args] > 0 } {
|
||||
switch [lindex $args 0] {
|
||||
on {
|
||||
lpa 1
|
||||
return "Polarisation mode enabled"
|
||||
}
|
||||
off {
|
||||
lpa 0
|
||||
return "Polarisation mode disabled"
|
||||
}
|
||||
flip {
|
||||
if {[tasSplit [lpa]] == 1 } {
|
||||
return [polsw off]
|
||||
} else {
|
||||
return [polsw on]
|
||||
}
|
||||
}
|
||||
default {
|
||||
error "ERROR: syntax error, only on, off, flip allowed"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if { [tasSplit [lpa]] == 1} {
|
||||
return [format " %-30s : %-5s" "Polarisation Mode" "on"]
|
||||
} else {
|
||||
return [format " %-30s : %-5s" "Polarisation Mode" "off"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# mapping switches to procedures handling them
|
||||
|
||||
set switches(powder) powdersw
|
||||
set switches(pol) polsw
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# prsw prints switches
|
||||
@@ -999,7 +1036,7 @@ proc prsw args {
|
||||
global switches
|
||||
set l [array names switches]
|
||||
foreach e $l {
|
||||
append output [eval $switches($e)]
|
||||
append output [eval $switches($e)] "\n"
|
||||
}
|
||||
return $output
|
||||
}
|
||||
@@ -1055,3 +1092,57 @@ proc sw args {
|
||||
clientput [prsw]
|
||||
}
|
||||
}
|
||||
#---------------------------------------------------------------------------
|
||||
# pa : set polarization analysis file
|
||||
#--------------------------------------------------------------------------
|
||||
proc pa args {
|
||||
if {[llength $args] < 1} {
|
||||
error "Usage: pa polarisation analysis file"
|
||||
}
|
||||
set fil [lindex $args 0]
|
||||
if {[string first "." $fil] < 0} {
|
||||
set fil $fil.pal
|
||||
}
|
||||
polfile $fil
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# on and off for switching spin flippers
|
||||
#-------------------------------------------------------------------------
|
||||
proc checkarg args {
|
||||
if {[llength $args] < 1} {
|
||||
error "No flipper to set given"
|
||||
}
|
||||
set flipper [string trim [string tolower [lindex $args 0]]]
|
||||
if { [string compare $flipper f1] == 0 || \
|
||||
[string compare $flipper f2] == 0} {
|
||||
return $flipper
|
||||
} else {
|
||||
error [format "%s not a recognized flipper" $flipper]
|
||||
}
|
||||
}
|
||||
#------------------------------------------------------------------------
|
||||
proc on args {
|
||||
set flip [checkarg $args]
|
||||
if { [string compare $flip f1] == 0 } {
|
||||
f1 1
|
||||
set i1val [expr [tasSplit [tki]] * [tasSplit [if1h]]]
|
||||
set i2val [tasSplit [if1v]]
|
||||
return [dr i1 $i1val i2 $i2val]
|
||||
} else {
|
||||
f2 1
|
||||
set i3val [expr [tasSplit [tkf]] * [tasSplit [if2h]]]
|
||||
set i4val [tasSplit [if2v]]
|
||||
return [dr i3 $i3val i4 $i4val]
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
proc off args {
|
||||
set flip [checkarg $args]
|
||||
if { [string compare $flip f1] == 0 } {
|
||||
f1 0
|
||||
return [dr i1 .0 i2 .0]
|
||||
} else {
|
||||
f2 0
|
||||
return [dr i3 .0 i4 .0]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user