Skip to content

Commit

Permalink
Merge branch 'cleanup_imports' into masking_in_9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Sep 20, 2024
2 parents e206298 + 34994bb commit 5477a28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion swiftsimio/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import numpy as np

from swiftsimio import SWIFTMetadata
from swiftsimio.metadata.objects import SWIFTMetadata

from swiftsimio.objects import InvalidSnapshot

Expand Down
21 changes: 8 additions & 13 deletions swiftsimio/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 0 additions & 2 deletions swiftsimio/subset_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5477a28

Please sign in to comment.