summaryrefslogtreecommitdiff
path: root/silx/gui/plot/items/_arc_roi.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/plot/items/_arc_roi.py')
-rw-r--r--silx/gui/plot/items/_arc_roi.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/silx/gui/plot/items/_arc_roi.py b/silx/gui/plot/items/_arc_roi.py
index a22cc3d..23416ec 100644
--- a/silx/gui/plot/items/_arc_roi.py
+++ b/silx/gui/plot/items/_arc_roi.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2018-2020 European Synchrotron Radiation Facility
+# Copyright (c) 2018-2021 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -29,6 +29,7 @@ __authors__ = ["V. Valls"]
__license__ = "MIT"
__date__ = "28/06/2018"
+import logging
import numpy
from ... import utils
@@ -40,6 +41,9 @@ from ._roi_base import InteractionModeMixIn
from ._roi_base import RoiInteractionMode
+logger = logging.getLogger(__name__)
+
+
class _ArcGeometry:
"""
Non-mutable object to store the geometry of the arc ROI.
@@ -779,8 +783,9 @@ class ArcROI(HandleBasedROI, items.LineMixIn, InteractionModeMixIn):
If `startAngle` is smaller than `endAngle` the rotation is clockwise,
else the rotation is anticlockwise.
"""
- assert innerRadius <= outerRadius
- assert numpy.abs(startAngle - endAngle) <= 2 * numpy.pi
+ if innerRadius > outerRadius:
+ logger.error("inner radius larger than outer radius")
+ innerRadius, outerRadius = outerRadius, innerRadius
center = numpy.array(center)
radius = (innerRadius + outerRadius) * 0.5
weight = outerRadius - innerRadius