예제 #1
0
def moment(co=True, c18o=True, c16o=True):
	liste = np.array([])
	liste_nom=[]
	
	if c18o:
		liste = np.append(liste, mcfost.Line("./data_C18O"))
		liste_nom.append('image_c18o')
	if c16o:
		liste = np.append(liste, mcfost.Line("./data_13C16O"))
		liste_nom.append('image_13co')
	if co:
		liste = np.append(liste, mcfost.Line("./data_CO"))
		liste_nom.append('image_co')
	
	vel = liste[0].velocity
	vel = vel[2:-2:2]
	im  = np.zeros((len(vel), 801,801))
	
	for j in range (0, len(vel)):
		print(vel[j])
		im_j = liste[0].plot_map(psf_FWHM=0.1, Delta_v=0.09, v=vel[j], i=2, substract_cont=True, cmap='nipy_spectral')
		im[j,:,:] = im_j[:,:]

	dv       = vel[1] - vel[0]
	moment_0 = np.sum(im, axis=0) * dv
	a        = np.sum(im[:, :, :] * vel[:, np.newaxis, np.newaxis], axis=0) * dv
	moment_1 = np.divide(a, moment_0, out=np.zeros_like(a), where=moment_0!=0)
	
	plt.show()
            
	return moment_0, moment_1
예제 #2
0
def import_donnees(simu, co=True, c18o=True, c16o=True):
    liste = np.array([])
    liste_nom = []

    if co:
        liste = np.append(liste, mcfost.Line("./data_CO"))
        liste_nom.append('image_co')
    if c18o:
        liste = np.append(liste, mcfost.Line("./data_C18O"))
        liste_nom.append('image_c18o')
    if c16o:
        liste = np.append(liste, mcfost.Line("./data_13C16O"))
        liste_nom.append('image_13co')

    vel = liste[0].velocity[140:261:2]
    print(vel)

    for i in range(0, len(liste_nom)):
        im = np.zeros((len(vel), 401, 401))
        #fig, axes = plt.subplots(1,1)
        for j in range(0, len(vel)):
            no_ylabel = False
            colorbar = False
            if j > 0:
                no_ylabel = True
            if j == 2:
                colorbar = True
            im_j = liste[i].plot_map(Tb=True,
                                     title=liste_nom[i],
                                     psf_FWHM=0.1,
                                     Delta_v=0.09,
                                     v=vel[j],
                                     i=2,
                                     substract_cont=True,
                                     no_ylabel=no_ylabel,
                                     colorbar=colorbar,
                                     cmap='nipy_spectral',
                                     plot_stars=False)
            im[j, :, :] = im_j[::2, ::2]

        print(np.shape(im),
              np.shape(liste[0].lines[0, 2, 0, 140:261:2, ::2, ::2]))
        plt.show()

    #np.savetxt(simu+"donnees_co", np.column_stack((liste[0].lines[0,2,0,::20,::2,::2])), header = "i=45 deg")
    np.savetxt(simu + "reel_cont_13co",
               np.column_stack((im)),
               header="continu 45 deg, convolue psf_FWHM=0.1, Delta_v=0.09")

    #np.savetxt(simu+"vel_reel", np.column_stack((vel)), header="velocite des channels")

    return
        pymcfost_objects = dict()

        for time in TIMES:
            pymcfost_objects[time] = dict()

            for inclination in INCLINATIONS:
                data_directory = ROOT_DATA_DIRECTORY / (
                    'b' + beta + '/t' + time + '/i' + inclination + '/data_' + radiation
                )

                if data == 'Image':
                    pymcfost_objects[time][inclination] = mcfost.Image(data_directory)

                elif data == 'Line':
                    pymcfost_objects[time][inclination] = mcfost.Line(data_directory)

        plotting_options = opts[itype]

        if data == 'Image':

            figure, axes = pymcfost_subplots.plot_figure(
                pymcfost_objects=pymcfost_objects,
                plotting_options=plotting_options,
                text=text,
                positions=positions,
                colorbar_figure=COLORBAR_FIGURE,
            )

            filename = itype + '_b' + beta + '_' + radiation + '.pdf'
            figures = [figure]
예제 #4
0
import pymcfost as pym
import matplotlib.pyplot as plt

data = pym.Line('data_CO')

nrows = 1
ncols = 4

plt.rcParams.update(plt.rcParamsDefault)
plt.rcParams['text.usetex'] = True

fig, allAxes = plt.subplots(nrows=nrows,
                            ncols=ncols,
                            sharey='row',
                            figsize=(4 * ncols, 5 * nrows),
                            sharex='col',
                            dpi=200)

limits = [-0.8, 0.8, -0.8, 0.8]

h1 = data.plot_map(moment=0,
                   substract_cont=True,
                   plot_stars=True,
                   no_xlabel=False,
                   iaz=0,
                   colorbar=False,
                   ax=allAxes[0],
                   limits=limits,
                   bmaj=0.05,
                   bmin=0.05,
                   bpa=0,