Skip to content

Commit

Permalink
fixed selectors which need 5 columns in item matrix for autonomous usage
Browse files Browse the repository at this point in the history
a warning is issued
  • Loading branch information
douglasrizzo committed Jun 4, 2019
1 parent 4c25eaf commit d625979
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion catsim/__init__.py
@@ -1 +1 @@
__version__ = '0.15.3'
__version__ = '0.15.4'
27 changes: 20 additions & 7 deletions catsim/selection.py
Expand Up @@ -80,7 +80,15 @@ def select(
return None

# gets the indexes and information values from the items with r < rmax
valid_indexes_low_r = [index for index in valid_indexes if items[index, 4] < self._r_max]
valid_indexes_low_r = valid_indexes
if items.shape[1] < 5:
warn(
'This selector needs an item matrix with at least 5 columns, with the last one representing item exposure rate. Since this column is absent, it will presume all items have exposure rates = 0'
)
else:
valid_indexes_low_r = [
index for index in valid_indexes if items[index, 4] < self._r_max
]

# return the item with maximum information from the ones available
if len(valid_indexes_low_r) > 0:
Expand Down Expand Up @@ -440,12 +448,17 @@ def select(
]

# gets the indexes and information values from the items in the
# selected cluster with r < rmax that have not been
# administered
valid_indexes_low_r = [
index for index in valid_indexes
if items[index, 4] < self._r_max and index not in administered_items
]
# selected cluster with r < rmax that have not been administered
valid_indexes_low_r = valid_indexes
if items.shape[1] < 5:
warn(
'This selector needs an item matrix with at least 5 columns, with the last one representing item exposure rate. Since this column is absent, it will presume all items have exposure rates = 0'
)
else:
valid_indexes_low_r = [
index for index in valid_indexes
if items[index, 4] < self._r_max and index not in administered_items
]

if len(valid_indexes_low_r) > 0:
# return the item with maximum information from the ones available
Expand Down

0 comments on commit d625979

Please sign in to comment.