insitupy.InSituExperiment.from_regions#
- classmethod InSituExperiment.from_regions(data, region_key, region_names=None)#
Creates an
InSituExperimentobject from specified regions in the givenInSituData.- Parameters:
data (InSituData) – The input data containing regions to extract.
region_key (str) – The key identifying the region of interest in
data.regions.region_names (Optional[Union[List[str], str]]) – A list of region names or a single region name to include
None (in the experiment. If)
included. (all regions under the specified region_key are)
- Returns:
An instance of
InSituExperimentcontaining the cropped data and metadata for the specified regions.- Return type:
Notes
The
region_namesparameter is converted to a list if a single string is provided.- The method iterates over the sorted list of region names in the
region_keydataframe, crops the data for each region, and adds it to the experiment along with its metadata.
- The method iterates over the sorted list of region names in the