Skip to content

Commit ddc3c31

Browse files
authored
Fixes plot bug when resample is set on a subset of contrast (#189)
1 parent 58d3aa6 commit ddc3c31

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ dependencies = [
2222
"tqdm>=4.66.5",
2323
]
2424

25+
[project.urls]
26+
Documentation = "https://rascalsoftware.github.io/RAT/"
27+
Repository = "https://github.com/RascalSoftware/python-RAT"
28+
2529
[project.optional-dependencies]
2630
dev = [
2731
"pytest>=7.4.0",

ratapi/utils/plotting.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ def _extract_plot_data(event_data: PlotEventData, q4: bool, show_error_bar: bool
7676
for j in range(len(sld)):
7777
results["sld"][-1].append([sld[j][:, 0], sld[j][:, 1]])
7878

79+
results["sld_resample"].append([])
7980
if event_data.resample[i] == 1 or event_data.modelType == "custom xy":
8081
layers = event_data.resampledLayers[i][0]
81-
results["sld_resample"].append([])
8282
for j in range(len(event_data.resampledLayers[i])):
8383
layer = event_data.resampledLayers[i][j]
8484
if layers.shape[1] == 4:
@@ -198,15 +198,14 @@ def plot_ref_sld_helper(
198198
sld_min, sld_max = confidence_intervals["sld"][i][j]
199199
sld_plot.fill_between(plot_data["sld"][i][j][0], sld_min, sld_max, alpha=0.6, color="grey")
200200

201-
if plot_data["sld_resample"]:
202-
for j in range(len(plot_data["sld_resample"][i])):
203-
sld_plot.plot(
204-
plot_data["sld_resample"][i][j][0],
205-
plot_data["sld_resample"][i][j][1],
206-
color=color,
207-
linewidth=1,
208-
animated=animated,
209-
)
201+
for j in range(len(plot_data["sld_resample"][i])):
202+
sld_plot.plot(
203+
plot_data["sld_resample"][i][j][0],
204+
plot_data["sld_resample"][i][j][1],
205+
color=color,
206+
linewidth=1,
207+
animated=animated,
208+
)
210209

211210
# Format the axis
212211
ref_plot.set_yscale("log")
@@ -544,11 +543,10 @@ def update_foreground(self, data):
544543
self.figure.axes[1].draw_artist(self.figure.axes[1].lines[i])
545544
i += 1
546545

547-
if plot_data["sld_resample"]:
548-
for resampled in plot_data["sld_resample"][j]:
549-
self.figure.axes[1].lines[i].set_data(resampled[0], resampled[1])
550-
self.figure.axes[1].draw_artist(self.figure.axes[1].lines[i])
551-
i += 1
546+
for resampled in plot_data["sld_resample"][j]:
547+
self.figure.axes[1].lines[i].set_data(resampled[0], resampled[1])
548+
self.figure.axes[1].draw_artist(self.figure.axes[1].lines[i])
549+
i += 1
552550

553551
for i, container in enumerate(self.figure.axes[0].containers):
554552
self.adjust_error_bar(

setup.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,6 @@ def build_libraries(self, libraries):
151151

152152
setup(
153153
name=PACKAGE_NAME,
154-
author="",
155-
author_email="",
156-
url="https://github.com/RascalSoftware/python-RAT",
157-
description="Python extension for the Reflectivity Analysis Toolbox (RAT)",
158-
long_description=LONG_DESCRIPTION,
159-
long_description_content_type="text/markdown",
160154
packages=find_packages(exclude=("tests",)),
161155
include_package_data=True,
162156
package_data={"": [get_shared_object_name(libevent[0])], "ratapi.examples": ["data/*.dat"]},

0 commit comments

Comments
 (0)