fractopo.analysis.subsampling module

Utilities for Network subsampling.

fractopo.analysis.subsampling.aggregate_chosen(chosen, default_aggregator=<function mean_aggregation>)

Aggregate a collection of subsampled circles for params.

Weights averages by the area of each subsampled circle.

Return type:

Dict[str, Any]

fractopo.analysis.subsampling.area_weighted_index_choice(idxs, areas, compressor)

Make area-weighted choce from list of indexes.

Return type:

int

fractopo.analysis.subsampling.choose_sample_from_group(group)

Choose single sample from group DataFrame.

Return type:

Dict[str, Union[float, int, str]]

fractopo.analysis.subsampling.collect_indexes_of_base_circles(idxs, how_many, areas)

Collect indexes of base circles, area-weighted and randomly.

Return type:

List[int]

fractopo.analysis.subsampling.create_sample(sampler)

Sample with NetworkRandomSampler and return Network description.

Return type:

Optional[Dict[str, Union[float, int, str]]]

fractopo.analysis.subsampling.gather_subsample_descriptions(subsample_results)

Gather results from a list of subsampling ProcessResults.

Return type:

List[Dict[str, Union[float, int, str]]]

fractopo.analysis.subsampling.group_gathered_subsamples(subsamples, groupby_column='Name')

Group gathered subsamples.

By default groups by Name column.

>>> subsamples = [
...     {"param": 2.0, "Name": "myname"},
...     {"param": 2.0, "Name": "myname"},
... ]
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~typing.Dict\`\\ \\\[\:py\:class\:\`str\`\, \:py\:class\:\`\~typing.List\`\\ \\\[\:py\:class\:\`\~typing.Dict\`\\ \\\[\:py\:class\:\`str\`\, \:py\:data\:\`\~typing.Union\`\\ \\\[\:py\:class\:\`float\`\, \:py\:class\:\`int\`\, \:py\:class\:\`str\`\]\]\]\]`
>>> group_gathered_subsamples(subsamples)
{'myname': [{'param': 2.0, 'Name': 'myname'}, {'param': 2.0, 'Name': 'myname'}]}
fractopo.analysis.subsampling.groupby_keyfunc(item, groupby_column='Name')

Use groupby_column to group values.

Return type:

str

fractopo.analysis.subsampling.random_sample_of_circles(grouped, circle_names_with_diameter, min_circles=1, max_circles=None)

Get a random sample of circles from grouped subsampled data.

Both the amount of overall circles and which circles within each group is random. Data is grouped by target area name.

Return type:

List[Dict[str, Union[float, int, str]]]

fractopo.analysis.subsampling.subsample_networks(networks, min_radii, random_choice=RandomChoice.radius, samples=1)

Subsample given Sequence of Networks.

Return type:

List[Optional[Dict[str, Union[float, int, str]]]]