• R/O
  • HTTP
  • SSH
  • HTTPS

tutorial: Commit

This repository is for tutorials of Eos.


Commit MetaInfo

Revision252059cbd38ad3461ee5985590d8f911104dfb4d (tree)
Time2015-03-09 18:00:33
Authorkinoshita-eos <kinoshita@yasu...>
Commiterkinoshita-eos

Log Message

Add: Grouping point for clustering.
new file: 2DClustering/2DClustering1/GroupingPoint.pione
modified: SampleCode/PIONE/Advanced5/Main.pione
new file: SampleCode/PIONE/Advanced5/Main_ROI.pione
modified: SampleCode/PIONE/Advanced5/Main_ROIr.pione

Change Summary

Incremental Difference

--- /dev/null
+++ b/2DClustering/2DClustering1/GroupingPoint.pione
@@ -0,0 +1,78 @@
1+# For GroupingPoint
2+param $filename := "121p-shift2"
3+param $ROT2 := (0.upto(3)) * 45
4+param $divide := 4
5+
6+Rule Main
7+ input '*.padsortlst'
8+ input '{$I[1][1]}.treeinfo'
9+ output '{$I[1][1]}.groupinfo'
10+Action
11+ cp {$I[1]} 1.lst
12+ cp {$I[2]} 1.tree
13+ for (( i=2; i<={$divide}; i++ ))
14+ do
15+ max=0
16+ for data in $(ls *.lst)
17+ do
18+ num=$(wc -l ${data} | awk '{printf $1}')
19+ if [ ${num} -gt ${max} ] ; then
20+ max=${num}
21+ maxlist="${data}"
22+ fi
23+ done
24+ maxtree="$(basename ${maxlist} '.lst').tree"
25+ root=$(head -1 ${maxtree} | awk '{printf("%d", $1)}')
26+ rootname=$(basename $(awk -v val=${root} '$2==val {printf("%s", $1)}' ${maxlist}) ".pad")
27+ cp ${maxlist} ${rootname}.avglst
28+ maxpos=$(awk -v val=${root} '$2==val {printf("%f", $3)}' ${maxlist})
29+ line=$(awk -v val=${root} '$2==val {print NR}' ${maxlist})
30+ head -$((${line} - 1)) ${maxlist} > ${i}.lst
31+ tail -$(($(wc -l ${maxlist} | awk '{print $1}') - ${line} + 1)) ${maxlist} > tmp
32+ cp tmp ${maxlist}
33+
34+ max_t=$(wc -l ${maxtree} | awk '{printf $1}')
35+ max_l=$(wc -l ${maxlist} | awk '{printf $1}')
36+ line_t=$(awk -v val=${root} '$1==val {print NR}' ${maxtree})
37+ head -$((${max_l} + ${line_t} - 1)) ${maxtree} | tail -$((${max_l} - 1)) > tmp
38+ tail -$((${max_t} - ${max_l})) ${maxtree} > ${i}.tree
39+ cp tmp ${maxtree}
40+ done
41+
42+ array_rot2=( {$ROT2} )
43+
44+ total=0
45+ element_total=0
46+ for lst in $(ls *.lst)
47+ do
48+ num=$(basename ${lst} ".lst")
49+ element_num=$(wc -l ${num}.lst | awk '{print $1}')
50+ element_total=$(( ${element_total} + ${element_num} ))
51+ data=$(head -1 ${num}.tree)
52+ root_i=$(echo ${data} | awk '{print $1}')
53+ root_name=$(basename $(awk -v i=${root_i} '$2==i {print $1}' ${num}.lst) ".pad")
54+
55+ max=0
56+ max_i=0
57+ i=0
58+ include_max_rot2=${array_rot2[0]}
59+ for rot2 in ${array_rot2[@]}
60+ do
61+ include_num=$(grep "{$filename}-0-${rot2}-" ${num}.lst | wc -l | awk '{print $1}')
62+ if [ ${include_num} -gt ${max} ] ; then
63+ max=${include_num}
64+ include_max_rot2=${rot2}
65+ max_i=${i}
66+ fi
67+ i=$(( ${i} + 1 ))
68+ done
69+
70+ echo "group${root_i}: match: ${max} owner: ${include_max_rot2}" >> {$O[1]}
71+ total=$(( ${total} + ${max} ))
72+
73+ unset array_rot2[${max_i}]
74+ array_rot2=("${array_rot2[@]}")
75+ done
76+ echo " total: ${total}" >> {$O[1]}
77+ echo "${total} ${element_total}" | awk '{printf("parcentage: %f\n", $1 / $2)}' >> {$O[1]}
78+End
--- a/SampleCode/PIONE/Advanced5/Main.pione
+++ b/SampleCode/PIONE/Advanced5/Main.pione
@@ -1,6 +1,6 @@
1-param $task := 2
2-param $divide := 2
3-param $refine := 5
1+param $task := 4
2+param $divide := 4
3+param $refine := 0#5
44
55 # Cluster Name
66 param $CLUSTER := "all"
@@ -16,7 +16,7 @@ param $SHRINK := 1
1616 param $PADMODE := 13
1717 # LOWPASS
1818 param $LowPassMode := 4
19-param $LowPassResolution := 0.1
19+param $LowPassResolution := 0.085
2020
2121 # Clustering
2222 param $ClusterCorrelationMode := 19
@@ -58,19 +58,27 @@ $Config := ("CLUSTER":$CLUSTER) |
5858 ("TreeScaleY":$TreeScaleY) |
5959 ("TreeOffset":$TreeOffset)
6060
61+# For GroupingPoint
62+param $filename := "121p-shift2"
63+param $ROT2 := (0.upto(3)) * 45
64+
6165 Rule Main
6266 input '*.roi'.all
6367 input 'Makefile'
68+ output '*.pad'.all
6469 output '*.avg'.all
6570 output '*.tiff'.all
66- output 'all.logps'
67- output 'all.treeinfo'
68- output 'all.avgsortlst'
71+ output '{$CLUSTER}.logps'
72+ output '{$CLUSTER}.treeinfo'
73+ output '{$CLUSTER}.padsortlst'
74+ output '{$CLUSTER}.avgsortlst'
75+ output '*.avg*'.all
76+ output '*.groupinfo'.all
6977 Flow
7078 rule SetParam
7179 rule Preprocess {filelist:$I[1].all, num:1.upto($task), length:$I[1].length()}
7280 rule Process
73- rule Refinement {num:1.upto($divide)}
81+ rule Refinement {num:1.upto($divide)} >>> GroupingPoint
7482 rule RefinementRoot
7583 rule MontageAverage
7684 End
@@ -102,23 +110,23 @@ Rule Process
102110 input '*.pad'.all
103111 input 'Makefile'
104112 input 'Makefile.config'
105- output 'all.padsortlst'
106- output 'all.treeinfo'
107- output 'all.avgsortlst'
113+ output '{$CLUSTER}.padsortlst'
114+ output '{$CLUSTER}.treeinfo'
115+ output '{$CLUSTER}.avgsortlst'
108116 output ((1.upto($divide).str())+".lst").d().all()
109117 output ((1.upto($divide).str())+".tree").d().all()
110118 output ("*.pad"+(1.upto($divide).str())).d().all()
111119 output ("*.avg"+(0.upto($divide).str())).d().all()
112120 output '*.avglst'.all
113- output 'all.padsortmon.tiff'
114- output 'all.avgsortmon.tiff'
115- output 'all.logps'
121+ output '{$CLUSTER}.padsortmon.tiff'
122+ output '{$CLUSTER}.avgsortmon.tiff'
123+ output '{$CLUSTER}.logps'
116124 Action
117- ls -1 *.pad > all.padlst
125+ ls -1 *.pad > {$CLUSTER}.padlst
118126 make Log
119127 make LogPS
120- mrc2tiff -i all.padsortmon -o all.padsortmon.tiff
121- mrc2tiff -i all.avgsortmon -o all.avgsortmon.tiff
128+ mrc2tiff -i {$CLUSTER}.padsortmon -o {$CLUSTER}.padsortmon.tiff
129+ mrc2tiff -i {$CLUSTER}.avgsortmon -o {$CLUSTER}.avgsortmon.tiff
122130
123131 cp {$O[1]} 1.lst
124132 cp {$O[2]} 1.tree
@@ -174,10 +182,10 @@ Rule Refinement
174182 Action
175183 max=$(wc -l {$num}.tree | awk '{printf $1}')
176184 data=$(head -1 {$num}.tree)
177- i=$(echo ${data} | awk '{print $1}')
178- name=$(basename $(awk -v i=${i} '$2==i {print $1}' {$num}.lst) ".pad")
179- cp {$num}.lst ${name}.avglst
180- cp {$num}.tree ${name}.tree
185+ root_i=$(echo ${data} | awk '{print $1}')
186+ root_name=$(basename $(awk -v i=${root_i} '$2==i {print $1}' {$num}.lst) ".pad")
187+ cp {$num}.lst ${root_name}.avglst
188+ cp {$num}.tree ${root_name}.tree
181189
182190 for (( k=1; k<=max ; k++ ))
183191 do
@@ -230,6 +238,7 @@ Action
230238
231239 mrcImageAverage -i ${name}.fitlst -o ${name}.pad.avg
232240 done
241+
233242 mrc2tiff -i ${name}.pad.avg -o ${name}.pad.avg.tiff
234243 mrc2tiff -i ${name}.pad.avg{$num} -o ${name}.pad.avg{$num}.tiff
235244 done
@@ -251,7 +260,7 @@ Action
251260 ClusterRotationRangePartitionNumber=$(awk '$1=="ClusterRotationRangePartitionNumber" {print $2}' Makefile.config.tmp)
252261 ClusterRotationIterationNumber=$(awk '$1=="ClusterRotationIterationNumber" {print $2}' Makefile.config.tmp)
253262 ClusterRotationCorrelationMode=$(awk '$1=="ClusterRotationCorrelationMode" {print $2}' Makefile.config.tmp)
254-
263+
255264 for data in $(ls *.avglst)
256265 do
257266 name=$(basename ${data} ".avglst")
@@ -268,17 +277,60 @@ Action
268277
269278 mrcImageAverage -i ${name}.fitlst -o ${name}.pad.avg
270279 done
280+
271281 mrc2tiff -i ${name}.pad.avg -o ${name}.pad.avg.tiff
272282 mrc2tiff -i ${name}.pad.avg0 -o ${name}.pad.avg0.tiff
273283 done
274284 End
275285
286+Rule GroupingPoint
287+ input '*.lst'.all
288+ input '*.tree'.all
289+ output '{$CLUSTER}.groupinfo'
290+Action
291+ array_rot2=( {$ROT2} )
292+
293+ total=0
294+ element_total=0
295+ for num in {$I[1][1]}
296+ do
297+ element_num=$(wc -l ${num}.lst | awk '{print $1}')
298+ element_total=$(( ${element_total} + ${element_num} ))
299+ data=$(head -1 ${num}.tree)
300+ root_i=$(echo ${data} | awk '{print $1}')
301+ root_name=$(basename $(awk -v i=${root_i} '$2==i {print $1}' ${num}.lst) ".pad")
302+
303+ max=0
304+ max_i=0
305+ i=0
306+ include_max_rot2=${array_rot2[0]}
307+ for rot2 in ${array_rot2[@]}
308+ do
309+ include_num=$(grep "{$filename}-0-${rot2}-" ${num}.lst | wc -l | awk '{print $1}')
310+ if [ ${include_num} -gt ${max} ] ; then
311+ max=${include_num}
312+ include_max_rot2=${rot2}
313+ max_i=${i}
314+ fi
315+ i=$(( ${i} + 1 ))
316+ done
317+
318+ echo "group${root_i}: match: ${max} owner: ${include_max_rot2}" >> {$O[1]}
319+ total=$(( ${total} + ${max} ))
320+
321+ unset array_rot2[${max_i}]
322+ array_rot2=("${array_rot2[@]}")
323+ done
324+ echo " total: ${total}" >> {$O[1]}
325+ echo "${total} ${element_total}" | awk '{printf("parcentage: %f\n", $1 / $2)}' >> {$O[1]}
326+End
327+
276328 Rule MontageAverage
277- input 'all.avgsortlst'
278- input 'all.treeinfo'
329+ input '{$CLUSTER}.avgsortlst'
330+ input '{$CLUSTER}.treeinfo'
279331 input '*.pad.avg'.all
280- output 'all.avgrefinemon'
281- output 'all.avgrefinemon.tiff'
332+ output '{$CLUSTER}.avgrefinemon'
333+ output '{$CLUSTER}.avgrefinemon.tiff'
282334 Action
283335 root=$(head -1 {$I[2]} | awk '{print $1}')
284336 root_file=$(awk -v val=${root} '$2==val {print $1}' {$I[1]})
--- /dev/null
+++ b/SampleCode/PIONE/Advanced5/Main_ROI.pione
@@ -0,0 +1,70 @@
1+Rule Main
2+ input '*.ref3d'
3+ output '*.roi'.all
4+ output '*.tiff'.all
5+ param $X_SIZE := 32
6+ param $Y_SIZE := 32
7+ param $ROI_ROT_MODE := "XEYS"
8+ param $ROI_ROT1_MIN := 0
9+ param $ROI_ROT1_MAX := 0
10+ param $ROI_ROT1_DELTA := 45
11+ $ROI_ROT1 := (((0.upto(($ROI_ROT1_MAX - $ROI_ROT1_MIN) / $ROI_ROT1_DELTA)) * $ROI_ROT1_DELTA) + $ROI_ROT1_MIN).all
12+ param $ROI_ROT2_MIN := 0
13+ param $ROI_ROT2_MAX := 135
14+ param $ROI_ROT2_DELTA := 45
15+ $ROI_ROT2 := (((0.upto(($ROI_ROT2_MAX - $ROI_ROT2_MIN) / $ROI_ROT2_DELTA)) * $ROI_ROT2_DELTA) + $ROI_ROT2_MIN).all
16+ param $ROI_ROT3_MIN := 0
17+ param $ROI_ROT3_MAX := 270
18+ param $ROI_ROT3_DELTA := 30
19+ $ROI_ROT3 := (((0.upto(($ROI_ROT3_MAX - $ROI_ROT3_MIN) / $ROI_ROT3_DELTA)) * $ROI_ROT3_DELTA) + $ROI_ROT3_MIN).all
20+ param $ROI_SN := 0.9
21+Action
22+ data=$(mrcInfo -i {$I[1]} | head -1)
23+ x_size=$(echo "${data}" | awk '{printf ("%i", $4)}')
24+ y_size=$(echo "${data}" | awk '{printf ("%i", $5)}')
25+ z_size=$(echo "${data}" | awk '{printf ("%i", $6)}')
26+
27+ data=$(mrcInfo -i {$I[1]} | head -5 | tail -1)
28+ x_length=$(echo "${data}" | awk '{printf ("%f", $4)}')
29+ y_length=$(echo "${data}" | awk '{printf ("%f", $5)}')
30+ z_length=$(echo "${data}" | awk '{printf ("%f", $6)}')
31+
32+ ref_size=${x_size}
33+ length=${x_length}
34+
35+ if [ ${ref_size} -lt ${y_size} ] ; then \
36+ ref_size=${y_size}
37+ length=${y_length}
38+ fi
39+
40+ if [ ${ref_size} -lt ${z_size} ] ; then \
41+ ref_size=${z_size}
42+ length=${z_length}
43+ fi
44+
45+ image_size={$X_SIZE}
46+
47+ if [ ${image_size} -lt {$Y_SIZE} ] ; then \
48+ image_size={$Y_SIZE}
49+ fi
50+
51+ sampling_length=$(echo "scale=7; ${length} * ${ref_size} / ${image_size}" | bc)
52+
53+ mrcImageSamplingUnitChange -i {$I[1]} -o {$I[1][1]}.sample3d -m 2 -S ${sampling_length} ${sampling_length} ${sampling_length}
54+
55+ for rot1 in {$ROI_ROT1}
56+ do
57+ for rot2 in {$ROI_ROT2}
58+ do
59+ for rot3 in {$ROI_ROT3}
60+ do
61+ mrc3Dto2D -i {$I[1][1]}.sample3d -o {$I[1][1]}-${rot1}-${rot2}-${rot3}.data2d -InterpolationMode 2 -EulerMode {$ROI_ROT_MODE} \
62+ -Rot1 ${rot1} ${rot1} 1 \
63+ -Rot2 ${rot2} ${rot2} 1 \
64+ -Rot3 ${rot3} ${rot3} 1
65+ mrcImageNoiseAdd -i {$I[1][1]}-${rot1}-${rot2}-${rot3}.data2d -o {$I[1][1]}-${rot1}-${rot2}-${rot3}-{$ROI_SN}.roi -SN {$ROI_SN}
66+ mrc2tiff -i {$I[1][1]}-${rot1}-${rot2}-${rot3}-{$ROI_SN}.roi -o {$I[1][1]}-${rot1}-${rot2}-${rot3}-{$ROI_SN}.tiff
67+ done
68+ done
69+ done
70+End
--- a/SampleCode/PIONE/Advanced5/Main_ROIr.pione
+++ b/SampleCode/PIONE/Advanced5/Main_ROIr.pione
@@ -2,14 +2,15 @@ Rule Main
22 input '*.ref3d'
33 output '*.roi'.all
44 output '*.tiff'.all
5- param $X_SIZE := 32
6- param $Y_SIZE := 32
5+ #output '*.ref2d'.all
6+ param $X_SIZE := 64#32
7+ param $Y_SIZE := 64#32
78 param $ROI_ROT_MODE := "XEYS"
8- param $ROI_ROT1_NUM := 3
9- param $ROI_ROT2_NUM := 3
10- param $ROI_ROT3_NUM := 3
11- param $ROI_SHIFT_NUM := 2
12- param $ROI_SN := 1
9+ param $ROI_ROT1_NUM := 1#3
10+ param $ROI_ROT2_NUM := 4#3
11+ param $ROI_ROT3_NUM := 10
12+ param $ROI_SHIFT_NUM := 1#2
13+ param $ROI_SN := 0.3
1314 param $ROI_NOISE_NUM := 1
1415 Action
1516 data=$(mrcInfo -i {$I[1]} | head -1)
@@ -66,6 +67,10 @@ Action
6667 done
6768 done
6869 done
70+ #mrc3Dto2D -i {$I[1][1]}.sample3d -o all.ref2d -InterpolationMode 2 -EulerMode {$ROI_ROT_MODE} \
71+ # -Rot1 ${rot1} ${rot1} 1 \
72+ # -Rot2 ${rot2} ${rot2} 1 \
73+ # -Rot3 0 0 1
6974 done
7075 done
7176 End
Show on old repository browser