An Image Plate Scan
Assume that we want to scan a motor and read images
from an image plate scanner at every stop. Two counters are
used, c1 and c2. C1 measures some signal after
the image has been read, c2 is active during the
exposure of the image. This example is an extension
of the simple fast scan. Before a measurement is started, one has
to setup the MAR client:
hasipbw5>
scan345
See section 13.12.25 for details.
Let's look at the before-macro first, table 15.11:
Table 15.18:
Example: Before_mar_scan.gra
!
! before_mar_scan.gra
!
!
! these symbols are keywords. they select the
! counters that are to be used during the scan
!
scan_c1 = c1
scan_c2 = dummy_c2
ip_counter = c2
ip_name = scan_name"_c2"
!
! counter c1 has to have a minimum of 1000 counts per second
! otherwise the scan is interrupted
!
scan_min_c1 = 1000
scan_timer = t1
!
! get_offsets() uses scan_timer and scan_ci to
! measure the offsets
!
if !search_symbol( scan_offset_c1)
s1 = get_offsets(10)
endif
deactivate scan_name
end
|
The timer t1 gates c1 and c2. C2 is
introduced as a dummy counter because it will be active during
the image exposure. This has to be done “by hand”. The
symbol ip_counter (image plate counter) is used
from a .gra file which takes the image: single_image.gra.
The during-file can be found in table 15.11.
Table 15.19:
Example: During_mar_scan.gra
!
! during_mar_scan.gra
!
fname = scan_name"_"sindex
!
! scan_par - sample time
! mode 2
! erase_flag 0
!
run <~.prog>single_image.gra scan_par fname 2 0
|
fname is the file name of the image. It is constructed
of the scan name and an index which counts the during-calls.
Table 15.11 displays the .gra file which
takes the image. Single_image.gra begins with
some checks on the input variables and erases the image
plate, if requested. Then is starts a motor (mot36) which
moves the sample forth and back during the image exposure.
Then is resets the counter before the shutter is opened. It
sleeps for the requested sample time and closes the shutter.
The counter is read before the image is scanned.
Table 15.20:
Example: An Image Plate Scan
!
! Usage:
!
! run <~.prog>single_image.gra st fname mode erase_flag
!
! st - the shutter is opened for ST seconds
! fname - file name, on NODE_MAR (/home/mar345/data)
! mode - scan mode, see below
! erase_flag - if 1, the plate is erased before the shutter opens
! shutter_flag - if 1, the plate is erased before the shutter opens
!
var si_sample_time si_file_name si_mar_mode si_erase_flag
!
if !gra_status()
end
endif
!
if ((si_sample_time < 0) + (si_sample_time > 100))
say " Sample_time out of range "si_sample_time
wait
end
endif
!
if ((si_mar_mode < 0) + (si_mar_mode > 7))
say " Mar_mode out of range "si_mar_mode
wait
end
endif
!
if ((si_erase_flag < 0) + (si_erase_flag > 1))
say " Erase_flag out of range "si_erase_flag
wait
end
endif
!
if si_erase_flag
!
! erase image
!
say/line=24 " Erasing ... "
s1 = erase_mar()
endif
!
! MOT36 moves the sample during the exposure.
The slew rate equals conversion factor => 1 unit/second
!
cali/unit=0/nocon/nolog mot36
say/line=24 " Open shutter for "si_sample_time" seconds"
saum(mot36) = si_sample_time + 0.5
do start_all_moves()
!
! if ip_counter (image plate counter) is defined,
! reset it before the shutter is opened
!
if search_symbol( ip_counter)
do resco( ip_counter)
endif
!
! osh and csh are symbols that contain commands which open/close
! the shutter, e.g.: osh = "wor(oreg1) = 1", csh = "wor(oreg1) = 0"
!
osh
wait si_sample_time
csh
do complete_all_moves()
!
! read the ip counter
!
if search_symbol( ip_counter)
ipc_name( sindex) = gc( ip_counter)
endif
!
say/line=24 " Shutter closed "
!
say/line=24 " Scanning image (mode "si_mar_mode") -> "si_file_name
!
s1 = scan_mar( si_mar_mode, si_file_name, si_sample_time)
|