Skip to content

Commit e5f5cc1

Browse files
committed
be more permissive
1 parent f5b2fbd commit e5f5cc1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/pyFAI/gui/jupyter/_plot.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
__contact__ = "Jerome.Kieffer@ESRF.eu"
3434
__license__ = "MIT"
3535
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
36-
__date__ = "27/09/2023"
36+
__date__ = "25/04/2024"
3737
__status__ = "Production"
3838
__docformat__ = 'restructuredtext'
3939

@@ -104,15 +104,18 @@ def plot1d(result, calibrant=None, label=None, ax=None):
104104
if ax is None:
105105
_fig, ax = subplots()
106106

107-
unit = result.unit
108-
if result.sigma is not None:
109-
ax.errorbar(result.radial, result.intensity, result.sigma, label=label)
107+
try:
108+
unit = result.unit
109+
except:
110+
unit = None
111+
if len(result) == 3:
112+
ax.errorbar(*result, label=label)
110113
else:
111-
ax.plot(result.radial, result.intensity, label=label)
114+
ax.plot(*result, label=label)
112115

113116
if label:
114117
ax.legend()
115-
if calibrant:
118+
if calibrant and unit:
116119
x_values = calibrant.get_peaks(unit)
117120
if x_values is not None:
118121
for x in x_values:
@@ -121,7 +124,8 @@ def plot1d(result, calibrant=None, label=None, ax=None):
121124
ax.add_line(line)
122125

123126
ax.set_title("1D integration")
124-
ax.set_xlabel(unit.label)
127+
if unit:
128+
ax.set_xlabel(unit.label)
125129
ax.set_ylabel("Intensity")
126130

127131
return ax

0 commit comments

Comments
 (0)