get the indexes of the N largest values in a list such that these values respect a given condition
<pre><code>Ids = [ i for i, v in heapq.nlargest(RN, enumerate(score_real_test), key=operator.itemgetter(1))] 
</code></pre>

<p>This will give the indexes of the RN largest values in list score_real_test. Is it instead possible to get the indexes of the RN largest values that "are in list score_real_test and satisfy a boolean condition COND" ?</p>

<p>Ids should contains RN indexes.</p>

<p>EDIT: for now I use this solution but it is not the best one :</p>

<pre><code>score_real_test_2 = np.sort( [ v for i,v in enumerate(score_real_test) if pred_real_test[i] == NOVEL ] )
score_real_test_2 = score_real_test_2[len(score_real_test_2)-RN:]
large_dist_ids = [i for i in range(len(score_real_test)) if score_real_test[i] in score_real_test_2]
</code></pre>
