Skip to content

Commit

Permalink
Set default scatter values to define the length of the arrows that in…
Browse files Browse the repository at this point in the history
…dicate upper and lower limits
  • Loading branch information
EvgeniiChaikin committed May 20, 2024
1 parent 1fe91b4 commit 4543b34
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion velociraptor/observations/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Includes an object container and helper functions for creating
and reading files.
"""

import numpy as np
from unyt import unyt_quantity, unyt_array
from numpy import tanh, log10, logical_and
from matplotlib.pyplot import Axes
Expand Down Expand Up @@ -508,6 +508,8 @@ def associate_y(

if scatter is not None:
self.y_scatter = scatter.to(self.y_units)
elif lolims is not None or uplims is not None:
self.y_scatter = self.y * 0.0
else:
self.y_scatter = None

Expand All @@ -521,11 +523,26 @@ def associate_y(
"Entries of the unyt arrays representing lower and upper limits must be "
"of 'bool' type and cannot both be 'True' for the same data points."
)

# In the case of upper or lower limits, the scatter values define the size of the arrows
lolims_arrow_size = self.y[self.lower_limits.value] / 3.0
try:
self.y_scatter[self.lower_limits.value] = lolims_arrow_size
except IndexError:
self.y_scatter[:, self.lower_limits.value] = lolims_arrow_size

else:
self.lower_limits = None

if uplims is not None:
self.upper_limits = uplims

# In the case of upper or lower limits, the scatter values define the size of the arrows
uplims_arrow_size = self.y[self.upper_limits.value] / 3.0
try:
self.y_scatter[self.upper_limits.value] = uplims_arrow_size
except IndexError:
self.y_scatter[:, self.upper_limits.value] = uplims_arrow_size
else:
self.upper_limits = None

Expand Down

0 comments on commit 4543b34

Please sign in to comment.