Code Documentation

Modules

cloudmodel.MCMole3D module

class cloudmodel.MCMole3D.Cloud(idcloud, x1, x2, x3, size=None, em=None)[source]

Bases: object

Object encoding the properties of each cloud, i.e.:

  • \((R,\phi, z )\) the Galactic coordinates of the center of the cloud, in units of \((kpc, rad, kpc)\);
  • \((d_{\odot},\ell, b )\) the position referred in the Solar system frame in units of \((kpc, rad,rad)\);
  • \(\epsilon\), the emissivity in the center in units of \(K km/s\)
  • \(L\) the cloud size in units of \(pc\)
assign_sun_coord(d, latit, longit)[source]
emissivity(R)[source]

replicating the profile in eq.(3) of Puglisi+ 2017

print_cloudinfo()[source]
size_function(R)[source]

Compute the size in a very wide range of cloud sizes \([s_1,s_2] pc\), from random numbers following the probability distribution function coming from the cloud size function eq.(4) of Puglisi+ 2017. We split it in two parts :

  • if \(L>s_0\) a decreasing power-law distribution has been assumed with spectral index \(a_L=0.8\) (see Heyer Dame 2015).
  • Otherwise In the outer Galaxy a lower spectral index has been measured \(a_L=3.3\), whereas in the inner Galaxy a steeper one \(a_L=3.9\).
class cloudmodel.MCMole3D.Cloud_Population(N_clouds, model, randseed=False)[source]

Bases: object

class encoding a list of Clouds objects. It is initialized by setting the total number of clouds and the geometry you may want to distribute them. It contains N_clouds Cloud objects.

cartesianize_coordinates(array)[source]

convert arrays of cylindrical ( spherical if a Spherical distribution is chosen ) coordinates to cartesian ones. It exploits astropy routines.

compute_healpix_vec()[source]

convert galactic latitude and longitude positions in healpy mapping quantinties: position vectors.

emissivity[source]
get_pop_emissivities_sizes()[source]

Looping into the clouds of this class it returns the emissivity and size of each cloud.

heliocentric_coordinates()[source]

convert Galactocentric coordinates to heliocentric ones

initialize_cloud_population_from_output(filename)[source]

read from an hdf5 output file the cloud catalog and assign values

plot_3d_population(figname=None)[source]

Makes density contour plots of all the cloud population.

Note

Set figname to the path of your file where to save the plot, otherwise it outputs to screen.

plot_histogram_population(figname=None)[source]

Makes histograms of all over the population of clouds to check the probability density functions (PDF) of the coordinates \(R_{gal}, z, d_{\odot}, \ell\).

Note

Set figname to the path of your file where to save the plot, otherwise it outputs to screen.

plot_radial(X, ylabel, figname=None, color='b')[source]

Plot a quantity X which may variates across the Galactic radius \(R_{gal}\). (e.g. the midplane thickness, the emissivity profile,etc...)

Note

Set figname to the path of your file where to save the plot, otherwise it outputs to screen.

print_parameters()[source]

print the parameters set for the simulation

print_pop()[source]

Output on screen the whole Monte-Carlo catalogue of molecular clouds

read_pop_fromhdf5(filename)[source]

Read from an hdf5 file the cloud population. the Cloud_Population is thus initialized by initialize_cloud_population_from_output()

set_parameters(radial_distr=[5.3, 2.5, 3], emissivity=[60, 3.59236], thickness_distr=[0.1, 9.0], typical_size=10.0, size_range=[0.3, 30])[source]

Set key-parameters to the population of clouds.

  • radial_distr:{list}

    \((\mu_R,FWHM_R, R_{bar})\) parameters to the Galactic radius distribution of the clouds, assumed Gaussian. The last parameters is the postition of the bar tip. Default \(\mu_R= 5.3 \, ,\sigma_R=FWHM_R/\sqrt(2 \ln 2)= 2.12,\, R_{bar}=3 \, kpc\).

  • thickness_distr:{list}

    \((FWHM_{z,0}, R_{z,0})\) parameters to the vertical thickness of the Galactic plane increasing in the outer Galaxy with \(\sigma(z)=sigma_z(0) *cosh(R/R_{z,0})\). Default \(\sigma_{z,0}=0.1 \, , R_{z,0}=9\) kpc.

  • emissivity:{list}

    Parameters to the emissivity radial profile, \(\epsilon(R)= \epsilon_0 \exp(- R/R_0)\). Default Heyer and Dame 2015 values : \(\epsilon_0=60\, K km/s,\, R_0=3.6 \, kpc\).

  • typical_size: {scalar}

    Typical size of molecular clouds where we observe the peak in the size distribution function. Default \(L_0=10\) pc.

sizes[source]
write2hdf5(filename)[source]

Write onto an hfd5 file the whole catalogue

class cloudmodel.MCMole3D.Collect_Clouds(N_pops, model, Ncl=4000, filestring=None)[source]

Bases: cloudmodel.MCMole3D.Cloud_Population

List of Cloud_population classes . Read from output

concatenate_arrays()[source]

Concatenate arrays of several Cloud_Population objects to process all of these quantities together

write2hdf5(filename)[source]

Write onto an hfd5 file the whole catalogue

cloudmodel.mapping module

cloudmodel.mapping.cosine_apodization(x, d)[source]

Smooth the emissivity of the cloud with a cosine function, with the following relation:

\[\epsilon(x) = \epsilon_c \cos ( frac{\pi}{2} frac{x}{d})\]

here \(d\) is the border of the cloud, i.e. the radius of the cloud, in such a way that the \(\epsilon(d)=0\).

cloudmodel.mapping.distance_from_cloud_center(theta, phi, theta_c, phi_c)[source]

given a position of one pixel \((theta,\phi)\) within the cloud compute the arclength of the pixel from the center, onto a unitary sphere. by considering scalar products of vectors to the points on the sphere to get the angle \(\psi\) between them. This routine is exploited by do_healpy_map().

see for reference : Arclength on a sphere

cloudmodel.mapping.do_healpy_map(Pop, nside, fname, apodization='gaussian', polangle=None, depol_map=None, p=0.01, highgalcut=0.0)[source]

Projects the cloud population into an healpy map as seen as an observer in the solar circle.

Parameters

  • Pop :

    MCMole3D.Cloud_Population

  • nside:{int}

    Healpix grid parameter

  • fname:{str}

    path to the fits file where to store the map

  • apodization:{str}

    profile of the cloud (either gaussian or cos)

  • polangle:{np.array or map}

    the angle of polarization

  • depol_map:{map}

    the depolarization map due to line of sight effects

  • p: {float}

    polarization fraction ( default 1%)

  • highgalcut: {float}

    angle in radians to exclude clouds at high galactic latitudes, sin(b)<= sin(angle);

Note

if polangle is set this routine produces even polarization maps, i.e. the Q and U Stokes parameters.

cloudmodel.mapping.gaussian_apodization(x, d)[source]

Smooth the emissivity of the cloud with a gaussian profile, centered in the center of the cloud and with sigma defined in such a way that:

\[d = 6 \sigma\]

where \(d\) is the border of the cloud, coinciding with size of the cloud.

cloudmodel.utils module

cloudmodel.utils.integrate_intensity_map(Imap, nside, latmin=-2, latmax=2.0, nsteps_long=500, rad_units=False, planck_map=False)[source]

Compute the integral of the intensity map along latitude and longitude; to compare observed intensity map and the model one. To check consistency of the model we compute the integral as in eqs.(6) and (7) of Puglisi+ 2017.

Parameters

  • Imap:{array}

    intensity map

  • nside: {int}

    healpy gridding parameter

  • latmin, latmax:{double}

    minimum and maximum latitudes in degree where to perform the integral (default \(\pm 2\, deg\)) if you have the angles in radiants set rad_units to True.

  • nsteps_long:{int}

    number of longitudinal bins, (default 500)

  • planck_map:{bool}

    if set to True, it sets to zero all the healpy.UNSEEN masked pixels of the map, (useful when dealing with observational maps).

Returns

  • I_l :{array}

    latitude integration within the set interval \([b_{min}, b_{max}]\)

  • I_tot:{double}

    integration of I_l in \(\ell \in [0,2 \pi]\).

cloudmodel.utils.log_spiral_radial_distribution2(rbar, phi_bar, n, rloc, sigmar)[source]

values of pitch angle from Vallee‘2015 \(i=12\) deg.

Parameters

  • rbar: {float}

    Galactic radius [kpc] where the bar begins

  • phi_bar: {float}

    angle \(\phi_0\) of the bar tip

  • n:{int}

    number of clouds to be distributed following the logspiral geometry

  • rloc,`sigmar`:{floats}

    Location and width of molecular ring in kpc.

Return

  • r, phi: {arrays}

    array (n-size) of galactic radii and azimut angle following a logspiral distribution

cloudmodel.utils.pixelsize(nside, arcmin=True)[source]

Given a nside healpy gridding parameter returns the pixel size of the chosen pixelization in arcmin (or in radians if arcmin= False)

cloudmodel.utils.plot_2powerlaw_size_function(s0, s1, s2, figname=None)[source]

Plot histograms and Probability function of the cloud size function as explained in eq.(4) and (5) of Puglisi+ 2017.

It is defined by three parameters : s0, s1,`s2`, being respectively the, typical cloud size (where the size function peaks), the minimum and the maximum sizes. Thus \(s_1<s_0<s_2\).

Note

Set figname to the path of your file where to save the plot, otherwise it outputs to screen.

cloudmodel.utils.plot_intensity_integrals(obs_I, mod_I, model=None, figname=None)[source]
Plot the intensity integrals computed with integrate_intensity_map() for both

the obseverved maps(obs_I) and the one simulated with MCMole3D mod_I.

Note

  • Set figname to the path of your file where to save the plot, otherwise it outputs to screen.
  • Set model to put the title and the

Module contents