Opened 7 years ago
Closed 7 years ago
#3391 closed defect (fixed)
r.learn.ml : the list of caterory map indices is not handled properly.
Reported by: | maitl | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.2.2 |
Component: | Addons | Version: | unspecified |
Keywords: | Cc: | ||
CPU: | All | Platform: | All |
Description
# convert to lists """ if ',' in categorymaps:
categorymaps = [int(i) for i in categorymaps.split(',')] print(categorymaps)
else: categorymaps = None """
fails if there is only one category map.
The proposed solution is
if categorymaps.strip() == :
categorymaps = None
else:
try:
categorymaps = [int(i.strip()) for i in categorymaps.split(',')] # negatiivse ja maplist, _ = maps_from_group(group) suurima indeksi kontroll, dublikaatide kontroll (unique) nCategories = len(maps_from_group(group)[0]) if min(categorymaps) < 0:
gscript.fatal('Category map index can not be negative.')
if max(categorymaps) > nCategories - 1:
gscript.fatal('Category map index input can not exceed ' + str(nCategories - 1))
if not len(np.unique(categorymaps)) == len(categorymaps):
gscript.fatal('Duplicate indices in category map index list.')
except:
gscript.fatal('Error in category map list input.')
if ',' in indexes:
indexes = [int(i) for i in indexes.split(',')]
else:
indexes = int(indexes)
if indexes == -1: indexes = None
# credits for this fix go to Jaan Janno from Tartu University, Estonia
Attachments (1)
Change History (2)
by , 7 years ago
Attachment: | r.learn.ml added |
---|
comment:1 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks again for this Jaan, I have updated the Add-Ons with #71358 and I'm closing the ticket.
The copy of r.learn.ml with bugfix example