from astrometry.util.multiproc import * import os baseid = 4200 def index1((infn, hp)): for scale in [1,2,3,4]: indid = baseid + scale outfn = 'index-%04i-%02i.fits' % (indid, hp) cmd = (('build-index -i %s -o %s -P %i -S j_mag -B 0.1 -s 2 -H %i -r 1 -I %i -M' + ' > index-%i-%i.log') % (infn, outfn, scale, hp, indid, indid, hp)) print cmd os.system(cmd) def index2((infn, hp)): for scale in [5,6,7]: indid = baseid + scale outfn = 'index-%04i-%02i.fits' % (indid, hp) cmd = (('build-index -i %s -o %s -P %i -S j_mag -B 0.1 -s 1 -H %i -r 1 -I %i -M' + ' > index-%i-%i.log') % (infn, outfn, scale, hp, indid, indid, hp)) print cmd os.system(cmd) def index3((infn, scale)): indid = baseid + scale outfn = 'index-%04i.fits' % (indid) cmd = (('build-index -i %s -o %s -P %i -S j_mag -B 0.1 -s 0 -r 1 -I %i -M' + ' > index-%i.log') % (infn, outfn, scale, indid, indid)) print cmd os.system(cmd) def index4((infn, scale)): indid = baseid + scale outfn = 'index-%04i.fits' % (indid) cmd = (('build-index -d 3 -i %s -o %s -P %i -S j_mag -B 0.1 -s 0 -r 1 -I %i -M' + ' > index-%i.log') % (infn, outfn, scale, indid, indid)) print cmd os.system(cmd) # try scale 0 def index0((infn, hp)): scale = 0 indid = baseid + scale outfn = 'index-%04i-%02i.fits' % (indid, hp) cmd = (('build-index -i %s -o %s -P %i -S j_mag -B 0.1 -s 2 -H %i -r 1 -I %i -M' + ' > index-%i-%i.log') % (infn, outfn, scale, hp, indid, indid, hp)) print cmd os.system(cmd) if __name__ == '__main__': mp = multiproc(8) # All-sky indices infn = '2mass-cut-J15/2mass-all.fits' # Triangles mp.map(index4, [(infn, scale) for scale in range(11, 19+1)]) # Quads mp.map(index3, [(infn, scale) for scale in range(8, 10+1)]) # 12 healpixes mp.map(index2, [('2mass-split-1/2mass-hp%02i.fits' % hp, hp) for hp in range(12)]) # 48 healpixes mp.map(index0, [('2mass-split/2mass-hp%02i.fits' % hp, hp) for hp in range(48)]) # 48 healpixes mp.map(index1, [('2mass-split/2mass-hp%02i.fits' % hp, hp) for hp in range(48)])