+
     èk+  ã                   ó"  € R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	t	^ RI
t^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ]! ]4      P1                  4       P2                  ^,          t]R,          tR	 tR
 t]R8X  d
   ]! 4        R# R# )zNCompare apparent mask lengths for shared source-name strings, not calibration.N)ÚPath)ÚGunduzExpansionAssets)ÚGunduzSpeciesAssets)ÚUDEBreadthDataset)ÚUDEBreadthExtensionDataset)ÚUDEScaleupDatasetÚsha256z&results/r112/cross-source-length-pilotc                 ó|  € \         P                  ! V 4      w  r\        V4      '       g   R # \         P                  ! W!34      P	                  \         P
                  4      P                  R^^4      p\        P                  ! V4      p\        P                  ! V4      w  pw  rgp\        \        Wg4      R,           4      # )Ng      ð?éÿÿÿÿ)ÚnpÚnonzeroÚlenÚcolumn_stackÚastypeÚint32ÚreshapeÚcv2Ú
convexHullÚminAreaRectÚfloatÚmax)ÚmaskÚysÚxsÚpointsÚhullÚ_ÚaÚbs   &       ÚS/home/mchadwick/src/ansp/diatom-research/research/r112_cross_source_length_pilot.pyÚmajor_extentr       sƒ   € Ü�ZŠZ˜Ó�F€BÜˆr�7Š7ÙÜ�_Š_˜b˜XÓ&×-Ñ-¬b¯h©hÓ7×?Ñ?ÀÀAÀqÓI€FÜ�>Š>˜&Ó!€DÜ—?’? 4Ó(�L€A�vˆˆqÜ”�Q“˜R•Ó Ð ó    c                  ó:  a€ \         P                  ! 4       p \        P                  ! R RR7      P	                  ^\
        P                  4      ^ 8X  g   Q hV \         P                  ! 4       8w  d   \        R4      h\        P                  ! ^4       \        P                  RR7       \        R,          P                  4       '       d   Q hR\        R4      3R\        R4      3.pR	\        R
RR7      3R\!        RRR7      3R\#        RRR7      3.pR	R RR RR /pV UUUu0 uF   w  rEVP$                   F  qfR,          kK  	  K"  	  ppppV UUUu0 uF"  w  r…W8,          ! V4       F  qfR,          kK  	  K$  	  p	ppp\'        Wy,          4      p
\)        V
4      ^8X  g   Q h. RIOpRRRV Uu/ uF  qÌ\+        \,        V,          4      bK  	  upRV
RRRRRR/p\        R,          P/                  \0        P2                  ! V^R7      R,           4       . . rþV F‡  w  op\5        VP$                  4       Fh  w  ppVR,          V
9  d   K  VV,          pVP7                  R SR!VR!,          RVR,          R"VR",          R#VR#,          R$\9        VR%,          4      /4       Kj  	  K‰  	  V EF  w  op\5        VS,          ! V4      4       Fí  w  ppVR,          V
9  d   K  VV,          pVR&,          R'R'.8X  g   Q hVP:                  R(,          VR),          R*,           ,          p\0        P<                  ! VP?                  4       4      pVP7                  R SR!VR),          RVR,          R+VR,,          R-VR-,          R#VR.,          R/,          R0,          R1VR2,          R$\9        VR3,          ^ ,          4      /4       Kï  	  EK  	  . pV
 EF1  oV Uu. uF(  qfR,          S8X  g   K  VR$,          f   K  VR$,          NK*  	  ppV Uu. uF(  qfR,          S8X  g   K  VR$,          f   K  VR$,          NK*  	  ppV'       d	   V'       g   Q h\@        PB                  ! V4      \@        PB                  ! V4      ppVP7                  RSR4\)        V4      R5\)        V4      R6VR7\E        V4      \G        V4      .R8VR9\E        V4      \G        V4      .R:R'V,          R;R'V,          V,          R<\I        V3R= lV 4       4      /
4       EK4  	  RR>R?\+        \        R,          4      RVR,          R@VRAVRBV/p\        RC,          P/                  \0        P2                  ! V^R7      R,           4       \K        RD\)        V
4      RE\)        V4      RF\)        V4      RGRRH7       R # u upppi u upppi u upi u upi u upi )JNT)Ú	use_errnozParent exited)Úexist_okzprotocol.jsonzgunduz-existingÚconsumed_developmentzgunduz-expansionÚscaleupÚtraining)Úinclude_unverified_masksÚbreadthÚprior_training_componentszbreadth-extensionc                 ó   € V P                   # ©N©Úentries©Úds   &r   Ú<lambda>Úmain.<locals>.<lambda>.   s   €  1§9¢9r!   c                 óN   € V P                    UUu. uF  w  rVNK	  	  upp# u uppi r,   r-   )r0   Úxr   s   &  r   r1   r2   .   s!   € ÐRS×R[ÒR[ÔC\ÑR[É$È!ÃAÑR[ÓC\ùÓC\s   �!c                 ó   € V P                   # r,   )Úrecordsr/   s   &r   r1   r2   /   s   € ¨Q¯YªYr!   Úsource_nameÚsource_speciesÚformatz$r112-cross-source-length-protocol-v1Úinputs_sha256Úexact_name_intersectionÚ	selectionu  All already-accessed development source components from both GÃ¼ndÃ¼z pools and all prior-training-location UDE crops in three source pools whose literal source names match exactly. No newly selected heldout images. Names are matched as strings, not taxonomically reconciled.Úmeasurementu¿  Approximate long-axis mask extent: long side of OpenCV minimum-area rectangle around mask pixel centers plus one pixel. GÃ¼ndÃ¼z uses structurally associated source components; UDE uses unverified MobileSAM center masks, with geometric triage recorded. UDE nominal source scale 0.09 Âµm per pixel. For each shared name report median UDE extent in Âµm, median GÃ¼ndÃ¼z extent in pixels, and their ratio only as a descriptive cross-source statistic.Úwarningu<  The ratio is NOT a GÃ¼ndÃ¼z calibration or training resize: independent specimens may differ in size, view, preservation and taxonomy, sample sizes are small and biased, UDE masks can cover background, component links may be wrong, and source resolution/optics may differ. No independent benchmark or accuracy claim.)ÚindentÚ
ÚpoolÚidÚsource_image_idÚmask_sha256Ú	extent_pxÚsource_component_maskÚsource_um_per_pixel_xyg
×£p=
·?zmask-hypotheses/recordsÚannotation_idz.jsonÚsource_slideÚsource_slide_groupÚsource_site_componentÚmasksÚcenterr   ÚtriageÚmask_triageÚweak_mask_proposalsÚgunduz_countÚ	ude_countÚgunduz_extent_px_medianÚgunduz_extent_px_rangeÚude_extent_px_medianÚude_extent_px_rangeÚude_nominal_median_extent_umÚ@descriptive_median_length_ratio_um_per_gunduz_px_not_calibrationÚude_needs_inspectionc              3   óZ   <"  € T F   qR ,          S8X  g   K  VR,          R8H  x € K"  	  R# 5i)r7   rN   zneeds-inspectionN© )Ú.0r4   Únames   & €r   Ú	<genexpr>Úmain.<locals>.<genexpr>e   s-   øé € Ð/~Ñ[aÐVWÐgtÕeuÐy}Ñe}Ô0Q°°(µÐ?QÖ0QÓ[aùs   ƒ+—+z#r112-cross-source-length-results-v1Úprotocol_sha256Úspecies_comparisonsÚgunduzÚudezresults.jsonÚcomparedzliteral names;u   GÃ¼ndÃ¼z andz	UDE masks)Úflush)z.results/r112/gunduz-species-assets/assets.jsonz.results/r112/gunduz-species-assets/verify.jsonz0results/r112/gunduz-expansion-assets/assets.jsonz0results/r112/gunduz-expansion-assets/verify.jsonz(results/r112/species-scaleup/assets.jsonz5results/r112/species-scaleup/location-partitions.jsonz8results/r112/species-scaleup/mask-hypotheses/verify.jsonz(results/r112/species-breadth/assets.jsonz6results/r112/species-breadth/prior-split-exposure.jsonz8results/r112/species-breadth/mask-hypotheses/verify.jsonz2results/r112/species-breadth-extension/assets.jsonz2results/r112/species-breadth-extension/verify.jsonzBresults/r112/species-breadth-extension/mask-hypotheses/verify.jsonz,diatom_pilot/gunduz_species_asset_dataset.pyz.diatom_pilot/gunduz_expansion_asset_dataset.pyz#diatom_pilot/ude_scaleup_dataset.pyz#diatom_pilot/ude_breadth_dataset.pyz-diatom_pilot/ude_breadth_extension_dataset.pyz*research/r112_cross_source_length_pilot.py)&ÚosÚgetppidÚctypesÚCDLLÚprctlÚsignalÚSIGTERMÚRuntimeErrorr   ÚsetNumThreadsÚOÚmkdirÚexistsr   r   r   r   r   r6   Úsortedr   r   ÚRÚ
write_textÚjsonÚdumpsÚ	enumerateÚappendr    ÚrootÚloadsÚ	read_textÚ
statisticsÚmedianÚminr   ÚsumÚprint)ÚparentÚg_setsÚu_setsÚu_metar   r0   r4   Úg_namesr]   Úu_namesÚnamesÚfilesÚfÚpÚg_rowsÚu_rowsÚdatasetÚiÚmetaÚpathÚproposalÚoutÚgsÚusÚgmÚumÚresults           `                  r   Úmainr˜   !   sM  ø€ Ü�ZŠZ‹\€FÜ�;Š;�t tÔ,×2Ñ2°1´f·n±nÓEÈÔJÐJÐJØ”—’“ÔÜ˜?Ó+Ð+Ü×Ò�aÔÜ‡G�G�T€GÔÜ�OÕ#×+Ñ+×-Ò-Ð-Ð-Ø Ô"5Ð6LÓ"MÐNØ!Ô#8Ð9OÓ#PÐQðS€FàÔ+¨JÐQUÔVÐWØÔ+Ð,GÐbfÔgÐhØ"Ô$>Ð?ZÐuyÔ$zÐ{ð}€Fð Ñ,¨iÑ9\Ø!Ñ#6ð8€Fá,2ÕF©F¡D A¸A¿I¼I°q�×Ð¹IÑ©F€GÒFÙ28ÕR±&¡w tÀ&Æ,ÈqÆ/¸QÐ!×"Ð"Á/Ñ"±&€GÒRÜ�7Õ$Ó%€EÜˆu‹:˜ÔÐÐò
k€Eð 
Ð9Ø	±UÓ;±U°œf¤Q¨¥U›mÒ+±UÑ;Ð=VÐX]Ø	ð  lØ	ð  ZØ	ð  Sð		T€Aô
 ˆÕ×$Ñ$¤T§Z¢Z°¸!Ô%<¸tÕ%CÔDØ˜ˆFÛ‰ˆˆgÜ  §¡Ö1‰GˆAˆtØ�MÕ"¨%Ô/ÙØ˜•
ˆAØ�M‰M˜6 4¨¨t°D­z¸=È!ÈMÕJZØ,¨aÐ0AÕ.BÀMÐSWÐXeÕSfØ&¬°QÐ7NÕ5OÓ(PðRö Só	 2ñ  ô  ‰ˆˆgÜ  ¨¦¨gÓ!6Ö7‰GˆAˆtØÐ$Õ%¨UÔ2ÙØ˜•
ˆAØÐ-Õ.°3¸°*Ô<Ð<Ð<Ø—<‘<Ð";Õ;¸qÀÕ?QÐT[Õ?[Õ\ˆDÜ—z’z $§.¡.Ó"2Ó3ˆHØ�M‰M˜6 4¨¨q°Õ/AÀ=ÐRSÐTaÕRbØ)¨4Ð0DÕ+EÐG^Ð`aÐbyÕ`zØ(¨(°7Õ*;¸HÕ*EÀhÕ*OÐQYÐ[\Ð]jÕ[kØ&¬°QÐ7LÕ5MÈaÕ5PÓ(QðSö Tô 8ñ  ð €CÜˆÙ&,Óh¡f °-Õ0@ÀDÑ0HŒnÈQÈ{Í^Œnˆa��nˆn¡fˆÐhÙ&,Óh¡f °-Õ0@ÀDÑ0HŒnÈQÈ{Í^Œnˆa��nˆn¡fˆÐhß—bÐˆyÜ×"Ò" 2Ó&¬
×(9Ò(9¸"Ó(=ˆBˆØ�
‰
�M 4¨¼¸R»À+ÌsÐSUËwØ-¨rÐ3KÌcÐRTËgÔWZÐ[]ÓW^ÐM_Ø*¨BÐ0EÌÈBËÔQTÐUWÓQXÐGYØ2°C¸"µHØVÐX[Ð^`ÕX`ÐceÕXeØ*¬CÔ/~Ñ[aÓ/~Ó,~ð@÷ 	Añ ð Ð=Ð?PÔRXÔYZÐ]lÕYlÓRmØ˜˜9�Ð'<¸cÀ8ÈVÐUZÐ\bðd€FäˆÕ×#Ñ#¤D§J¢J¨v¸aÔ$@À4Õ$GÔHÜ	ˆ*”c˜%“jÐ"2´C¸³KÀÔQTÐU[ÓQ\Ð^iÐqu×vùôs GùÜRùò <ùò8 iùÚhs6   Ä&V Å(VÆ)V
Ï VÏVÏ!VÏ4VÐVÐVÚ__main__)Ú__doc__Úcollectionsrh   ru   rf   rk   r|   Úpathlibr   r   Únumpyr   Ú+diatom_pilot.gunduz_expansion_asset_datasetr   Ú)diatom_pilot.gunduz_species_asset_datasetr   Ú diatom_pilot.ude_breadth_datasetr   Ú*diatom_pilot.ude_breadth_extension_datasetr   Ú diatom_pilot.ude_scaleup_datasetr   r   Ú__file__ÚresolveÚparentsrs   ro   r    r˜   Ú__name__r[   r!   r   Ú<module>r§      s{   ðÙ TÛ Û Û Û 	Û Û Ý ã 
Û å MÝ IÝ >Ý Qß FáˆƒN×ÑÓ×$Ñ$ QÕ'€ØÐ0Õ0€ò!òHwðV ˆzÔÙ†Fñ r!   