A spherical polar grid.
The grid can be initialized by passing the r, theta, and phi coordinates of cell walls:
>>> grid = SphericalPolarGrid(r_wall, t_wall, p_wall)
where r_wall, t_wall, and p_wall are 1-d sequences of wall positions. The number of cells in the resulting grid will be one less in each dimension that the length of these arrays.
SphericalPolarGrid objects may contain multiple quantities (e.g. density, specific energy). To access these, you can specify the name of the quantity as an item:
>>> grid['density']
which is no longer a SphericalPolarGrid object, but a SphericalPolarGridView object. When setting this for the first time, this can be set either to another SphericalPolarGridView object, an external h5py link, or an empty list. For example, the following should work:
>>> grid['density_new'] = grid['density']
SphericalPolarGridView objects allow the specific dust population to be selected as an index:
>>> grid['density'][0]
Which is also a SphericalPolarGridView object. The data can then be accessed with the array attribute:
>>> grid['density'][0].array
which is a 3-d array of the requested quantity.
Methods
set_walls(r_wall, t_wall, p_wall) | |
read(group[, quantities]) | Read the geometry and physical quantities from a spherical polar grid |
read_geometry(group) | Read in geometry information from a spherical polar grid |
read_quantities(group[, quantities]) | Read in physical quantities from a spherical polar grid |
write(group[, quantities, copy, ...]) | Write out the spherical polar grid |
write_single_array(group, name, array[, ...]) | Write out a single quantity, checking for consistency with geometry |
add_derived_quantity(name, function) |
Methods (detail)
Read the geometry and physical quantities from a spherical polar grid
Parameters : | group : h5py.Group
quantities : ‘all’ or list
|
---|
Read in geometry information from a spherical polar grid
Parameters : | group : h5py.Group
|
---|
Read in physical quantities from a spherical polar grid
Parameters : | group : h5py.Group
quantities : ‘all’ or list
|
---|
Write out the spherical polar grid
Parameters : | group : h5py.Group
quantities : ‘all’ or list
copy : bool
absolute_paths : bool
compression : bool
wall_dtype : type
physics_dtype : type
|
---|
Write out a single quantity, checking for consistency with geometry
Parameters : | group : h5py.Group
name : str
array : np.ndarray
copy : bool
absolute_paths : bool
compression : bool
wall_dtype : type
physics_dtype : type
|
---|
Methods
append(grid) | Used to append quantities from another grid |
add(grid) | Used to add quantities from another grid |
Methods (detail)
Used to append quantities from another grid
Parameters : | grid : 3D Numpy array or SphericalPolarGridView instance
|
---|
Used to add quantities from another grid
Parameters : | grid : 3D Numpy array or SphericalPolarGridView instance
|
---|