hyperion.grid.CylindricalPolarGrid¶
-
class
hyperion.grid.
CylindricalPolarGrid
(*args)¶ A cylindrical polar grid.
The grid can be initialized by passing the w, z, and phi coordinates of cell walls:
>>> grid = CylindricalPolarGrid(w_wall, z_wall, p_wall)
where
w_wall
,z_wall
, andp_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.CylindricalPolarGrid
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
CylindricalPolarGrid
object, but aCylindricalPolarGridView
object. When setting this for the first time, this can be set either to anotherCylindricalPolarGridView
object, an external h5py link, or an empty list. For example, the following should work:>>> grid['density_new'] = grid['density']
CylindricalPolarGridView
objects allow the specific dust population to be selected as an index:>>> grid['density'][0]
Which is also a
CylindricalPolarGridView
object. The data can then be accessed with thearray
attribute:>>> grid['density'][0].array
which is a 3-d array of the requested quantity.
Methods
set_walls
(w_wall, z_wall, p_wall)read
(group[, quantities])Read the geometry and physical quantities from a cylindrical polar grid read_geometry
(group)Read in geometry information from a cylindrical polar grid read_quantities
(group[, quantities])Read in physical quantities from a cylindrical polar grid write
(group[, quantities, copy, …])Write out the cylindrical 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)
-
set_walls
(w_wall, z_wall, p_wall)¶
-
read
(group, quantities='all')¶ Read the geometry and physical quantities from a cylindrical polar grid
Parameters: - group : h5py.Group
The HDF5 group to read the grid from. This group should contain groups named ‘Geometry’ and ‘Quantities’.
- quantities : ‘all’ or list
Which physical quantities to read in. Use ‘all’ to read in all quantities or a list of strings to read only specific quantities.
-
read_geometry
(group)¶ Read in geometry information from a cylindrical polar grid
Parameters: - group : h5py.Group
The HDF5 group to read the grid geometry from.
-
read_quantities
(group, quantities='all')¶ Read in physical quantities from a cylindrical polar grid
Parameters: - group : h5py.Group
The HDF5 group to read the grid quantities from
- quantities : ‘all’ or list
Which physical quantities to read in. Use ‘all’ to read in all quantities or a list of strings to read only specific quantities.
-
write
(group, quantities='all', copy=True, absolute_paths=False, compression=True, wall_dtype=<class 'float'>, physics_dtype=<class 'float'>)¶ Write out the cylindrical polar grid
Parameters: - group : h5py.Group
The HDF5 group to write the grid to
- quantities : ‘all’ or list
Which physical quantities to write out. Use ‘all’ to write out all quantities or a list of strings to write only specific quantities.
- copy : bool
Whether to copy external links, or leave them as links.
- absolute_paths : bool
If copy is False, then this indicates whether to use absolute or relative paths for links.
- compression : bool
Whether to compress the arrays in the HDF5 file
- wall_dtype : type
The datatype to use to write the wall positions
- physics_dtype : type
The datatype to use to write the physical quantities
-
write_single_array
(group, name, array, copy=True, absolute_paths=False, compression=True, physics_dtype=<class 'float'>)¶ Write out a single quantity, checking for consistency with geometry
Parameters: - group : h5py.Group
The HDF5 group to write the grid to
- name : str
The name of the array in the group
- array : np.ndarray
The array to write out
- copy : bool
Whether to copy external links, or leave them as links.
- absolute_paths : bool
If copy is False, then this indicates whether to use absolute or relative paths for links.
- compression : bool
Whether to compress the arrays in the HDF5 file
- wall_dtype : type
The datatype to use to write the wall positions
- physics_dtype : type
The datatype to use to write the physical quantities
-
add_derived_quantity
(name, function)¶
-
-
class
hyperion.grid.
CylindricalPolarGridView
(grid, quantity)¶ Methods
append
(grid)Used to append quantities from another grid add
(grid)Used to add quantities from another grid Methods (detail)
-
append
(grid)¶ Used to append quantities from another grid
Parameters: - grid : 3D Numpy array or CylindricalPolarGridView instance
The grid to copy the quantity from
-
add
(grid)¶ Used to add quantities from another grid
Parameters: - grid : 3D Numpy array or CylindricalPolarGridView instance
The grid to copy the quantity from
-