Skip to content

Commit

Permalink
Run formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleaoman committed Nov 30, 2024
1 parent f11b395 commit a190c39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion swiftsimio/metadata/metadata/metadata_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def generate_cosmo_args_header_unpack_arrays(scale_factor) -> dict:
# should not be cosmo_array'd).
cosmo_args = {
"boxsize": dict(
cosmo_factor=cosmo_factor(a**1, scale_factor=scale_factor),
cosmo_factor=cosmo_factor(a ** 1, scale_factor=scale_factor),
comoving=True, # if it's not, then a=1 and it doesn't matter
valid_transform=True,
)
Expand Down
38 changes: 16 additions & 22 deletions swiftsimio/metadata/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,12 @@ def postprocess_header(self):
# items including the scale factor.
# These must be unpacked as they are stored as length-1 arrays

header_unpack_float_units = (
metadata.metadata_fields.generate_units_header_unpack_single_float(
m=self.units.mass,
l=self.units.length,
t=self.units.time,
I=self.units.current,
T=self.units.temperature,
)
header_unpack_float_units = metadata.metadata_fields.generate_units_header_unpack_single_float(
m=self.units.mass,
l=self.units.length,
t=self.units.time,
I=self.units.current,
T=self.units.temperature,
)
for field, names in metadata.metadata_fields.header_unpack_single_float.items():
try:
Expand Down Expand Up @@ -166,19 +164,15 @@ def postprocess_header(self):
self.scale_factor = 1.0

# These are just read straight in to variables
header_unpack_arrays_units = (
metadata.metadata_fields.generate_units_header_unpack_arrays(
m=self.units.mass,
l=self.units.length,
t=self.units.time,
I=self.units.current,
T=self.units.temperature,
)
header_unpack_arrays_units = metadata.metadata_fields.generate_units_header_unpack_arrays(
m=self.units.mass,
l=self.units.length,
t=self.units.time,
I=self.units.current,
T=self.units.temperature,
)
header_unpack_arrays_cosmo_args = (
metadata.metadata_fields.generate_cosmo_args_header_unpack_arrays(
self.scale_factor
)
header_unpack_arrays_cosmo_args = metadata.metadata_fields.generate_cosmo_args_header_unpack_arrays(
self.scale_factor
)

for field, name in metadata.metadata_fields.header_unpack_arrays.items():
Expand Down Expand Up @@ -610,7 +604,7 @@ def get_units(unit_attribute):
# Need to check if the exponent is 0 manually because of float precision
unit_exponent = unit_attribute[f"U_{exponent} exponent"][0]
if unit_exponent != 0.0:
units *= unit**unit_exponent
units *= unit ** unit_exponent
except KeyError:
# Can't load that data!
# We should probably warn the user here...
Expand Down Expand Up @@ -708,7 +702,7 @@ def get_cosmo(dataset):
# Can't load, 'graceful' fallback.
cosmo_exponent = 0.0

a_factor_this_dataset = a**cosmo_exponent
a_factor_this_dataset = a ** cosmo_exponent

return cosmo_factor(a_factor_this_dataset, current_scale_factor)

Expand Down

0 comments on commit a190c39

Please sign in to comment.