1 #!/bin/bash
  2 # --verbose  print as lines are read
  3 
  4 # $Revision: 1.23 $  $Author: schwehr $  $Date: 2004/12/09 16:37:59 $
  5 
  6 ##############################################################################
  7 #     Copyright (C) 2004  Kurt Schwehr
  8 #
  9 #    This program is free software; you can redistribute it and/or modify
 10 #    it under the terms of the GNU General Public License as published by
 11 #    the Free Software Foundation; either version 2 of the License, or
 12 #    (at your option) any later version.
 13 #
 14 #    This program is distributed in the hope that it will be useful,
 15 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 17 #    GNU General Public License for more details.
 18 #
 19 #    You should have received a copy of the GNU General Public License
 20 #    along with this program; if not, write to the Free Software
 21 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 22 ###############################################################################
 23 
 24 # The goal of this script is to take 1st the ardath data sets and test
 25 # out the bootstrapping blobby density function and create a
 26 # visualization of it.
 27 
 28 
 29 
 30 ######################################################################
 31 # Debugging
 32 ######################################################################
 33 
 34 . debug.bash
 35 
 36 ######################################################################
 37 # Local tuning
 38 ######################################################################
 39 
 40 export PATH=${PATH}:.:..
 41 declare -ir cells=100
 42 if [ -z "$DENSITY_DRAW" ]; then
 43     declare -ir draw=50000
 44 else
 45     declare -ir draw=$DENSITY_DRAW
 46 fi
 47 DebugEcho $TRACE $LINENO "draw = $draw"
 48 
 49 
 50 declare -ar groups=( as1-crypt as2-slump as3-undef )
 51 declare -r w=0.5
 52 declare -r boundaries="-x -${w} -X ${w} -y -${w} -Y ${w} -z -${w} -Z ${w}"
 53 
 54 # Make all volumes be a unit cube
 55 declare -r scale="--xscale=0.5 --yscale=0.5 --zscale=0.5"
 56 
 57 DebugEcho $TERSE $LINENO "Cells = $cells   Draw = $draw "
 58 DebugEcho $VERBOSE $LINENO "boundaries are $boundaries"
 59 
 60 if [ -e Makefile ]; then
 61     make targets-no-test
 62 fi
 63 
 64 #
 65 # Bootstrap each of the groups to produce Vmin (V3), Vint(V2), Vmax(V1) volumes
 66 #
 67 if [ 1 == 1 ]; then
 68     for group in "${groups[@]}"; do
 69 
 70 	DebugEcho $TERSE $LINENO "Processing $group"
 71 
 72 	if [ ! -e ${group}-boot.xyz.vmax ]; then 
 73 	    if [ ! -e ${group}.s ]; then
 74 		echo "ERROR: ${group}.s is missing.  Goodbye."
 75 		exit $EXIT_FAILURE
 76 	    fi
 77 	    s_bootstrap ${group}.s -f xyz  -n 3 --out ${group}.xyz. -p --draw ${draw} -v $debugLevel
 78 	    mv ${group}.xyz.1.vmax ${group}-boot.xyz.vmax
 79 	    mv ${group}.xyz.2.vint ${group}-boot.xyz.vint
 80 	    mv ${group}.xyz.3.vmin ${group}-boot.xyz.vmin
 81 	else
 82 	    DebugEcho $TERSE $LINENO "Using existing bootstrapped xyz's"
 83 	fi
 84 
 85 	DebugEcho $TRACE $LINENO  Densifying:  calling xyzdensity 4 times
 86 
 87 	args=" -p 1  --bpv=16 -w ${cells} -t ${cells} -d ${cells} --verbosity=$debugLevel"
 88 	
 89  	xyzdensity ${group}-boot.xyz.vmax --out=${group}-vmax.vol $args $boundaries
 90  	xyzdensity ${group}-boot.xyz.vint --out=${group}-vint.vol $args $boundaries
 91  	xyzdensity ${group}-boot.xyz.vmin --out=${group}-vmin.vol $args $boundaries
 92  	xyzdensity --out=${group}-all.vol -p 1 -b 8 -w ${cells} -t ${cells} -d ${cells} $boundaries \
 93  	    ${group}-boot.xyz.vmax \
 94  	    ${group}-boot.xyz.vint \
 95  	    ${group}-boot.xyz.vmin 
 96 	
 97 	if [ ! -e current.cmap ]; then 
 98 	    volmakecmap --cpt=rgba.cpt -o current.cmap --zero=0
 99 	fi
100 
101 	volhdr_edit ${group}-all.vol --out=tmp.vol $scale && /bin/mv tmp.vol ${group}-all.vol
102 	# --box=2.0
103 	vol_iv -c ALPHA_BLENDING --numslicescontrol=ALL -p NONE -C current.cmap -o ${group}-all.iv ${group}-all.vol
104 
105 	volhdr_edit ${group}-vmax.vol --out=tmp.vol $scale && /bin/mv tmp.vol ${group}-vmax.vol
106 	volhdr_edit ${group}-vint.vol --out=tmp.vol $scale && /bin/mv tmp.vol ${group}-vint.vol
107 	volhdr_edit ${group}-vmin.vol --out=tmp.vol $scale && /bin/mv tmp.vol ${group}-vmin.vol
108 
109 	#
110 	# Make each component viewable... scale them to min max
111 	#
112 	vol2vol_args="  -p 0 --bpv=8 -j 0.5 -k 0.5 -l 0.5 -v $debugLevel"
113 	vol2vol -o ${group}-vmax-8.vol ${group}-vmax.vol $vol2vol_args
114 	vol2vol -o ${group}-vint-8.vol ${group}-vint.vol $vol2vol_args
115 	vol2vol -o ${group}-vmin-8.vol ${group}-vmin.vol $vol2vol_args
116 
117 	# -b=2
118 	ivargs=" -c ALPHA_BLENDING --numslicescontrol=ALL -p NONE -C current.cmap -v $debugLevel"
119 	vol_iv -o ${group}-vmax-8.iv ${group}-vmax-8.vol $ivargs
120 	vol_iv -o ${group}-vint-8.iv ${group}-vint-8.vol $ivargs
121 	vol_iv -o ${group}-vmin-8.iv ${group}-vmin-8.vol $ivargs
122 
123     done
124 fi
125 
126 # Now we need to make a compatability matrix.
127 
128 # convert them all to xyz files
129 if [ 1 == 1 ]; then
130     for group in "${groups[@]}"; do
131 	s_eigs < $group.s > $group.eigs
132 	eigs2xyz.py $group.eigs > $group.xyz
133 	awk '{print $1,$2,$3}' $group.xyz > $group-vmin.xyz
134 	awk '{print $4,$5,$6}' $group.xyz > $group-vint.xyz
135 	awk '{print $7,$8,$9}' $group.xyz > $group-vmax.xyz
136     done
137 
138     for eig_type in vmin vint vmax; do
139 	echo $eig_type comparing to vol
140 	for file in as?-?????-${eig_type}.vol; do 
141 	    xyzvol_cmp -r -v $debugLevel -d $file as?-?????-$eig_type.xyz -o ${eig_type}-${file}.cmp
142 	done
143     done
144 fi
145 
146 ######################################################################
147 # Owens Lake data
148 ######################################################################
149 
150 
151 DebugEcho $TERSE $LINENO "##############"
152 DebugEcho $TERSE $LINENO "# Owens Lake #"
153 DebugEcho $TERSE $LINENO "##############"
154 
155 
156 declare -ar ol_groups=( g1-fluidized g2-undeformed g3-sheared g4-little-def g5-intermediate )
157 
158 if [ ! -e "rosenbaum-ams-stripped.dat" ]; then
159     DebugEcho $ALWAY $LINENO "ERROR: Must have rosenbaum-ams-stripped.dat to continue.  Bye" 
160     exit $EXIT_FAILURE
161 fi
162 
163 if [ ! -e g1-fluidized.dat ]; then getgroups-ol92.bash; fi
164 
165 
166 if [ 1 == 1 ]; then
167     for group in "${ol_groups[@]}"; do
168 
169 	DebugEcho $TERSE $LINENO "Processing $group"
170 	# Should normed error be devided by 3?
171 	awk '{print $32/3,$33/3,$34/3,$35/3,$36/3,$37/3,$5,$2}' $group.dat > $group.s
172 	if [ ! -e ${group}-boot-vmax.xyz ]; then 
173 	    if [ ! -e ${group}.s ]; then
174 		echo "ERROR: ${group}.s is missing.  Goodbye."
175 		exit $EXIT_FAILURE
176 	    fi
177 	    s_bootstrap ${group}.s -f xyz  -n 3 --out ${group}.xyz. -p --draw ${draw} -v $debugLevel || die $LINENO
178 	    mv ${group}.xyz.1.vmax ${group}-boot-vmax.xyz
179 	    mv ${group}.xyz.2.vint ${group}-boot-vint.xyz
180 	    mv ${group}.xyz.3.vmin ${group}-boot-vmin.xyz
181 	else
182 	    DebugEcho $TERSE $LINENO "Using existing bootstrapped xyz's"
183 	fi
184 
185 	DebugEcho $TRACE $LINENO  "Densifying:  calling xyzdensity 4 times"
186 
187 	echo "Only doing 8 bpv"
188 	#args=" -p 1  --bpv=16 -w ${cells} -t ${cells} -d ${cells} --verbosity=$debugLevel"
189 	args=" -p 1  --bpv=8 -w ${cells} -t ${cells} -d ${cells} --verbosity=$debugLevel"
190 	if [ ! -e ${group}-vmax-8.vol ]; then
191 	    xyzdensity ${group}-boot-vmax.xyz --out=${group}-vmax-8.vol $args $boundaries || die $LINENO
192 	    xyzdensity ${group}-boot-vint.xyz --out=${group}-vint-8.vol $args $boundaries || die $LINENO
193 	    xyzdensity ${group}-boot-vmin.xyz --out=${group}-vmin-8.vol $args $boundaries || die $LINENO
194 	    xyzdensity --out=${group}-all.vol -p 1 -b 8 -w ${cells} -t ${cells} -d ${cells} $boundaries \
195 		${group}-boot-vmax.xyz \
196 		${group}-boot-vint.xyz \
197 		${group}-boot-vmin.xyz  || die $LINENO
198 	    volhdr_edit ${group}-all.vol --out=tmp.vol $scale && /bin/mv tmp.vol ${group}-all.vol || die $LINENO
199 	    volhdr_edit ${group}-vmax-8.vol --out=tmp.vol $scale && /bin/mv tmp.vol ${group}-vmax-8.vol || die $LINENO
200 	    volhdr_edit ${group}-vint-8.vol --out=tmp.vol $scale && /bin/mv tmp.vol ${group}-vint-8.vol || die $LINENO
201 	    volhdr_edit ${group}-vmin-8.vol --out=tmp.vol $scale && /bin/mv tmp.vol ${group}-vmin-8.vol || die $LINENO
202 	    #
203             # Make each component viewable... scale them to min max
204 	    #
205 	    vol2vol_args="  -p 0 --bpv=8 -j 0.5 -k 0.5 -l 0.5 -v $debugLevel"
206 	    #vol2vol -o ${group}-vmax-8.vol ${group}-vmax.vol $vol2vol_args || die $LINENO
207 	    #vol2vol -o ${group}-vint-8.vol ${group}-vint.vol $vol2vol_args || die $LINENO
208 	    #vol2vol -o ${group}-vmin-8.vol ${group}-vmin.vol $vol2vol_args || die $LINENO
209 	else
210 	    DebugEcho $TERSE $LINENO "Using existing ${group}-vmax.vol"
211 	fi
212 
213 	if [ ! -e current.cmap ]; then 
214 	    if [ ! -e rgba.cpt ]; then
215 		DebugEcho $TRACE $LINENO "ERROR:  missing rgba.cpt"
216 	    fi
217 	    volmakecmap --cpt=rgba.cpt -o current.cmap --zero=0 || die $LINENO
218 	fi
219 
220 	# --box=2.0
221 	vol_iv -c ALPHA_BLENDING --numslicescontrol=ALL -p NONE -C current.cmap -o ${group}-all.iv ${group}-all.vol \
222 	|| die $LINENO
223 
224 	ivargs=" -c ALPHA_BLENDING --numslicescontrol=ALL -p NONE -C current.cmap -v $debugLevel"
225 	vol_iv -o ${group}-vmax-8.iv ${group}-vmax-8.vol $ivargs || die $LINENO
226 	vol_iv -o ${group}-vint-8.iv ${group}-vint-8.vol $ivargs || die $LINENO
227 	vol_iv -o ${group}-vmin-8.iv ${group}-vmin-8.vol $ivargs || die $LINENO
228 
229 	#
230 	# Plot all the points as boxes
231 	#
232 	s_eigs < $group.s > $group.eigs
233 	eigs2xyz.py $group.eigs > $group.xyz
234 	awk '{print $1,$2,$3}' $group.xyz > $group-vmin.xyz || die $LINENO
235 	awk '{print $4,$5,$6}' $group.xyz > $group-vint.xyz || die $LINENO
236 	awk '{print $7,$8,$9}' $group.xyz > $group-vmax.xyz || die $LINENO
237 
238 	xyz_iv $box -p --color="1 0 0" --out=$group-vmin.xyz.iv -v 3 $group-vmin.xyz || die $LINENO
239 	xyz_iv $box -p --color="1 1 0" --out=$group-vint.xyz.iv -v 3 $group-vint.xyz || die $LINENO
240 	xyz_iv $box -p --color="0 0 1" --out=$group-vmax.xyz.iv -v 3 $group-vmax.xyz || die $LINENO
241     done
242 fi
243 
244 ######################################################################
245 
246 DebugEcho $TERSE $LINENO "Done with $0"


syntax highlighted by Code2HTML, v. 0.9.1