Skip to content

Commit

Permalink
Lint with black.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleaoman committed Apr 17, 2024
1 parent 3c1a19e commit 8c48f1f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
2 changes: 0 additions & 2 deletions swiftgalaxy/halo_finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def velocity_centre(self) -> cosmo_array:


class Velociraptor(_HaloFinder):

"""
Interface to velociraptor halo catalogues for use with :mod:`swiftgalaxy`.
Expand Down Expand Up @@ -371,7 +370,6 @@ def __repr__(self) -> str:


class Caesar(_HaloFinder):

"""
Interface to Caesar halo catalogues for use with :mod:`swiftgalaxy`.
Expand Down
1 change: 0 additions & 1 deletion swiftgalaxy/masks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class MaskCollection(object):

"""
Barebones container for mask objects.
Expand Down
46 changes: 21 additions & 25 deletions swiftgalaxy/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def _apply_4transform(


class _CoordinateHelper(object):

"""
Container class for coordinates.
Expand Down Expand Up @@ -135,7 +134,6 @@ def __repr__(self) -> str:


class _SWIFTNamedColumnDatasetHelper(object):

"""
A wrapper class to enable :class:`SWIFTGalaxy`
functionality for a :class:`swiftsimio.reader.__SWIFTNamedColumnDataset`.
Expand Down Expand Up @@ -255,7 +253,6 @@ def _data_copy(


class _SWIFTParticleDatasetHelper(object):

"""
A wrapper class to enable :class:`SWIFTGalaxy`
functionality for a :class:`swiftsimio.reader.__SWIFTParticleDataset`.
Expand Down Expand Up @@ -359,9 +356,9 @@ def __init__(
TypeNamedColumnDatasetHelper = type(
nice_name, (_SWIFTNamedColumnDatasetHelper, object), dict()
)
self._named_column_dataset_helpers[
named_columns_name
] = TypeNamedColumnDatasetHelper(named_columns, self)
self._named_column_dataset_helpers[named_columns_name] = (
TypeNamedColumnDatasetHelper(named_columns, self)
)
self._spherical_coordinates: Optional[dict] = None
self._cylindrical_coordinates: Optional[dict] = None
self._spherical_velocities: Optional[dict] = None
Expand Down Expand Up @@ -949,14 +946,14 @@ def _mask_derived_coordinates(self, mask: slice) -> None:
][mask]
if self._cylindrical_coordinates is not None:
for coord in ("rho", "phi", "z"):
self._cylindrical_coordinates[
f"_{coord}"
] = self._cylindrical_coordinates[f"_{coord}"][mask]
self._cylindrical_coordinates[f"_{coord}"] = (
self._cylindrical_coordinates[f"_{coord}"][mask]
)
if self._cylindrical_velocities is not None:
for coord in ("v_rho", "v_phi", "v_z"):
self._cylindrical_velocities[
f"_{coord}"
] = self._cylindrical_velocities[f"_{coord}"][mask]
self._cylindrical_velocities[f"_{coord}"] = (
self._cylindrical_velocities[f"_{coord}"][mask]
)
return

def _void_derived_coordinates(self) -> None:
Expand All @@ -968,7 +965,6 @@ def _void_derived_coordinates(self) -> None:


class SWIFTGalaxy(SWIFTDataset):

"""
A representation of a simulated galaxy.
Expand Down Expand Up @@ -1303,27 +1299,27 @@ def _data_copy(self, mask_collection: Optional[MaskCollection] = None):
if particle_dataset_helper._spherical_coordinates is not None:
new_particle_dataset_helper._spherical_coordinates = dict()
for c in ("_r", "_theta", "_phi"):
new_particle_dataset_helper._spherical_coordinates[
c
] = particle_dataset_helper._spherical_coordinates[c][mask]
new_particle_dataset_helper._spherical_coordinates[c] = (
particle_dataset_helper._spherical_coordinates[c][mask]
)
if particle_dataset_helper._spherical_velocities is not None:
new_particle_dataset_helper._spherical_velocities = dict()
for c in ("_v_r", "_v_t", "_v_p"):
new_particle_dataset_helper._spherical_velocities[
c
] = particle_dataset_helper._spherical_velocities[c][mask]
new_particle_dataset_helper._spherical_velocities[c] = (
particle_dataset_helper._spherical_velocities[c][mask]
)
if particle_dataset_helper._cylindrical_coordinates is not None:
new_particle_dataset_helper._cylindrical_coordinates = dict()
for c in ("_rho", "_phi", "_z"):
new_particle_dataset_helper._cylindrical_coordinates[
c
] = particle_dataset_helper._cylindrical_coordinates[c][mask]
new_particle_dataset_helper._cylindrical_coordinates[c] = (
particle_dataset_helper._cylindrical_coordinates[c][mask]
)
if particle_dataset_helper._cylindrical_velocities is not None:
new_particle_dataset_helper._cylindrical_velocities = dict()
for c in ("_v_rho", "_v_phi", "_v_z"):
new_particle_dataset_helper._cylindrical_velocities[
c
] = particle_dataset_helper._cylindrical_velocities[c][mask]
new_particle_dataset_helper._cylindrical_velocities[c] = (
particle_dataset_helper._cylindrical_velocities[c][mask]
)
return SG

def __getattribute__(self, attr: str) -> Any:
Expand Down
6 changes: 3 additions & 3 deletions tests/toysnap.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,9 @@ def create_toycaesar(filename=toycaesar_filename):
# f["/simulation_attributes"].attrs["effective_resolution"] = ...
# f["/simulation_attributes"].attrs["fullpath"] = ...
f["/simulation_attributes"].attrs["hubble_constant"] = 0.7
f["/simulation_attributes"].attrs[
"mean_interparticle_separation"
] = boxsize.to_value(u.kpc) / n_dm ** (1 / 3)
f["/simulation_attributes"].attrs["mean_interparticle_separation"] = (
boxsize.to_value(u.kpc) / n_dm ** (1 / 3)
)
f["/simulation_attributes"].attrs["nbh"] = n_bh
f["/simulation_attributes"].attrs["ndm"] = n_dm_all
f["/simulation_attributes"].attrs["ndust"] = 0
Expand Down

0 comments on commit 8c48f1f

Please sign in to comment.