#!/bin/csh -f
#
# File linking for processing images collected in inverse geometry setting
#
# Please set the following parameters:
#  if your image files are native2001.osc, native2002.osc, ..., native2256.osc,
#
#  file_name=native2
#  start=001
#  end=256

# set follows:
set file_name=gf5
set start=1
set end=60
###

@ times = 1

looper:
if   ($start < 10)                      set start="00$start"
if ( ($start < 100)&&($start >= 10) )   set start="0$start"
if ( ($start < 1000)&&($start >= 100) ) set start="$start"

if ($times % 2 == 0) then
@ series = $times / 2
if   ($series < 10)                       set series="00$series"
if ( ($series < 100)&&($series >= 10) )   set series="0$series"
if ( ($series < 1000)&&($series >= 100) ) set series="$series"
ln -s {$file_name}{$start}.osc {$file_name}b{$series}.osc
else
@ series = ($times + 1) / 2
if   ($series < 10)                       set series="00$series"
if ( ($series < 100)&&($series >= 10) )   set series="0$series"
if ( ($series < 1000)&&($series >= 100) ) set series="$series"
ln -s {$file_name}{$start}.osc {$file_name}a{$series}.osc
endif

@ start++
@ times++
if ($start > $end) goto stop
goto looper
stop:
exit
end


