+
    ÚåkÊ  ã                   ó"   € R t ^ RItR tRR ltR# )zäPosthoc two-instance matching and target-exclusive evidence diagnostics.

This module requires reference masks and must not be used to select or rank
candidates at inference. It does not infer biological visibility or identity.
Nc                 ó¸   € \        \        P                  ! W,          4      4      p\        \        P                  ! W,          4      4      q3'       d	   W#,          # R # )ç        )ÚintÚnpÚcount_nonzero)ÚaÚbÚinterÚunions   &&  ÚI/home/mchadwick/src/ansp/diatom-research/diatom_pilot/overlap_evidence.pyÚ_iour      s?   € Ü
Œb×Ò˜q�sÓ#Ó
$€E¬3¬r×/?Ò/?ÀÅÓ/DÓ+E UÖ\aÈUÍ[ÐFiÐgiÐFió    c                ót  a € \        S 4      ^8w  g   ^ Tu;8:  d   ^8:  g   M \        R4      h\        ;QJ d    R S  4       F  '       g   K   RM	  RM! R S  4       4      '       g*   S ^ ,          P                  S ^,          P                  8w  d   \        R4      h\        ;QJ d    V 3R lV 4       F  '       g   K   RM	  RM! V 3R lV 4       4      '       d   \        R4      hV Uu. uF  q3R,          NK  	  pp\        \	        V4      4      \        V4      8w  d   \        R	4      h. . .p\        V4       FK  w  rc\        S 4       F7  w  rx\        WƒR
,          4      p	W’8¼  g   K  WW,          P                  Wi34       K9  	  KM  	  R.p
V^ ,           F  w  riV
P                  ^W–R34       K  	  V^,           F  w  riV
P                  ^V	RV34       K  	  V^ ,           F9  w  r¼V^,           F'  w  r}W·8w  g   K  V
P                  ^WÍ,           W·34       K)  	  K;  	  \        V
R R7      w  rïr·S ^ ,          S ^,          ( ,          S ^,          S ^ ,          ( ,          .pV Uu. uF  p\        VP                  4       4      NK  	  pp. p\        W·34       FÌ  w  ppVf   K  W,          R
,          p\        VV4       UUu. uF=  w  ppV'       d.   \        \        P                  ! VV,          4      4      V,          MRNK?  	  pppVV,          pV^V,
          ,          pTP                  RTRWF,          R\        VS V,          4      RTRVe   Ve
   VV,
          MR/4       KÎ  	  RTRTR\        S !  RTRTRVe,   Ve(   \        W,          R
,          W,          R
,          4      /# R/# u upi u upi u uppi )a°  Maximum-cardinality, then max-IoU, one-to-one target assignment.

For each assigned prediction report coverage of the assigned target's
pixels outside the other target and coverage of the other target's pixels
outside this one. Empty exclusive regions are explicitly unidentifiable.
These reference-derived features are diagnostics, not visibility labels or
calibrated biological evidence. Shapes must be matching boolean 2D masks.
z.Expected two references and threshold in [0,1]c              3   óØ   "  € T F`  p\        V\        P                  4      '       * ;'       g5    VP                  ^8g  ;'       g    VP                  \        P
                  8g  x € Kb  	  R# 5i)é   N)Ú
isinstancer   ÚndarrayÚndimÚdtypeÚbool_)Ú.0Úms   & r   Ú	<genexpr>Ú&two_target_evidence.<locals>.<genexpr>   sH   é € Ð
^ÑS]ÈaŒz˜!œBŸJ™JÓ'Ô'×IÐI¨1¯6©6°1©9×IÐI¸¿¹ÄÇÁÑ8IÔIÓS]ùs   ‚*A*­A*Á&A*TFz'Expected same-shaped boolean referencesc              3   ó6  <"  € T FŽ  p\        VP                  R 4      \        P                  4      '       * ;'       gT    VR ,          P                  \        P
                  8g  ;'       g(    VR ,          P                  S^ ,          P                  8g  x € K�  	  R# 5i)ÚmaskN)r   Úgetr   r   r   r   Úshape)r   ÚcÚ
referencess   & €r   r   r      sx   øé € ð  Nñ  CMÐ}~Œz˜!Ÿ%™% ›-¬¯
©
Ó3Ô3×xÐx°q¸µy·±ÌÏÉÑ7P×xÐxÐTUÐV\ÕT]×TcÑTcÐeoÐpqÕer×exÑexÑTxÔxó  CMùs   ƒ9B½+BÁ)0Bz'Expected same-shaped boolean candidatesÚidzCandidate IDs must be uniquer   Nc                 ó&   € V ^ ,          V ^,          3# )é    © )Úvs   &r   Ú<lambda>Ú%two_target_evidence.<locals>.<lambda>(   s   € ¨a°­d°1°Qµ4©[r   )ÚkeyÚtargetÚcandidate_idÚ
target_iouÚexclusive_coverageÚown_minus_other_exclusiveÚmatchedÚ	total_iouÚexclusive_areasÚassignmentsÚprediction_pair_iou)r"   r   NN)ÚlenÚ
ValueErrorÚanyr   ÚsetÚ	enumerater   ÚappendÚmaxr   ÚsumÚzipr   r   )r   Ú
candidatesÚ	thresholdr   ÚidsÚhitsÚidxÚjÚrefÚvalueÚchoicesÚir   r   ÚcountÚtotalÚ	exclusiveÚxÚareasr0   r(   r   ÚregionÚareaÚcoverageÚownÚothers   f&&                        r   Útwo_target_evidencerO      sæ  ø€ ô ˆ:ƒ˜Ô  I¦¨q¦ÜÐIÓJÐJß
ƒsÑ
^ÑS]Ó
^‡s‡s‚sÑ
^ÑS]Ó
^×^Ò^ÐblÐmnÕbo×buÑbuð  xBð  CDõ  xE÷  xKñ  xKô  cKÜÐBÓCÐCß
ƒsô  Nñ  CMó  N‡s‡s‚sô  Nñ  CMó  N÷  Nò  NÜÐBÓCÐCÙ$Ó%™*�Qˆ4�ˆ™*€CÐ%Ü
Œ3ˆs‹8ƒ}”c˜#“hÔ¤ZÐ0NÓ%OÐOØ
ˆRˆ€DÜ˜:Ö&‰ˆÜ˜zÖ*‰EˆAÜ�s˜V�9Ó%ˆEØÖ ¥§¡°¨{Ö ;ó +ñ 'ð Ð€GØ˜!—W�W‰	ˆ˜WŸ^™^¨Q¨u¸Ð,>Ö?‘WØ˜!—W�W‰	ˆ˜WŸ^™^¨Q¨u°T¸#Ð,>Ö?‘WØ�A�wˆw‰ˆØ˜—7�7‰CˆAØŽt�G—N‘N A a¥c¨! ;Ö/ó ñ ô ˜Ñ$8Ô9�O€E�ÀZÐPQÅ]ÐT^Ð_`ÕTaÐSaÕEaÐblÐmnÕboÐq{Ð|}Õq~Ðp~Õb~ÐD¸)ñ  ^gó  Ghñ  ^gð  YZô  HKð  LM÷  LQñ  LQó  LSö  HTñ  ^gð  AFð  Ghð  uwð  itÜ  Ö&‰
ˆˆsØŠ;‘xØ�_˜VÕ$ˆÔ|ð  AJð  KPô  }Qô  /Rñ  }QÑmxÐmsÐtx×Z^¬s´2×3CÒ3CÀDÈÅKÓ3PÓ/QÐRVÖ/VÐdhÒ/hñ  }Q Xñ  /Rð  W_ð  `fõ  Wgð  SVð  nvð  wxð  yõ  wõ  n@ð  hmð  AL÷  ASñ  ASð  U]ð  ^dð  esð  twõ  t|ð  }Iô  JNð  OSð  T^ð  _eõ  Tfó  Jgð  h|ð  }Eð  Fað  orò  o~ð  CHò  CTð  beð  fkö  bkð  Z^ð  T_ö  A`ñ 'ð �e˜K¨¨l¼4ÀÑ;LÐM^Ð_dÐerÐs~ð  @Uð  KLò  KXð  ]^ò  ]jô  VZð  [eõ  [hð  ioõ  [pð  q{õ  q~ð  Eõ  qFó  VGð  uð  uð  ptð  uð  uùò% 	&ùò Ghùó /Rs   Ã+N*É$"N/Ë N4Ë3N4)g      à?)Ú__doc__Únumpyr   r   rO   r#   r   r   Ú<module>rR      s   ðñó
 òjö!ur   