BIN=../../Bin
DATA=../../Data

#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# Trying to get a good illumination
# in the ADCIGs
#      (07/20/07)
#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

noise02.H:
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/junk3.H\
		primaries_in=${DATA}/junk4.H multiples_in=${DATA}/junk5.H mu=1. \
                primaries_out=${DATA}/illumina.H\
		mode=1 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
		op=2 niter=10 2D=1 eps=5.0 > ${DATA}/$@

noise03.H:
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/junk3.H\
		primaries_in=${DATA}/junk4.H multiples_in=${DATA}/junk5.H mu=1. \
                primaries_out=${DATA}/illumina3.H\
		mode=2 nsmode=2 wmode=1 nfilt=7,7 npatch=30,30 \
		op=2 niter=20 2D=1 eps=0.1 > ${DATA}/$@



# Match simulated primaries to the data with the standard goal
# Mf=d to get an estimative of multiplaes. The kinematics of 
#the estmated multiples is perfect

#!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# Returning to the problem
#      (03/23/07)
#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!


# do adaptive subtraction of the primaries to get the multiples
#
primest01a.H:
	Window < ${DATA}/prim_data1_h.H f3=110 d3=400 n3=2> target2cig.H
	Window < ${DATA}/prim_prc.H f3=110 d3=400 n3=2> junk2cig.H
	time ${BIN}/Ultimatch-new-all.x < target2cig.H\
		multiples_in=junk2cig.H mu=1. \
		mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
		op=1 niter=30 2D=1 eps=30.0 > ${DATA}/$@

mulest02.H:
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/prim_data1_h.H\
		primaries_in=${DATA}/primest01_e80.H multiples_in=${DATA}/mulest01.H mu=1. \
                primaries_out=${DATA}/primestout.H\
		mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
		op=2 niter=60 2D=1 eps=30.0 > ${DATA}/$@


###############################################################
# TEST THE PATCH SIZE
#
# do adaptive subtraction of the primaries to get the multiples
# in common angle panels for the whole line
mult_patch_tst.H:
	time ${BIN}/Ultimatch-new-all.x < target_CAP.H\
                primaries_in=junk_CAP.H multiples_in=diff01_prc_CAP.H mu=0.8 \
                primaries_out=prim_patch_tst.H\
                mode=2 nsmode=2 wmode=1 nfilt=21,11 npatch=35,35 \
                op=2 niter=40 2D=1 eps=15.0 > $@

################################################################
#
# Now after getting the primaries using inverse theory 
#
#
primest_new2.H:
	Window f2=42 n2=173 <${DATA}/prims.all_2d.scale_mine.H > target.H
	Window f2=42 n2=173 <${DATA}/prim_new2.H > prmod.H
	${BIN}/Ultimatch-new-all.x <target.H \
		multiples_in=prmod.H \
		mu=1. mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,1 \
		op=1 niter=50 2D=1 eps=0.0 > ${DATA}/$@

primtest_new2.H:
	Window f2=42 n2=173 j3=200 <${DATA}/prims.all_2d.scale_mine.H > target1.H
	Window f2=42 n2=173 j3=200 <${DATA}/prim_new2.H > prmod1.H
	${BIN}/Ultimatch-new-all.x <target1.H \
		multiples_in=prmod1.H \
		mu=1. mode=2 nsmode=2 wmode=1 nfilt=31,11 npatch=50,1 \
		op=1 niter=20 2D=1 eps=0.0 > ${DATA}/$@

multest_new2.H:
	Math file1=target.H file2=${DATA}/primest_new2.H exp="file1-file2" > ${DATA}/$@

multest_new2a.H:
	time ${BIN}/Ultimatch-new-all.x < target.H \
                primaries_in=${DATA}/primest_new2.H multiples_in=${DATA}/multest_new2.H mu=1. \
                primaries_out=${DATA}/primest_new2a.H\
                mode=2 nsmode=1 wmode=1 nfilt=31,11 npatch=50,01 \
                op=2 niter=60 2D=1 eps=150.0 > ${DATA}/$@

primest_new2a.H:
	Math file1=target.H file2=${DATA}/multest_new2a.H exp="file1-file2" > ${DATA}/$@

multst2a_mu1_nf3111_npt5001_nit60_eps150.H:
#	Window f2=42 n2=173 f3=100 n3=5 j3=100 <${DATA}/prims.all_2d.scale_mine.H > target1.H
#	Window f3=100 n3=5 j3=100 <${DATA}/multest_new2.H > multst.H
#	Window f3=100 n3=5 j3=100 <${DATA}/primest_new2.H > prtst.H
	time ${BIN}/Ultimatch-new-all.x < target1.H \
		primaries_in=prtst.H multiples_in=multst.H mu=1. \
		primaries_out=primtst2a.H\
		mode=2 nsmode=1 wmode=1 nfilt=31,11 npatch=50,01 \
		op=2 niter=60 2D=1 eps=150. > ${DATA}/$@

primest_new2b.H:
	Math file1=target.H file2=${DATA}/multest_new2a.H exp="file1-file2" > ${DATA}/$@

mult01.H: 
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/prim_data1_h.H\
		primaries_in=${DATA}/prim_prc.H multiples_in=${DATA}/diff01_prc.H mu=0.8 \
		primaries_out=${DATA}/prim01.H\
		mode=2 nsmode=2 wmode=1 nfilt=21,21 npatch=30,5 \

multest021.H:
	Window n3=450 < ${DATA}/prim_data2_h.H > ${DATA}/target1.H
	Window n3=450 < ${DATA}/primest01.H > ${DATA}/junkP1.H
	Window n3=450 < ${DATA}/multest01.H > ${DATA}/junkM1.H
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/target1.H \
                primaries_in=${DATA}/junkP1.H multiples_in=${DATA}/junkM1.H mu=1. \
                primaries_out=${DATA}/primest021.H\
                mode=2 nsmode=2 wmode=1 nfilt=21,11 npatch=50,11 \
                op=2 niter=60 2D=1 eps=30.0 > ${DATA}/$@

multest022.H:
	Window n3=450 f3=450 < ${DATA}/prim_data2_h.H > ${DATA}/target2.H
	Window n3=450 f3=450 < ${DATA}/primest01.H > ${DATA}/junkP2.H
	Window n3=450 f3=450 < ${DATA}/multest01.H > ${DATA}/junkM2.H
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/target2.H \
                primaries_in=${DATA}/junkP2.H multiples_in=${DATA}/junkM2.H mu=1. \
                primaries_out=${DATA}/primest022.H\
                mode=2 nsmode=2 wmode=1 nfilt=21,11 npatch=50,11 \
                op=2 niter=60 2D=1 eps=30.0 > ${DATA}/$@

multest01_tiny.H:
	Math file1=${DATA}/prim_data2_h.H file2=${DATA}/primest01_tiny.H exp="file1-file2" > ${DATA}/$@

multest021_tiny.H:
	Window n3=450 < ${DATA}/prim_data2_h.H > ${DATA}/target1.H
	Window n3=450 < ${DATA}/primest01_tiny.H > ${DATA}/junkP1.H
	Window n3=450 < ${DATA}/multest01_tiny.H > ${DATA}/junkM1.H
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/target1.H \
                primaries_in=${DATA}/junkP1.H multiples_in=${DATA}/junkM1.H mu=1. \
                primaries_out=${DATA}/primest021_tiny.H\
                mode=2 nsmode=2 wmode=1 nfilt=21,11 npatch=50,11 \
                op=2 niter=60 2D=1 eps=30.0 > ${DATA}/$@

multest022_tiny.H:
	Window n3=450 f3=450 < ${DATA}/prim_data2_h.H > ${DATA}/target2.H
	Window n3=450 f3=450 < ${DATA}/primest01_tiny.H > ${DATA}/junkP2.H
	Window n3=450 f3=450 < ${DATA}/multest01_tiny.H > ${DATA}/junkM2.H
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/target2.H \
                primaries_in=${DATA}/junkP2.H multiples_in=${DATA}/junkM2.H mu=1. \
                primaries_out=${DATA}/primest022_tiny.H\
                mode=2 nsmode=2 wmode=1 nfilt=21,11 npatch=50,11 \
                op=2 niter=60 2D=1 eps=30.0 > ${DATA}/$@

####### Parallel test
primest01.H:
	time Parallel command=${BIN}/Ultimatch-new-all.x \
                files="${DATA}/prim_data2_h.H,${DATA}/prim2_prc.H,${DATA}/$@" \
                tags="stdin,multiples_in,stdout" \
                mach_mfile=machinefile_200 axis=3,3,3 \
                usage="INPUT,INPUT,OUTPUT" \
                file_type="DISTRIBUTE,DISTRIBUTE,DISTRIBUTE" \
                pverb=2 nblock=20 \
                mu=1. mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,1 \
                op=1 niter=50 2D=1 eps=30.0 > primest01.log

primest01_tiny.H:
	time Parallel command=${BIN}/Ultimatch-new-all.x \
                files="${DATA}/prim_data2_h.H,${DATA}/prim_tiny.H,${DATA}/$@" \
                tags="stdin,multiples_in,stdout" \
                mach_mfile=machinefile_200 axis=3,3,3 \
                usage="INPUT,INPUT,OUTPUT" \
                file_type="DISTRIBUTE,DISTRIBUTE,DISTRIBUTE" \
                pverb=2 nblock=20 \
                mu=1. mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,1 \
                op=1 niter=50 2D=1 eps=30.0 > primest01_tiny.log

prim_par01.H:
	time Parallel command=${BIN}/Ultimatch-new-all.x \
		files="${DATA}/prim_data1_h_samp.H,${DATA}/prim_prc_samp.H,${DATA}/$@" \
		tags="stdin,multiples_in,stdout" \
		mach_mfile=machinefile_200 axis=3,3,3 \
		usage="INPUT,INPUT,OUTPUT" \
                file_type="DISTRIBUTE,DISTRIBUTE,DISTRIBUTE" \
	        pverb=2 nblock=3 \
                mu=1. mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
                op=1 niter=30 2D=1 eps=30.0 > prim_par01.log

mult01_par_tst.H: 
	time Parallel command=${BIN}/Ultimatch-new-all.x \
		files="${DATA}/prim_data1_h_samp.H,${DATA}/prim_prc_samp.H,${DATA}/mul_samp.H,${DATA}/primout_samp.H,${DATA}/$@" \
		tags="stdin,primaries_in,multiples_in,primaries_out,stdout" \
		mach_mfile=machinefile_200 axis=3,3,3,3,3 \
		usage="INPUT,INPUT,INPUT,OUTPUT,OUTPUT" \
		file_type="DISTRIBUTE,DISTRIBUTE,DISTRIBUTE,DISTRIBUTE,DISTRIBUTE" \
		pverb=2 nblock=10 \
		mu=0.8 mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
		op=2 niter=50 2D=1 eps=15. > mult01_par_tst.log 

mult01_tst.H:
	time ${BIN}/Ultimatch-new-all.x <${DATA}/prim_data1_h_samp.H \
		primaries_in=${DATA}/prim_prc_samp.H multiples_in=${DATA}/mul_samp.H mu=0.8 \
		primaries_out=${DATA}/primout_samp.H \
                mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
                op=2 niter=50 2D=1 eps=15. > ${DATA}/$@

mult01_par.H:
	time Parallel command=${BIN}/Ultimatch-new-all.x \
		files="${DATA}/prim_data1_h.H,${DATA}/prim_prc.H,${DATA}/mulest01_e80.H,$@" \
		tags="stdin,primaries_in,multiples_in,stdout" \
		mach_mfile=machinefile_200 axis=3,3,3,3 \
		usage="INPUT,INPUT,INPUT,OUTPUT" \
		file_type="DISTRIBUTE,DISTRIBUTE,DISTRIBUTE,DISTRIBUTE" \
		pverb=2 nblock=20\
		mu=0.8 mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
		op=2 niter=50 2D=1 eps=15. > mult01_par.log

