def main(): parser = argparse.ArgumentParser() parser.add_argument('--subhaloID') parser.add_argument('--snapNum', default = '135') parser.add_argument('--rotation') # oblate or prolate rotation parser.add_argument('--phi') # let's input in units of degrees parser.add_argument('--inc') parser.add_argument('--pa', default = '500') args = parser.parse_args() subhaloID = args.subhaloID subhaloNum = int(subhaloID[7:]) snapNum = int(args.snapNum) rotation = args.rotation phi = float(args.phi) inc = float(args.inc) pa = float(args.pa) foldername = subhaloID + '_p' + args.phi + '_i' + args.inc os.system('mkdir -p {}/{}'.format(outpath, foldername)) path = outpath + foldername os.system('mkdir -p {}/imgs'.format(path)) data = ui.getData(illustris_path, snapNum, subhaloNum, 4) run(data['Coordinates'], data['Velocities'], data['Masses'], data['GFM_StellarPhotometrics'], data['GFM_Metallicity'], rotation, phi, inc, pa, path+'/imgs/')
def main(): parser = argparse.ArgumentParser() parser.add_argument('--subhaloID') parser.add_argument('--snapNum') args = parser.parse_args() subhaloID = args.subhaloID subhaloNum = int(subhaloID[7:]) snapNum = int(args.snapNum) foldername = subhaloID os.system('mkdir -p {}/{}'.format(outpath, foldername)) path = outpath + foldername os.system('mkdir -p {}/shape'.format(path)) data_star = ui.getData(illustris_path, snapNum, subhaloNum, 4) data_dark = ui.getData(illustris_path, snapNum, subhaloNum, 1) run(data_star['Coordinates'] - data_star['SubhaloPos'], data_star['Masses'], data_star['HalfMassRad'], data_dark['Coordinates'] - data_dark['SubhaloPos'], data_dark['Masses'], data_dark['HalfMassRad'], path + '/shape/')
def main(): parser = argparse.ArgumentParser() parser.add_argument('--subhaloID') parser.add_argument('--snapNum') parser.add_argument('--TNG', default = False, type = bool) parser.add_argument('--outpath', default = None) args = parser.parse_args() subhaloID = args.subhaloID subhaloNum = int(subhaloID[7:]) snapNum = int(args.snapNum) illustris_path = paths.illustris_path if args.TNG: illustris_path = paths.TNG_path outpath = args.outpath if outpath is None: if args.TNG: outpath = paths.TNG_samplepath else: outpath = paths.illustris_samplepath foldername = subhaloID os.system('mkdir -p {}/{}'.format(outpath, foldername)) path = outpath + foldername os.system('mkdir -p {}/shape'.format(path)) subhalo = il.groupcat.loadSingle(illustris_path, snapNum, subhaloID=subhaloNum) # z = ui.snap2z(snapNum) hmr_star = subhalo['SubhaloHalfmassRadType'][4] / ui.h0 # / (1 + z) hmr_dark = subhalo['SubhaloHalfmassRadType'][1] / ui.h0 # / (1 + z) data_star = ui.getData(illustris_path, snapNum, subhaloNum, 4) data_dark = ui.getData(illustris_path, snapNum, subhaloNum, 1) Illustris.shape.getShape.run(data_star['Coordinates'] - data_star['SubhaloPos'], data_star['Masses'], hmr_star, data_dark['Coordinates'] - data_dark['SubhaloPos'], data_dark['Masses'], hmr_dark, path+'/shape/') Illustris.shape.plotShape.run(path+'/shape/')
def main(): parser = argparse.ArgumentParser() parser.add_argument('--subhaloID') parser.add_argument('--shape') parser.add_argument('--snapNum') parser.add_argument('--TNG', default=False, type=bool) parser.add_argument('--outpath', default=None) args = parser.parse_args() subhaloID = args.subhaloID subhaloNum = int(subhaloID[7:]) shape = args.shape snapNum = int(args.snapNum) outpath = args.outpath if outpath is None: if args.TNG: outpath = paths.TNG_samplepath else: outpath = paths.illustris_samplepath illustris_path = paths.illustris_path if args.TNG: illustris_path = paths.TNG_path os.system('mkdir -p {}/{}'.format(outpath, subhaloID)) path = outpath + subhaloID + '/' data = getData(illustris_path, snapNum, subhaloNum, 4) V2data = StarData_Beta(data['Coordinates'], data['Velocities'], data['Masses'], shape, xc=data['SubhaloPos']) # rmax = 30 rmax = data['HalfMassRad'] * 2.5 # R_bin, z_bin, phi_bin, a11, a12, a13, a22, a23, a33, v1, v2, v3, M, V, Npart = \ # measureV2map(V2data.xcyl, V2data.vcyl, V2data.mpartz) # beta = 1 - a33/a11 # np.save(path + 'V2tensor.npy', # [R_bin, z_bin, phi_bin, a11, a12, a13, a22, a23, a33, v1, v2, v3, beta, M, V, Npart]) R_bin, z_bin, phi_bin, a11, a12, a13, a22, a23, a33, v1, v2, v3, M, V, Npart = \ measureV2map(V2data.xcyl, V2data.vcyl, V2data.mpart, N_phibin = 1, Rb = rmax) beta = 1 - a33 / a11 f = open(path + 'V2tensor.txt', 'w') for i in range(len(R_bin)): f.write( '%.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2e %.2e %d \n' % (R_bin[i], z_bin[i], a11[i], a12[i], a13[i], a22[i], a23[i], a33[i], v1[i], v2[i], v3[i], beta[i], M[i], V[i], Npart[i])) f.close()
def main(): parser = argparse.ArgumentParser() parser.add_argument('--subhaloID') parser.add_argument('--shape') parser.add_argument('--snapNum') parser.add_argument('--TNG', default=False, type=bool) parser.add_argument('--outpath', default=None) args = parser.parse_args() subhaloID = args.subhaloID subhaloNum = int(subhaloID[7:]) shape = args.shape snapNum = int(args.snapNum) outpath = args.outpath if outpath is None: if args.TNG: outpath = paths.TNG_samplepath else: outpath = paths.illustris_samplepath illustris_path = paths.illustris_path if args.TNG: illustris_path = paths.TNG_path os.system('mkdir -p {}/{}'.format(outpath, subhaloID)) path = outpath + subhaloID + '/' fig = plt.figure(figsize=(8, 8)) ax = fig.add_subplot(111) fig.subplots_adjust(bottom=0.1) data = getData(illustris_path, snapNum, subhaloNum, 4) plotdata = PlotVEMap(data['Coordinates'], data['Velocities'], data['Masses'], shape, xc=data['SubhaloPos']) fig = plotdata.plotVE(fig=fig, ax=ax) fig.text(0.5, 0.9, 'subhalo' + str(subhaloNum) + ' (%s)' % shape, horizontalalignment='center', fontsize=20) fig.savefig(path + 'VE.eps', dpi=300) plt.close(fig)
def main(): parser = argparse.ArgumentParser() parser.add_argument('--subhaloID') parser.add_argument('--shape') parser.add_argument('--snapNum') parser.add_argument('--TNG', default = False, type = bool) parser.add_argument('--outpath', default = None) args = parser.parse_args() subhaloID = args.subhaloID subhaloNum = int(subhaloID[7:]) shape = args.shape snapNum = int(args.snapNum) outpath = args.outpath if outpath is None: if args.TNG: outpath = paths.TNG_samplepath else: outpath = paths.illustris_samplepath illustris_path = paths.illustris_path if args.TNG: illustris_path = paths.TNG_path os.system('mkdir -p {}/{}'.format(outpath,subhaloID)) path = outpath + subhaloID + '/' fig = plt.figure(figsize = (8,4)) ax1 = fig.add_axes([0.02, 0.08, 0.35, 0.7], projection='polar') cax1 = fig.add_axes([0.4, 0.12, 0.02, 0.65]) ax2 = fig.add_axes([0.39, 0.12, 0.65, 0.65]) cax2 = fig.add_axes([0.9, 0.12, 0.02, 0.65]) data = getData(illustris_path, snapNum, subhaloNum, 4) plotdata = PlotBetaMap(data['Coordinates'], data['Velocities'], data['Masses'], shape, xc=data['SubhaloPos']) fig = plotdata.map_equ(20., fig = fig, ax = ax1, cax = cax1) fig = plotdata.map_meri(20., fig = fig, ax = ax2, cax = cax2) fig.text(0.5, 0.9, 'subhalo' + str(subhaloNum) + ' (%s)' % shape, horizontalalignment = 'center', fontsize = 20) fig.savefig(path + 'beta.eps', dpi=300) plt.close(fig)
def main(): parser = argparse.ArgumentParser() parser.add_argument('--subhaloID') parser.add_argument('--snapNum') parser.add_argument('--rotation') # oblate or prolate rotation parser.add_argument('--phi') # let's input in units of degrees parser.add_argument('--inc') parser.add_argument('--pa', default=500) parser.add_argument('--TNG', default=False, type=bool) parser.add_argument('--outpath', default=None) parser.add_argument('-i', action='store_false', dest='iteration', default=True, help='Iteration fit') parser.add_argument('-c', action='store_true', dest='circle', default=False, help='use circlular aperture') args = parser.parse_args() subhaloID = args.subhaloID subhaloNum = int(subhaloID[7:]) snapNum = int(args.snapNum) rotation = args.rotation phi = float(args.phi) inc = float(args.inc) pa = float(args.pa) illustris_path = paths.illustris_path if args.TNG: illustris_path = paths.TNG_path outpath = args.outpath if outpath is None: if args.TNG: outpath = paths.TNG_savepath + '/data/snap%03d/' % snapNum else: outpath = paths.illustris_savepath + '/data/snap%03d/' % snapNum foldername = subhaloID + '_p' + args.phi + '_i' + args.inc os.system('mkdir -p {}/{}'.format(outpath, foldername)) path = outpath + foldername os.system('mkdir -p {}/imgs'.format(path)) os.system('mkdir -p {}/mge'.format(path)) os.system('mkdir -p {}/ifu'.format(path)) data = ui.getData(illustris_path, snapNum, subhaloNum, 4) Illustris.mock.makeImg.run(data['Coordinates'], data['Velocities'], data['Masses'], data['GFM_StellarPhotometrics'], data['GFM_Metallicity'], rotation, phi, inc, pa, path + '/imgs/') Illustris.mock.makeMGE.run(path + '/imgs/img_M.npy', path + '/mge/', args.iteration) Illustris.mock.makeIFUbins.run(path + '/imgs/img_ifu.npy', path + '/imgs/img_M.npy', path + '/mge/mge.npy', path + '/ifu/', circle=args.circle) Illustris.mock.makeIFUdata.run(path + '/ifu/', path + '/imgs/') Illustris.mock.dumpIFUdata.run(path + '/ifu/') Illustris.mock.v_plot.run(path + '/ifu/')