Skip to content

Commit

Permalink
Merge pull request #3432 from chummels/fix_profile
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros authored Jul 13, 2021
2 parents 7adc079 + 2066eb5 commit c11c2f8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion yt/data_objects/profiles.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
from more_itertools import collapse

from yt.data_objects.field_data import YTFieldData
from yt.fields.derived_field import DerivedField
Expand Down Expand Up @@ -1347,7 +1348,9 @@ def create_profile(
else:
logs_list.append(data_source.ds.field_info[bin_field].take_log)
logs = logs_list
if extrema is None:

# Are the extrema all Nones? Then treat them as though extrema was set as None
if extrema is None or not any(collapse(extrema.values())):
ex = [
data_source.quantities["Extrema"](f, non_zero=l)
for f, l in zip(bin_fields, logs)
Expand Down
15 changes: 15 additions & 0 deletions yt/data_objects/tests/test_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,21 @@ def test_unequal_bin_field_profile(self):
("gas", "mass"),
)

def test_set_linear_scaling_for_none_extrema(self):
# See Issue #3431
# Ensures that extrema are calculated in the same way on subsequent passes
# through the PhasePlot machinery.
ds = fake_sph_orientation_ds()
p = yt.PhasePlot(
ds,
("all", "particle_position_spherical_theta"),
("all", "particle_position_spherical_radius"),
("all", "particle_mass"),
weight_field=None,
)
p.set_log(("all", "particle_position_spherical_theta"), False)
p.save()


def test_index_field_units():
# see #1849
Expand Down

0 comments on commit c11c2f8

Please sign in to comment.