mindscience.data.Geometry

class mindscience.data.Geometry(name, dim, coord_min, coord_max, dtype=numpy.float32, sampling_config=None)[source]

Definition of Geometry object.

Parameters
  • name (str) – Name of the geometry.

  • dim (int) – Number of dimensions.

  • coord_min (Union[int, float, tuple, list, numpy.ndarray]) – Minimal coordinate of the geometry. If the parameter type is tuple or list, each element should be of type int or float, and its length must be consistent with the dim parameter.

  • coord_max (Union[int, float, tuple, list, numpy.ndarray]) – Maximal coordinate of the geometry. If the parameter type is tuple or list, each element should be of type int or float, and its length must be consistent with the dim parameter.

  • dtype (numpy.dtype) – Data type of sampled point data type. Default: numpy.float32.

  • sampling_config (SamplingConfig) – Sampling configuration. Default: None.

Examples

>>> from mindscience.data import generate_sampling_config, Geometry
>>> geometry_config = dict({'domain' : dict({'random_sampling' : True, 'size' : 100}),
...                          'BC' : dict({'random_sampling' : True, 'size' : 100, 'sampler' : 'uniform',}),
...                          'random_merge' : True,})
>>> sampling_config = generate_sampling_config(geometry_config)
>>> geom = Geometry("geom", 1, 0.0, 1.0, sampling_config=sampling_config)
>>> geom.set_name("geom_name")
set_name(name)[source]

Set geometry instance name.

Parameters

name (str) – Name of geometry instance.

Raises

TypeError – If name is not string.

Examples

>>> from mindscience.data import generate_sampling_config, Geometry
>>> geom = Geometry("geom", 1, 0.0, 1.0)
>>> geom.set_name("geom_name")
set_sampling_config(sampling_config)[source]

Set sampling info.

Parameters

sampling_config (SamplingConfig) – Sampling configuration.

Raises

TypeError – If sampling_config is not instance of SamplingConfig.

Examples

>>> from mindscience.data import generate_sampling_config, Geometry
>>> geometry_config = dict({'domain': dict({'random_sampling': True, 'size': 100}),
...                          'BC': dict({'random_sampling': True, 'size': 100, 'sampler': 'uniform',}),
...                          'random_merge': True,})
>>> sampling_config = generate_sampling_config(geometry_config)
>>> geom = Geometry("geom", 1, 0.0, 1.0)
>>> geom.set_sampling_config(sampling_config)