locan.data.filter.select_by_region#

locan.data.filter.select_by_region(locdata, region, loc_properties=None, reduce=True)[source]#

Select localizations from locdata that are within region and return a new LocData object. Selection is with respect to loc_properties or to localization coordinates that correspond to region dimension.

Parameters:
  • locdata (LocData) – Localization data that is tested for being inside the region.

  • region (Region) – Tested region

  • loc_properties (Optional[list[str]]) – Localization properties to be tested.

  • reduce (bool) – Return the reduced LocData object or keep references alive.

Returns:

A new instance of LocData with all localizations within region of interest.

Return type:

LocData

Note

Points on boundary of regions are considered outside if region is a shapely object, but inside if region is a matplotlib (which is the case for RoiRegion) object.