Repository: SALib/SALib

Issue:
PAWN analysis not working when problem uses groups attribute
If I have a problem that was set using groups, sampling (using `sobol_sample`, for example) and analyze with PAWN:

```python
from SALib.util import read_param_file
from SALib import ProblemSpec
from SALib.test_functions import Ishigami

param_file = "src/SALib/test_functions/params/Ishigami_groups.txt"
problem = read_param_file(param_file)
sp = ProblemSpec(problem)
sp.sample_sobol(1024).evaluate(Ishigami.evaluate).analyze_pawn()
```

I get the following error:
```
  File "C:\Users\pribeiro\AIMS\Code\SALib\src\SALib\analyze\pawn.py", line 153, in analyze
    tmp[grp_id, :] = np.mean(results[unique_grps == grp, :], axis=0)
                             ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
IndexError: boolean index did not match indexed array along axis 0; size of axis is 3 but size of corresponding boolean axis is 2
```

That happens because `unique_grps` length is smaller than `num_vars`, but `result`'s shape is `(num_vars,5)`.

Discussion:

Solution patch:
diff --git a/src/SALib/analyze/pawn.py b/src/SALib/analyze/pawn.py
index 3ad4e45e..729c5845 100644
--- a/src/SALib/analyze/pawn.py
+++ b/src/SALib/analyze/pawn.py
@@ -149,8 +149,9 @@ def analyze(
 
         # Take the mean of effects from parameters that are grouped together
         unique_grps = np.array(unique_grps)
+        grps = np.array(groups)
         for grp_id, grp in enumerate(unique_grps):
-            tmp[grp_id, :] = np.mean(results[unique_grps == grp, :], axis=0)
+            tmp[grp_id, :] = np.mean(results[grps == grp, :], axis=0)
 
         results = tmp
         tmp = None


Test patch:
diff --git a/tests/test_analyze_pawn.py b/tests/test_analyze_pawn.py
new file mode 100644
index 00000000..76fcec09
--- /dev/null
+++ b/tests/test_analyze_pawn.py
@@ -0,0 +1,10 @@
+from SALib.util import read_param_file
+from SALib import ProblemSpec
+from SALib.test_functions import Ishigami
+
+
+def test_analyze_pawn():
+    param_file = "src/SALib/test_functions/params/Ishigami_groups.txt"
+    problem = read_param_file(param_file)
+    sp = ProblemSpec(problem)
+    sp.sample_sobol(512).evaluate(Ishigami.evaluate).analyze_pawn()