model#
- class pinballrt.model.Model(grid: Grid, grid_kwargs={}, ncores=1, mpi=False)#
Initialize the Model with a grid and optional parameters.
- Parameters:
- gridGrid
The grid to use for the model.
- grid_kwargsdict, optional
Additional keyword arguments to pass to the grid constructor (default is an empty dictionary).
- ncoresint, optional
The number of CPU cores to use (default is 1).
- mpibool, optional
Whether to use mpi for parallel processing.
Methods Summary
set_physical_properties([density, ...])Set the physical properties of the grid.
add_sources(sources)Add sources to the grid.
thermal_mc(nphotons[, use_ml_step, Qthresh, ...])Perform a thermal Monte Carlo simulation.
scattering_mc(nphotons, wavelengths[, ...])Perform a scattering Monte Carlo simulation.
make_image([npix, pixel_size, channels, ...])Create an image from the dust distribution.
Methods Documentation
- set_physical_properties(density=None, dusttogasratio=0.01, dust=None, amax=None, p=None, gases=None, abundances=None, velocity=None, microturbulence=None)#
Set the physical properties of the grid.
- Parameters:
- densityastropy.units.Quantity, optional
The density to add to the grid.
- dusttogasratiofloat, optional
The dust-to-gas mass ratio. Default is 0.01.
- dustDust, optional
The dust distribution to use.
- amaxastropy.units.Quantity, optional
The maximum dust size of the dust in the grid. Can be specified as a single value to be constant over the grid, or as an array with a spatially varying value.
- pfloat or array-like, optional
The dust grain size distribution power-law slope. Can be specified as a single value to be constant over the grid, or as an array with a spatially varying value.
- gasesGas, optional
List of gas species to include in the grid.
- abundancesdict, optional
The abundances of the gas species.
- velocityastropy.units.Quantity, optional
The velocity field of the gas.
- microturbulenceastropy.units.Quantity, optional
The microturbulent velocity of the gas.
- add_sources(sources)#
Add sources to the grid.
- Parameters:
- sourceslist of Source objects
The sources to add to the grid.
- thermal_mc(nphotons, use_ml_step=False, Qthresh=2.0, Delthresh=1.1, p=99.0, device='cpu', return_timing=False, nbatch=1)#
Perform a thermal Monte Carlo simulation.
- Parameters:
- nphotonsint
The number of photons to simulate.
- Qthreshfloat, optional
The threshold for the quality factor (default is 2.0).
- Delthreshfloat, optional
The threshold for the temperature change (default is 1.1).
- pfloat, optional
The percentile to use for the temperature adjustment (default is 99.).
- devicestr, optional
The device to use for the simulation (default is “cpu”).
- scattering_mc(nphotons, wavelengths, device='cpu', return_timing=False, nbatch=1, set_grid_opacities=True)#
Perform a scattering Monte Carlo simulation.
- Parameters:
- nphotonsint
The number of photons to simulate.
- wavelengthsarray-like
The wavelengths to simulate.
- devicestr, optional
The device to use for the simulation (default is “cpu”).
- make_image(npix=100, pixel_size=None, channels=None, rest_frequency=None, incl=0, pa=0, distance=<Quantity 1. pc>, include_dust=True, include_gas=True, include_sources=True, nphotons=100000, device='cpu')#
Create an image from the dust distribution.
- Parameters:
- npixint or tuple, optional
The number of pixels in the image.
- pixel_sizeQuantity
The size of each pixel in the image. If none, will set the pixel size such that the image is 25% larger than the grid.
- channelsarray-like Quantity
The wavelengths, frequencies, or velocities to simulate.
- inclQuantity
The inclination angle of the image.
- paQuantity
The position angle of the image.
- distanceQuantity
The distance to the image plane.
- include_dustbool, optional
Whether to include dust in the image (default is True).
- include_gasbool, optional
Whether to include gas in the image (default is True).
- include_sourcesbool, optional
Whether to include sources in the image (default is True).
- nphotonsint, optional
The number of photons to use in the Monte Carlo simulation (default is 100000).
- devicestr, optional
The device to use for the simulation (default is “cpu”).