Changeset 240 for trunk


Ignore:
Timestamp:
Dec 4, 2009 5:02:44 PM (14 years ago)
Author:
toby
Message:

# on 2000/07/20 22:13:40, toby did:
move MDprefinfo into readexp.tcl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/orient.tcl

    • Property rcs:date changed from 2000/07/06 21:28:01 to 2000/07/20 22:13:40
    • Property rcs:lines changed from +3 -20 to +2 -130
    • Property rcs:rev changed from 1.3 to 1.4
    r230 r240  
    11# $Revision$ $Date$
    22# Pamela Whitfield & Brian Toby
    3 # a GUI for March-Dollase preferred orientatio
    4 
    5 # get March-Dollase preferred orientation information
    6 # use MDprefinfo hist phase axis-number parm action value
    7 #    ratio    -- ratio of xtallites in PO direction vs random (>1 for more)
    8 #    fraction -- fraction in this direction, when more than one axis is used
    9 #    h k & l  -- indices of P.O. axis
    10 #    ratioref -- flag to vary ratio
    11 #    fracref  -- flag to vary fraction
    12 #    damp     -- damping value
    13 #    type     -- model type (0 = P.O. _|_ to beam, 1 = || to beam)
    14 #    new      -- creates a new record with default values (set only)
    15 proc MDprefinfo {histlist phaselist axislist parm "action get" "value {}"} {
    16     foreach phase $phaselist hist $histlist axis $axislist {
    17         if {$phase == ""} {set phase [lindex $phaselist end]}
    18         if {$hist == ""} {set hist [lindex $histlist end]}
    19         if {$axis == ""} {set axis [lindex $axislist end]}
    20         if {$hist < 10} {
    21             set hist " $hist"
    22         }
    23         if {$axis > 9} {
    24             set axis "0"
    25         }
    26         set key "HAP${phase}${hist}PREFO${axis}"
    27         switch -glob ${parm}-$action {
    28             ratio-get {
    29                 return [string trim [string range [readexp $key] 0 9]]
    30             }
    31             ratio-set {
    32                 if ![validreal value 10 6] {return 0}
    33                 setexp $key $value 1 10
    34             }
    35             fraction-get {
    36                 return [string trim [string range [readexp $key] 10 19]]
    37             }
    38             fraction-set {
    39                 if ![validreal value 10 6] {return 0}
    40                 setexp $key $value 11 10
    41             }
    42             h-get {
    43                 set h [string trim [string range [readexp $key] 20 29]]
    44                 # why not allow negative h values?
    45                 #               if {$h < 1} {return 0}
    46                 return $h
    47             }
    48             h-set {
    49                 if ![validreal value 10 2] {return 0}
    50                 setexp $key $value 21 10
    51             }
    52             k-get {
    53                 set k [string trim [string range [readexp $key] 30 39]]
    54                 #               if {$k < 1} {return 0}
    55                 return $k
    56             }
    57             k-set {
    58                 if ![validreal value 10 2] {return 0}
    59                 setexp $key $value 31 10
    60             }
    61             l-get {
    62                 set l [string trim [string range [readexp $key] 40 49]]
    63                 #if {$l < 1} {return 0}
    64                 return $l
    65             }
    66             l-set {
    67                 if ![validreal value 10 2] {return 0}
    68                 setexp $key $value 41 10
    69             }
    70             ratioref-get {
    71                 if {[string toupper \
    72                         [string range [readexp $key] 53 53]] == "Y"} {
    73                     return 1
    74                 }
    75                 return 0
    76             }
    77             ratioref-set {
    78                 if $value {
    79                     setexp $key "Y" 54 1
    80                 } else {
    81                     setexp $key "N" 54 1
    82                 }
    83             }
    84             fracref-get {
    85                 if {[string toupper \
    86                         [string range [readexp $key] 54 54]] == "Y"} {
    87                     return 1
    88                 }
    89                 return 0
    90             }
    91             fracref-set {
    92                 if $value {
    93                     setexp $key "Y" 55 1
    94                 } else {
    95                     setexp $key "N" 55 1
    96               }
    97             }
    98             damp-get {
    99                 set val [string trim [string range [readexp $key] 59 59]]
    100                 if {$val == " "} {return 0}
    101                 return $val
    102             }
    103             damp-set {
    104                 setexp $key $value 60 1
    105             }
    106             type-get {
    107                 set val [string trim [string range [readexp $key] 64 64]]
    108                 if {$val == " "} {return 0}
    109                 return $val
    110             }
    111             type-set {
    112                 # only valid settings are 0 & 1
    113                 if {$value != "0" && $value != "1"} {set value "0"}
    114                 setexp $key $value 65 1
    115             }
    116             new-set {
    117                 makeexprec $key
    118                 setexp $key \
    119                         {  1.000000  1.000000  0.000000  0.000000  1.000000   NN    0    0} \
    120                         1 68
    121             }
    122             default {
    123                 set msg "Unsupported MDprefinfo access: parm=$parm action=$action"
    124                 tk_dialog .badexp "Error in EXP" $msg error 0 Exit
    125                 destroy .
    126             }
    127 
    128         }
    129 
    130     }
    131 }
     3# a GUI for March-Dollase preferred orientation
    1324
    1335proc MakeOrientPane {} {
Note: See TracChangeset for help on using the changeset viewer.