forked from IPKM/nmreval
setRegion of RegionItem with option to account for log mode
This commit is contained in:
@ -376,6 +376,8 @@ class RegionItem(LinearRegionItem):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.mode = kwargs.pop('mode', 'half')
|
||||
|
||||
print(args, kwargs)
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.logmode = False
|
||||
@ -422,6 +424,15 @@ class RegionItem(LinearRegionItem):
|
||||
else:
|
||||
return region
|
||||
|
||||
def setRegion(self, region, use_log=False):
|
||||
if self.logmode and use_log:
|
||||
region = np.log10(region[0]), np.log10(region[1])
|
||||
|
||||
if not np.all(np.isfinite(region)):
|
||||
raise ValueError(f'Invalid region limits ({region[0]}, {region[1]})')
|
||||
else:
|
||||
super().setRegion(region)
|
||||
|
||||
def boundingRect(self):
|
||||
# overwrite to draw correct rect in logmode
|
||||
|
||||
|
Reference in New Issue
Block a user