pdspy.modeling¶
Model¶
- class pdspy.modeling.Model¶
A class that can be used to set up a generic model with arbitrary coordinates and densities.
- Base Attributes:
grid(Grid):The Grid object that contains information about the 3D spatial distribution of the material in the system.
images(dict):A dictionary containing the radiative transfer model images that have been generated for the model.
spectra(dict):A dictionary containing the radiative transfer model spectra that have been generated for the model.
visibilities(dict):A dictionary containing the radiative transfer model visibilities that have been generated for the model.
- read(filename=None, usefile=None)¶
Read a model in from an HDF5 model file.
- Args:
filename(str, optional):The filename of the file storing the model to read in. Default: None
usefile(h5py.File, optional):If
filename = None, then use this keyword to provide an instance of anh5py.Filethat has already be opened that the model can be read from.
- run_image(name=None, nphot=1000000.0, code='radmc3d', **keywords)¶
Run an image of the model.
- Args:
name(str, optional):The name of the image, to use as a key in the
Model.imagesdictionary. Default: Nonenphot(int, optional):The number of photons to use for the calculation. Default: 1e6
code(str, optional):Which underlying radiative transfer modeling code to use for the radiative equilibrium calculation. radmc3d or hyperion. Default: radmc3d
kwargs(optional):Can be used to pass arguments to either
Model.run_scattering_hyperionorModel.run_scattering_radmc3d, depending on the value ofcode.
- run_image_hyperion(nphot=1000000.0, mrw=False, pda=False, niterations=20, percentile=99.0, absolute=2.0, relative=1.02, max_interactions=100000000.0, mpi=False, nprocesses=None, sublimation_temperature=None, verbose=True, incl=45, pa=45, dpc=1, lam=1300.0, track_origin='basic', nphot_imaging=1000000.0, name=None, npix=256, pixelsize=1.0)¶
Run the radiative equilibrium calculation using the Hyperion radiative transfer code. As a result, the Model.grid.temperature list will be populated with the temperatures calculated.
- Args:
name(str, optional):The name of the spectrum, to use as a key in the
Model.spectradictionary. Default: Nonenphot(int, optional):The number of photons to use for the calculation. Default: 1e6
mrw(bool, optional):If using hyperion, whether or not to use the Modified Random Walk Algorithm. Default: False
pda(bool, optional):If using hyperion, whether or not to use the Partial Diffusion Approximation algorithm. Default: False
niterations(int, optional):The maximum number of iterations to perform, if convergence is not reached, before giving up. Default: 20
percentile(float, optional):Which percentile of cells to use when calculating the convergence criteria. Default: 99.
absolute(float, optional):Maximum absolute difference of the ratio between cells for convergence to be reached. Default: 2.0
relative(float, optional):Relative difference between cells for convergence to be reached. Default: 1.02
max_interactions(int, optional):Maximum number of interactions a photon can have before it is killed. Default: 1e8
mpi(bool, optional):If using hyperion, whether or not to run the model in parallel with MPI. Default: False
nprocesses(bool, optional):If mpi=True, the number of MPI threads to use. Default: None
sublimation_temperature(float, optional):If you would like to sublimate dust above a certain temperature, set that here. Default: None
verbose(bool, False):Should output be printed to the screen, or hidden. Default: False
incl(float, optional):The inclination of the model to use for the image. Default: 0.
pa(float, optional):The position angle to use for the image. Default: 0.
dpc(float, optional):The distance to the model in units of parsecs. Default: 1.
lam(float, optional):The wavelength, in microns, to make the image at. Default: 1300.
nphot_imaging(float, optional):The number of photons to use in making the image. Default: 1e6
npix(int, optional):The number of pixels (squared) that the image should have. Default: 256
pixelsize(float, optional):The size of the pixels, in arcseconds. Default: 1.
- run_scattering(nphot=1000000.0, code='radmc3d', **keywords)¶
Run a scattering phase function calculation for the model.
- Args:
nphot(int, optional):The number of photons to use for the calculation. Default: 1e6
code(str, optional):Which underlying radiative transfer modeling code to use for the radiative equilibrium calculation. radmc3d or hyperion. Default: radmc3d
kwargs(optional):Can be used to pass arguments to either
Model.run_scattering_hyperionorModel.run_scattering_radmc3d, depending on the value ofcode.
- run_scattering_radmc3d(nphot=1000000.0, verbose=True, nice=None, loadlambda=None, **keywords)¶
Run a scattering phase function calculation using the RADMC-3D radiative transfer code. As a result, the Model.grid.scattering_phase list will be populated with the scattering phase functions calculated.
- Args:
nphot(int, optional):The number of photons to use for the calculation. Default: 1e6
verbose(bool, False):Should output be printed to the screen, or hidden. Default: False
loadlambda(bool, optional):If True, use the
Model.camera_wavelengtharray as the list of wavelengths for the scattering phase function calculation. If None, use theModel.grid.lam array. Default: None**keywords(optional):This can be used to pass any options to RADMC-3D. For a list of all possibilities for the scattering phase function code, check the RADMC-3D documentation. Two commonly used ones are described below.
setthreads(int, optional):The number of OpenMP threads to use. Default: 1
- run_sed(name=None, nphot=1000000.0, code='radmc3d', **keywords)¶
Run a spectrum of the model.
- Args:
name(str, optional):The name of the spectrum, to use as a key in the
Model.spectradictionary. Default: Nonenphot(int, optional):The number of photons to use for the calculation. Default: 1e6
code(str, optional):Which underlying radiative transfer modeling code to use for the radiative equilibrium calculation. radmc3d or hyperion. Default: radmc3d
kwargs(optional):Can be used to pass arguments to either
Model.run_sed_hyperionorModel.run_sed_radmc3d, depending on the value ofcode.
- run_sed_radmc3d(name=None, nphot=1000000.0, incl=0, pa=0, phi=0, dpc=1, loadlambda=False, verbose=True, nice=None, **keywords)¶
Run a spectrum of the model with RADMC-3D. As a result, the
Model.spectradictionary will have apdspy.spectroscopy.Spectrumadded with key name.- Args:
name(str, optional):The name of the spectrum, to use as a key in the
Model.spectradictionary. Default: Nonenphot(int, optional):The number of photons to use for the calculation. Default: 1e6
incl(float, optional):The inclination of the model to use for the image. Default: 0.
loadlambda(bool, optional):If True, use the
Model.camera_wavelengtharray as the list of wavelengths for the scattering phase function calculation. If False, use theModel.grid.lam array. Default: Falsecode(str, optional):Which underlying radiative transfer modeling code to use for the radiative equilibrium calculation. radmc3d or hyperion. Default: radmc3d
kwargs(optional):Can be used to pass arguments to RADMC-3D. This can be used to pass any options to RADMC-3D. For a list of all possibilities for spectra, check the RADMC-3D documentation.
- run_thermal(nphot=1000000.0, code='radmc3d', **keywords)¶
Run the radiative equilibrium calculation for the model.
- Args:
nphot(int, optional):The number of photons to use for the calculation. Default: 1e6
code(str, optional):Which underlying radiative transfer modeling code to use for the radiative equilibrium calculation. radmc3d or hyperion. Default: radmc3d
kwargs(optional):Can be used to pass arguments to either
Model.run_thermal_hyperionorModel.run_thermal_radmc3d, depending on the value ofcode.
- run_thermal_hyperion(nphot=1000000.0, mrw=False, pda=False, niterations=20, percentile=99.0, absolute=2.0, relative=1.02, max_interactions=100000000.0, mpi=False, nprocesses=None, sublimation_temperature=None, verbose=True, timeout=3600, increase_photons_until_convergence=False)¶
Run the radiative equilibrium calculation using the Hyperion radiative transfer code. As a result, the Model.grid.temperature list will be populated with the temperatures calculated.
- Args:
nphot(int, optional):The number of photons to use for the calculation. Default: 1e6
mrw(bool, optional):If using hyperion, whether or not to use the Modified Random Walk Algorithm. Default: False
pda(bool, optional):If using hyperion, whether or not to use the Partial Diffusion Approximation algorithm. Default: False
niterations(int, optional):The maximum number of iterations to perform, if convergence is not reached, before giving up. Default: 20
percentile(float, optional):Which percentile of cells to use when calculating the convergence criteria. Default: 99.
absolute(float, optional):Maximum absolute difference of the ratio between cells for convergence to be reached. Default: 2.0
relative(float, optional):Relative difference between cells for convergence to be reached. Default: 1.02
max_interactions(int, optional):Maximum number of interactions a photon can have before it is killed. Default: 1e8
mpi(bool, optional):If using hyperion, whether or not to run the model in parallel with MPI. Default: False
nprocesses(bool, optional):If mpi=True, the number of MPI threads to use. Default: None
sublimation_temperature(float, optional):If you would like to sublimate dust above a certain temperature, set that here. Default: None
verbose(bool, False):Should output be printed to the screen, or hidden. Default: False
- run_thermal_radmc3d(nphot=1000000.0, verbose=True, timelimit=7200, nice=None, **keywords)¶
Run the radiative equilibrium calculation using the RADMC-3D radiative transfer code. As a result, the Model.grid.temperature list will be populated with the temperatures calculated.
- Args:
nphot(int, optional):The number of photons to use for the calculation. Default: 1e6
verbose(bool, False):Should output be printed to the screen, or hidden. Default: False
**keywords(optional):This can be used to pass any options to RADMC-3D. For a list of all possibilities for the thermal code, check the RADMC-3D documentation. Two commonly used ones are described below.
modified_random_walk(bool, optional):If using radmc3d, whether or not to use the Modified Random Walk Algorithm. Default: False
setthreads(int, optional):The number of OpenMP threads to use. Default: 1
- run_visibilities(name=None, nphot=1000000.0, code='radmc3d', **keywords)¶
Run visibilities for the model.
- Args:
name(str, optional):The name of the visibilities, to use as a key in the
Model.visibilitiesdictionary. Default: Nonenphot(int, optional):The number of photons to use for the calculation. Default: 1e6
code(str, optional):Which underlying radiative transfer modeling code to use for the radiative equilibrium calculation. radmc3d or hyperion. Default: radmc3d
kwargs(optional):Can be used to pass arguments to either
Model.run_scattering_hyperionorModel.run_scattering_radmc3d, depending on the value ofcode.
- set_camera_wavelength(lam)¶
Set the wavelengths that the camera should use for generating images, visibilities, and spectra.
- Args:
lam(numpy.ndarray n):The array of wavelengths, in microns.
- write(filename=None, usefile=None)¶
Write a model to an HDF5 model file.
- Args:
filename(str, optional):The filename of the file that will be written out with the model. Default: None
usefile(h5py.File, optional):If
filename = None, then use this keyword to provide an instance of anh5py.Filethat has already be opened that the model can be written to.