diff --git a/swiftsimio/masks.py b/swiftsimio/masks.py index b3f406ca..9564f5ae 100644 --- a/swiftsimio/masks.py +++ b/swiftsimio/masks.py @@ -10,7 +10,7 @@ import numpy as np -from swiftsimio import SWIFTMetadata +from swiftsimio.metadata.objects import SWIFTMetadata from swiftsimio.objects import InvalidSnapshot @@ -423,9 +423,6 @@ def constrain_index(self, index: int): index : int The index of the row to select. """ - if not self.metadata.filetype == "SOAP": - warnings.warn("Not masking a SOAP catalogue, nothing constrained.") - return for group_name in self.metadata.present_group_names: setattr(self, group_name, np.array([[index, index + 1]])) setattr(self, f"{group_name}_size", 1) diff --git a/swiftsimio/reader.py b/swiftsimio/reader.py index 809b3817..f2e6ec61 100644 --- a/swiftsimio/reader.py +++ b/swiftsimio/reader.py @@ -11,27 +11,20 @@ + SWIFTDataset, a container class for all of the above. """ - from swiftsimio.accelerated import read_ranges_from_file -from swiftsimio.objects import cosmo_array, cosmo_factor, a +from swiftsimio.objects import cosmo_array, cosmo_factor from swiftsimio.metadata.objects import ( metadata_discriminator, SWIFTUnits, SWIFTGroupMetadata, - SWIFTMetadata, ) -import re import h5py import unyt import numpy as np -import warnings - -from datetime import datetime -from pathlib import Path -from typing import Union, Callable, List, Optional +from typing import Union, List def generate_getter( @@ -181,9 +174,11 @@ def getter(self): cosmo_array( # Only use column data if array is multidimensional, otherwise # we will crash here - handle[field][:, columns] - if handle[field].ndim > 1 - else handle[field][:], + ( + handle[field][:, columns] + if handle[field].ndim > 1 + else handle[field][:] + ), unit, cosmo_factor=cosmo_factor, name=description, @@ -316,7 +311,7 @@ def generate_empty_properties(self): class __SWIFTNamedColumnDataset(object): """ Holder class for individual named datasets. Very similar to - __SWIFTGroupsDatasets but much simpler. + __SWIFTGroupDatasets but much simpler. """ def __init__(self, field_path: str, named_columns: List[str], name: str): diff --git a/swiftsimio/subset_writer.py b/swiftsimio/subset_writer.py index 235cbbe2..da7b03f3 100644 --- a/swiftsimio/subset_writer.py +++ b/swiftsimio/subset_writer.py @@ -3,12 +3,10 @@ it to a new file. """ -from swiftsimio.reader import SWIFTUnits, SWIFTMetadata from swiftsimio.masks import SWIFTMask from swiftsimio.accelerated import read_ranges_from_file import swiftsimio.metadata as metadata -import unyt import h5py import numpy as np from typing import Optional, List