2D Interface

This module provides some utility routines to generate input files for the ProDiMo 2D interface.
See also the example notebook
ProDiMo 2D interface example
.
class
prodimopy.interface2D.infile.
DustSizeDistribution
(
asize
,
fsize_rho
)
[source]

Bases:
object
Helper data container for the dust size distribution.
The assumption here is that all grains have the same grain mass density (i.e. only one population but with different sizes).
asize
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]

the dust grain size (radius). UNIT: cm, DIM: NSIZE (number of grain sizes)
fsize_rho
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]

Grain size distribution function in absolute numbers.  UNIT: g cm
-3
, DIM: (NSIZE,NX,NZ)
fill_pmodel
(
pmodel
)
[source]

Fills the dust data from the given dust size distribution.
In particular it initializes
pmodel.dust
.
Parameters
:
pmodel
(
Data_ProDiMo
) – The ProDiMo model object.
class
prodimopy.interface2D.infile.
Interface2Din
(
x
,
z
,
rhoGas
=
None
,
nHtot
=
None
,
velocity
=
None
,
g2d
=
None
,
tdust
=
None
,
tgas
=
None
,
dustSDF
=
None
)
[source]

Bases:
object
Some utility class to generate input files for the
ProDiMo
2D interface.
Parameters
:
x
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
) – the x (radial coordinates) in cm. DIM: (NX,NZ)
z
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
) – the z (vertical coordinates) in cm. DIM: (NX,NZ)
rhoGas
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
) – gas density in g cm
-3
. Either
nHtot
or
rhoGas
have to be provided. DIM: (NX,NZ)
nHtot
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
) – hydrogen number density in (cm
-3
velocity
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
) – velocity field (vx,vy,vz) in cm/s
g2d
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
) – gas to dust mass ratio
tdust
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
) – dust temperature in K
tgas
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
) – gas temperature in K
dustSDF
(
DustSizeDistribution
|
None
) – The dust size distribution function
nx
:
int

number of x grid points
nz
:
int

number of z grid points
x
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]

x coordinates in cm (Cartesian)
z
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]

z coordinates in cm (Cartesian)
rhoGas
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None

gas density in g cm
-3
nHtot
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None

total hydrogen number density in cm
-3
velocity
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None

velocity vector vx,vy,vz in cm s
-1
g2d
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None

Gas to dust mass ratio at every point.
tdust
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None

Dust temperature in K.
tgas
:
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None

Gas temperature in K.
dustSDF
:
DustSizeDistribution
|
None

Dust size distribution function
interpol_spherical
(
pmodel
,
imethod
=
'linear'
,
fixmethod
=
1
)
[source]

Interpolation onto the
ProDiMo
assuming the input grid was spherical.
E.g. the routines tries to deal with the curvatures at the inner and outer edge.
Parameters
:
pmodel
(
Data_ProDiMo
) – the prodimopy model onto which the input structure should be interpolated.
imethod
(
str
) – interpolation method passed to
scipy.interpolate.griddata
.
fixmethod
(
int
) –
Method to fix some problems in the interpolated grid. Doesn’t necessarily work well, so if you don’t need it don’t use it.
0 or None: no fixing
1: fix vertical columns first (density should always increase towards midplane), Default.
2: similar to 1 but different approach (not sure any more)
3: fix only the azimuthal velocity vy (should never be negative in the disk region)
toProDiMo
(
pmodel
,
outdir
=
'.'
,
imethod
=
'linear'
,
fixmethod
=
1
)
[source]

Interpolates the given density/velocity structure onto the
ProDiMo
grid and writes
the input files for ProDimo.
The new quantities are written into a copy of
pmodel
and returned.
Parameters
:
pmodel
(
Data_ProDiMo
) – the prodimopy model onto which the input structure should be interpolated.
outdir
(
str
) – output directory where the
ProDiMo
input files are written to.
imethod
(
str
) – interpolation method passed to
scipy.interpolate.griddata
.
For details see
interpol_spherical()
.
fixmethod
(
int
) – method used to fix the input structure after interpolation.
For details see
interpol_spherical()
.
Return type
:
Data_ProDiMo
write_text
(
prhoGas
,
pnHtot
,
pvel
,
pg2d
,
ptdust
,
ptgas
,
pDustSizeDistribution
,
outdir
)
[source]

Write the input files for
ProDiMo
in text format.
All generated files have the prefix
pluto_
and the postfix
.dat
.
Parameters
:
outdir
(
str
) – The output directory (e.g. your initial ProDiMo model).
prhoGas
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
)
pnHtot
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
)
pvel
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
)
pg2d
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
)
ptdust
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
)
ptgas
(
ndarray
[
tuple
[
Any
,
...
]
,
dtype
[
float64
]
]
|
None
)
pDustSizeDistribution
(
DustSizeDistribution
|
None
)
write_fits
(
filename
=
'in2D.fits'
,
comments
=
None
)
[source]

NOT YET IMPLEMENTED!
Write the 2D data of this object as input for
ProDiMo
as a fits file.
Quantities that are
None
will be skipped.
Parameters
:
rhoGas
(
array_like
) – the gas density in g/cm3; DIMENSION: (nx,nz)
nHtot
(
array_like
) – the particle number density in g/cm3; DIMENSION: (nx,nz)
g2d
(
array_like
) – the gas to dust mass ratio; DIMENSION: (nx,nz)
velocity
(
array_like
) – disk velocity vector at each position in the disk vx,vy,vz in cm/s; DIMENSION: (nx,nz,3)
filename
(
str
) – the output filename/path optional.
comments
(
don't know yet
) – comments added to the fits file
get_pmodel
(
)
[source]

Returns the data as a
Data_ProDiMo
object.
Can be useful for plotting (e.g. use the prodimopy plotting routines)
Todo
something very similar is done in toProDiMo. Maybe that can be merged somehow.
Returns
:
the prodimopy representation of this 2D input structure.
Return type
:
Data_ProDiMo
prodimopy.interface2D.infile.
init_from_text
(
model
)
[source]

Reads the
pluto_*
files from the current model directory, fills a new
Interface2Din
object and returns it.
Parameters
:
model
(
Data_ProDiMo
) – A ProDiMo model object that is associated with the corresponding pluto files. (E.g. has the same grid etc.)
Return type
:
Interface2Din