ddg.datastructures.nets.conversion module
- ddg.datastructures.nets.conversion.sampling_decomposer(sampling, atol, anchor, dimension)[source]
Helper function for sample_smooth_domain. Given parameters of a sampling, this function returns a list of usable length for the sampling process of domains.
- Parameters:
- samplinglist, int or float
Stepsize/Amount of samples and additional options. To default pass an int/float. If not pass a list of the form [stepsize/samples, option].
- atollist, int or float
Tolerance(s) used in the sampling process. To default pass an int/float. If not pass a list of tolerances for each direction.
If
Noneis given, will returnNoneagain, i.e. won’t replace it with the global default.- anchorlist, tuple or None
Anchor point used in the sampling process.
- dimensionint
Dimension of the domain you want to sample.
- Returns:
- list
- List of the decomposed sampling.[0] stepsize/samples[1] options[2] tolerances[3] anchor
See also
- ddg.datastructures.nets.conversion.sample_smooth_domain(domain, sampling, anchor=None, atol=1e-08)[source]
Samples a smooth domain.
- Parameters:
- domainddg.datastructures.nets.domain.SmoothDomain
SmoothDomain to sample.
- samplinglist, int or float
- Determines how the domain is sampled.If a default stepsize/sample amount and optionshould be used for all directions, either pass an int/float (will beregarded as stepsize), or a list of length 2 where the first entry isthe stepsize/sample amount and the second is the option to use.Else pass a list of length of the dimension of the domain where eachentry can be either an int/float or a list of length two (same rules asabove).Options:‘’ : stepsize given. The interval will be sampled with the givenstepsize starting from its lower bound.‘t’ : use the number as total amount of samples. The interval will bedivided up into the given number of samples in an equal fashion.Note that this option is only available for bounded intervals.Will raise a warning, if the number is a float.‘c’ : compound sampling. Behaves as option ‘t’ for bounded and ‘’ forunbounded intervals. Additionally only the given amount of sampleswill be returned for unbounded directions.Sampling given as a list [stepsize, amount of samples, ‘c’]‘s’ : symmetric sampling. This option tries to fit as many samples aspossible of the given stepsize in the interval in a symmetric fashionaround its center.
- anchorlist, tuple or None
Anchor point to use for the sampling process, given as a list/tuple of anchors for each direction. Directions where the anchor is None will be sampled normally, while for the others the sampling process ensures that the given set of values appears as one of the samples. For example for the anchor (2, None, 3) the resulting discrete net will attain the value (2, x, 3) at some point of its domain, where x is some value depending on the sampling of the second direction. Note that this option is not available for the options ‘s’, ‘t’ and ‘c’.
- atollist, int or float
Tolerance(s) used in the sampling process. Either pass a single value to use for all directions, or a list of length of the dimension of the domain of floats/ints.
This function uses the global tolerance defaults if
atolorrtolare set to None. Seeddg.nonexactfor details.
- Returns:
- ddg.datastructures.nets.net.DiscreteNet
See also
- ddg.datastructures.nets.conversion.sample_smooth_net(net, sampling, anchor=None, atol=1e-08, name=None)[source]
Samples a smooth net.
- Parameters:
- netddg.datastructures.nets.net.SmoothNet
Smooth net to sample.
- samplinglist, int or float
See sample_smooth_domain.
- anchorlist or None
Anchor point for sampling process.
- atollist, int or float
Tolerance(s) for sampling process.
- namestring
Name of the sampled net. If None, uses net.name instead.
- Returns:
- ddg.datastructures.nets.net.DiscreteNet
See also