+
    Á{k,  ã                   óš   € R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
Ht ^ RIHtHt R tR t]R8X  d
   ]! 4        R# R# )zLBuild static field-review bundles from an explicit list of scan coordinates.N)ÚdatetimeÚtimezone)ÚPath)ÚdigestÚinsidec                ó¦  € Rp. pRRRRRRRR	R
R/pV F²  p\         P                  ! VR,          RR7      p\         P                  ! \        VR,          4      P                  4      q‚VR,          ,          p	V	R8X  d
   RV RV R2MTp
VP	                  RV
 RV RVR,           RVR,           RVR,           RWY,           R24       K´  	  \        R VP                  4        4       4      p\        P                  ! \        P                  4      P                  R4      pVRV R\        V4       R V R!2,           R"P                  V4      ,           R#,           p\        P                  ! R$V R%R&R'7      ;_uu_ 4       pVP!                  V4       \        VP                  4      pR(R(R(4       XP#                  V R),          4       R(#   + '       g   i     L*; i)*zCAtomically publish a snapshot; it is not a process liveness signal.ú2<!-- generated by diatom_pilot/batch_fields.py -->ÚpendingÚPendingÚcheckingzChecking existing outputÚ
processingÚ
ProcessingÚcompleteÚCompleteÚfailedz7Failed; inspect console and any retained partial outputÚidT)ÚquoteÚslidez	<a href="z/">z</a>z<li>u    Â· u    Â· field (Úxz, Úyz), Z Úzz</li>c              3   ó*   "  € T F	  qR 8H  x € K  	  R# 5i)r   N© )Ú.0r   s   & Údiatom_pilot/batch_fields.pyÚ	<genexpr>Ú!write_progress.<locals>.<genexpr>   s   é € Ð9© A�Z–-«ùs   ‚z%Y-%m-%d %H:%M:%S UTCaG  <!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><meta http-equiv="refresh" content="30"><title>Field review batch</title><style>body{font:16px/1.5 system-ui;color:#1c3835;max-width:70em;margin:2em auto;padding:0 1em}li{margin:.7em 0}</style><h1>Field review batch</h1><p>z of z# fields complete. Snapshot updated z×.</p><p>The page updates at job boundaries. A checking or processing status can be stale if the process stops. Model proposals and taxon suggestions need human review; these fields are not a validated count.</p><ul>Ú z</ul></html>Úwz.batch-index-F)ÚdirÚprefixÚdeleteNú
index.html)ÚhtmlÚescaper   ÚnameÚappendÚsumÚvaluesr   Únowr   ÚutcÚstrftimeÚlenÚjoinÚtempfileÚNamedTemporaryFileÚwriteÚreplace)ÚoutputÚjobsÚstatesÚmarkerÚlinksÚlabelsÚjobÚidentr   Ústatusr%   Ú	completedÚ	timestampÚpageÚfÚ	temporarys   &&&             r   Úwrite_progressr@      sÚ  € à?€FÀbÀØ�i 
Ð+EÀlÐS_Ð`jÐkuÐv~ð  @yð  z€FÛˆÜ�kŠk˜#˜d�)¨$Ô/ˆ´d·k²kÄ$ÀsÈ7Å|ÓBT×BYÑBYÓ6Z°ÐilÐmqÕirÕbsÐ[aØ28¸*Ô2Dˆy˜˜˜s 5 '¨Ñ.È%ˆØ�‰�t˜D˜6  e W¨K¸¸C½°zÀÀCÈÅHÀ:ÈUÐSVÐWZÕS[ÐR\Ð\`ÐagÕaoÐ`pÐpuÐvÖwñ ô Ñ9¨¯©¬Ó9Ó9€IÄHÇLÂLÔQY×Q]ÑQ]ÓD^×DgÑDgÐhó  EA¸)Ø
ð +ð ,5¨+°T¼#¸d»)¸ÐDgÐhqÐgrð suðuõ uð
 vx×u|Ñu|ð  ~Có  vDõDð
 ESõS€Dô 
×	$Ò	$ S¨V¸?ÐRW×	XÕ	XÐ\]Ø	�‰�Œ¤ Q§V¡V£�i÷ 
Yà×Ñ�f˜\Õ)Ö*÷ 
Y×	Xús   Å7'G Ç G	c                  ó6  a€ \         P                  ! \        R 7      p V P                  R\        RR7       V P                  R\        RR7       Rm F!  qP                  RV,           \        RR7       K#  	  V P                  RRRR	7       V P                  R
RRR	7       V P                  RRRR	7       V P                  R\        RR7       V P                  4       p\        P                  ! VP                  P                  4       4      q3P                  R4      pVP                  R4      R8w  g   \        V\        4      '       d	   V'       g   \        R4      h\        4       pV EFB  oSP                  R4      p\        V\        4      '       d$   \         P"                  ! RV4      '       d   We9   d   \        R4      hVP%                  V4       \        SP                  R4      \        4      '       dA   \&        ;QJ d    V3R lRn 4       F  '       d   K   RM	  RM! V3R lRn 4       4      '       g   \        R4      hSP                  RR 4      p\)        V4      \*        Jg   ^Tu;8:  d   R!8:  g   M \        R"4      hVP,                  '       g   EK0  VR#8  g   EK:  \        R$4      h	  Ro Uu/ uF  qR%,           \/        \1        W!4      4      bK   	  pp\/        VP2                  4      VR&&   VP4                  P7                  RRR'7       VP4                  R(,          p	R)p
V	P9                  4       '       d#   W©P                  4       9  d   \;        R*V	 24      hV Uu/ uF  q»R,          R+bK  	  pp\=        VP4                  WL4       R,o V EFq  o\	        SR,          4      qÒP4                  SR,          ,          pSP                  RR 4      pVP?                  4       P@                  R-8  d1   R.VSR,          &   \=        VP4                  WL4       \        V R/24      hVP9                  4       '       Edõ   R0VSR,          &   \=        VP4                  WL4       \        P                  ! VR1,          P                  4       4      pVP                  R4      VPB                  8w  gØ   VP                  R24      VP?                  4       P@                  8w  gª   VP                  R34      SR,          SR,          .8w  g„   VP                  R4      SR,          8w  gg   VP                  R4      V8w  gQ   VP                  R44      V8w  g;   VR(,          PE                  4       '       d   VR5,          PE                  4       '       g   \        R6V 24      h\        P                  ! VR5,          P                  4       4      pVP                  R4      R78w  g   VP                  R84      VR8,          8w  d   \        R9V 24      hVR:,           F9  p\/        \G        VVR;,          4      4      VR<,          8w  g   K-  \        R=V 24      h	  \G        WïR>,          4       VR?,           Fc  p\G        VVR@,          4       VP                  RA4      '       d   \G        VVRA,          4       VRB,           F  p\G        VVR;,          4       K  	  Ke  	  VPH                  '       d-   VRC,          PE                  4       '       g   \        RDV RE24      hVP,                  '       d-   VRF,          PE                  4       '       g   \        RGV RE24      hVPJ                  '       d-   VRH,          PE                  4       '       g   \        RIV RE24      hVPL                  '       Edo   VRJ,          pVPE                  4       '       dL   \        P                  ! VP                  4       4      P                  RK4      \/        VPL                  4      8w  d   \        RLV RE24      hVPH                  '       g&   VP,                  '       g   VPJ                  '       Ed¿   VPH                  '       d3   \        P                  ! VRC,          P                  4       4      RM,          M. pVP,                  '       d3   \        P                  ! VRF,          P                  4       4      RM,          M. pVPJ                  '       d3   \        P                  ! VRH,          P                  4       4      RN,          M. pVRO,          pV'       g   V'       g	   V'       dÌ   VPE                  4       '       g   \        RPV RE24      h\        P                  ! VP                  4       4      pVP                  RK4      \/        VPL                  4      8w  gK   VV,           V,            Uu0 uF  pVR,          kK  	  upVRQ,           Uu0 uF  pVRR,          kK  	  up8:  g   \        RPV RE24      hRSVSR,          &   \=        VP4                  WL4       \O        RTVRRU7       EK›  \        VP4                  PQ                  RVSR,          ,           RW,           4      4      pV'       d8   R.VSR,          &   \=        VP4                  WL4       \;        RXV^ ,           24      h\	        \R        PT                  ! RVSR,          ,           RY,           VP4                  RZ7      4      pR[VSR,          &   \=        VP4                  WL4       \V        PX                  \        \	        \Z        4      P]                  R\4      4      R]\        V4      R^\        SR,          4      R_\        SR,          4      R`\        SR,          4      Ra\        V4      R\        V4      .pRm F/  pVP_                  RV,           \        \1        W!4      4      .4       K1  	  VPJ                  '       d   VPa                  Rb4       \O        RcSR,          VPB                  RRU7        \b        Pd                  ! VRRd7       \	        \Z        4      Pf                  pVPH                  '       d{   \V        PX                  \        VRe,          4      Rf\        V4      .p Rm F/  pV P_                  RV,           \        \1        W!4      4      .4       K1  	  \b        Pd                  ! V RRd7       VP,                  '       d{   \V        PX                  \        VRg,          4      Rf\        V4      .pRm F/  pVP_                  RV,           \        \1        W!4      4      .4       K1  	  \b        Pd                  ! VRRd7       VPL                  '       EdY   \V        PX                  \        VRh,          4      Rf\        V4      Ri\        VPL                  4      .p!\b        Pd                  ! V!RRd7       VPH                  '       d9   \        P                  ! VRC,          P                  4       4      RM,          '       g•   VP,                  '       d9   \        P                  ! VRF,          P                  4       4      RM,          '       gK   VPJ                  '       dY   \        P                  ! VRH,          P                  4       4      RN,          '       d!   \b        Pd                  ! V!Rj.,           RRd7       TPk                  T4       RSTSR,          &   \=        TP4                  YL4       \O        RlTRRU7       EKt  	  R,# u upi u upi u upi u upi   \h         d3    R.TSR,          &   \=        TP4                  YL4       \O        RkTRRU7       h i ; i  \h         d;    Se5   R.TSR,          &   \=        TP4                  YL4       h   \l         d     h i ; ih i ; i)p)Údescriptionz--jobsT)ÚtypeÚrequiredz--outputz--z--stack-proposalsÚ
store_truez<Run detector on all planes and add optional track hypotheses)ÚactionÚhelpz--tile-proposalsz<Add overlapping tiled detector hypotheses on the model planez--split-proposalszAGenerate split-mask alternatives for original detector candidatesz--species-weightszFAdd provisional DIAMORPH predictions for original and stack candidates)rC   rG   ÚfieldsÚformatzdiatom-field-jobs-v1zInvalid field jobsr   z[A-Za-z0-9][A-Za-z0-9_-]{0,63}zInvalid or duplicate field IDr   c              3   óŒ   <"  € T F9  p\        SP                  V4      4      \        J ;'       d    SV,          ^ 8¬  x € K;  	  R# 5i)é    N)rC   ÚgetÚint)r   Úkr8   s   & €r   r   Úmain.<locals>.<genexpr>2   s>   øé € Ð:xÑjwÐef¼4ÀÇÁÈÃ
Ó;KÌsÐ;R×;`Ð;`ÐWZÐ[\ÕW]Ð_`ÑW`Ô;`Ójwùs
   ƒ+A¯Ar   r   r   Fz"Invalid field coordinates or slideÚsizei   i   zInvalid field sizei€  z7Tiled proposals require fields at least 384 pixels wideÚ_sha256Úgallery_manifest_sha256)ÚparentsÚexist_okr"   r   z%Refusing to replace unrelated index: r	   Ni Êš;r   z( is below the 1 GB completed-file cutoffr   zbundle.jsonÚslide_size_bytesÚ	origin_xyÚmodelszfocus-planes.jsonz$Existing output does not match job: zdiatom-focus-planes-v1Ú	bundle_idz!Invalid existing focus manifest: ÚplanesÚimageÚsha256zExisting focus image changed: Úfield_imageÚ
candidatesÚcropÚmaskÚsuggestionszstack-proposals.jsonz2Existing output has no requested stack proposals: z; use a new output directoryztile-proposals.jsonz1Existing output has no requested tile proposals: zsplit-alternatives.jsonz3Existing output has no requested split hypotheses: zclassifier-suggestions.jsonÚmodel_sha256z?Existing output has no matching requested species predictions: Ú	proposalsÚ
hypothesesz'classifier-alternative-suggestions.jsonz9Existing output has no matching alternative predictions: ÚrecordsÚcandidate_idr   zAlready complete:)Úflushz	.partial-z-*z-Incomplete prior output requires inspection: Ú-)r    r   r   zrun_field.pyz--slidez--xz--yz--zz--sizez--split-hypothesesr   )Úcheckzstack_proposals.pyz--bundleztile_proposals.pyzclassifier_suggestions.pyz	--weightsz--alternativesz*Incomplete output retained for inspection:z	Complete:)ÚdetectorÚ	segmenterÚencoderÚgallery)r   r   r   )ri   rj   rk   )7ÚargparseÚArgumentParserÚ__doc__Úadd_argumentr   Ú
parse_argsÚjsonÚloadsr3   Ú	read_textrL   Ú
isinstanceÚlistÚ
ValueErrorÚsetÚstrÚreÚ	fullmatchÚaddÚallrC   rM   Útile_proposalsr   Úgetattrrl   r2   ÚmkdirÚexistsÚFileExistsErrorr@   ÚstatÚst_sizer%   Úis_filer   Ústack_proposalsÚsplit_proposalsÚspecies_weightsÚprintÚglobr.   ÚmkdtempÚsysÚ
executableÚ__file__Ú	with_nameÚextendr&   Ú
subprocessÚrunÚparentÚBaseExceptionÚrenameÚ	Exception)"ÚpÚkeyÚaÚdatar3   Úidsr9   rP   ÚhashesÚindexr5   r8   r4   r   ÚtargetÚbundleÚfocusÚplaneÚ	candidateÚrefÚpredÚtracksÚtilesÚsplitsÚaltÚpredictionsÚcr   Úexistingr?   ÚcommandÚscriptsÚstackÚ
classifiers"              `                      r   Úmainr°   #   s  ø€ Ü×Ò¬'Ô2€AØ‡N�N�8¤¨t€NÔ4°Q·^±^ÀJÔTXÐbf°^Ô5gÛ;ˆ¿N¹NÈ4ÐPSÍ8ÔY]Ðgk¸NÖ<lÑ;Ø‡N�NÐ&¨lÐ@~€NÔØ‡N�NÐ%¨\Ð?}€NÔ~Ø‡N�NÐ&¨lð  AD€Nô  EØ‡N�NÐ&¬DÐ6~€NÔØ‡l�lƒn€Aœ$Ÿ*š* Q§V¡V×%5Ñ%5Ó%7Ó8�T¿h¹hÀxÓ>P¸Ø‡x�x�ÓÐ1Ô1¼ÀDÌ×9NÒ9N×VZÔakð  mAó  bBð  \BÜ‹€CÜˆØ�g‰g�d‹mˆÜ˜%¤×$Ò$¬B¯LªLÐ9ZÐ[`×,aÒ,aÐejÔeqô  yCð  Dcó  ydð  sdØ�‰�ŒÜ˜#Ÿ'™' 'Ó*¬3×/Ò/·s³sÔ:xÑjwÓ:x·s·s²sÔ:xÑjwÓ:x×7xÒ7xô  @Jð  Koó  @pð  zpØ�W‰W�V˜CÓ ˆÜ�‹:œSÓ ¨¨4®°®¼JÐG[Ó<\Ð6\Ø××Ó  S§¬zÐ:sÓ/tÐ)tñ ñ =_Ó_Ñ<^°S�	�Mœ&¤¨£Ó0Ò0Ñ<^€FÐ_Ü&,¨Q¯Y©YÓ&7€FÐ$Ñ%Ø‡H�H‡N�N˜4¨€NÔ.Ø
�(‰(�<Õ
€EÐ'[ Ø‡|�|‡~‚~˜&¯©Ó(9Ô9ÄÐRwÐx}Ðw~ÐPó  AAð  ;AÙ+/Ó0©4 C��I�iÒ©4€FÐ0´ÀÇÁÈÔ1UØ€CðVÜˆCÜ�s˜7•|Ó$ˆE¯H©H°S¸µYÕ,> VÀCÇGÁGÈFÐSVÓDW¸tØ�z‰z‹|×#Ñ# MÔ1Ø"*��s˜4•yÑ!¬>¸!¿(¹(À4Ô+OÜ  E 7Ð*RÐ!SÓTÐTØ�}‰}�‹Ø",��s˜4•yÑ!¬^¸A¿H¹HÀTÔ-QÜ—z’z 6¨-Õ#7×"BÑ"BÓ"DÓE�Ø—J‘J˜wÓ'¨¯©Ô3°v·z±zÐBTÓ7UÐW\×WaÑWaÓWc×WkÑWkÔ7kØ—z‘z +Ó.°°Sµ¸#¸c½(Ð0CÔCÀvÇzÁzÐRUÃÐX[Ð\_ÕX`ÔG`Ø—z‘z &Ó)¨4Ô/°6·:±:¸hÓ3GÈÔ3OØ" <Õ/×8Ñ8×:Ò:À6ÐJ]ÕC]×BfÑBf×BhÒBhÜ$Ð'KÈFÈ8Ð%TÓUÐUÜ—j’j &Ð)<Õ"<×!GÑ!GÓ!IÓJ�Ø—9‘9˜XÓ&Ð(@Ô@ÀEÇIÁIÈkÓDZÐ\bÐcnÕ\oÔDoÜ$Ð'HÈÈÐ%QÓRÐRØ" 8Ÿ_˜_�EÜœf V¨E°'­NÓ;Ó<¸eÀH½oÖMÔT^Ðað  AGð  @Hð  `Ió  UJð  OJñ -ä�v ]Õ3Ô4Ø!'¨×!5Ð!5�IÜ˜6 )¨FÕ"3Ô4Ø —}‘} V×,Ò,¬V°F¸9ÀVÕ;LÔ-MØ(¨×7Ð7˜¼¸vÀcÈ'ÅlÖ8SÓ7ñ "6ð ×$×$Ð$¨fÐ5KÕ.K×-TÑ-T×-VÒ-VÜ$Ð'YÐZ`ÐYaÐa}Ð%~ÓÐØ×#×#Ð#¨VÐ4IÕ-I×,RÑ,R×,TÒ,TÜ$Ð'XÐY_ÐX`Ð`|Ð%}Ó~Ð~Ø×$×$Ð$¨fÐ5NÕ.N×-WÑ-W×-YÒ-YÜ$Ð'ZÐ[aÐZbÐb~Ð%ó  Að  AØ×$×$Ñ$ØÐ =Õ=�DØŸ<™<Ÿ>š>¬T¯ZªZ¸¿¹Ó8HÓ-I×-MÑ-MÈnÓ-]Ô_eÐfg×fwÑfwÓ_xÔ-xÜ(Ð+jÐkqÐjrð  sOð  *Pó  Qð  QØ×(×(Ð(¨A×,<×,<Ð,<À×@Q×@QÑ@QØhi×hy×hyÐhy¤§
¢
¨FÐ3IÕ,I×+TÑ+TÓ+VÓ WÐXcÖ dð  @B˜Øfg×fv×fvÐfvœtŸzšz¨6Ð2GÕ+G×*RÑ*RÓ*TÓUÐVaÖbÐ|~˜Ølm×l}×l}Ðl}¤§
¢
¨FÐ3LÕ,L×+WÑ+WÓ+YÓ ZÐ[gÖ hð  DF˜Ø"Ð#LÕL˜ß!§U¯fØ#&§;¡;§=¢=´zÐD}ð  Eð  ~Fð  Fbð  Ccó  8dð  2dÜ(,¯
ª
°3·=±=³?Ó(C˜KØ*Ÿ™¨~Ó>ÄÀq×GXÑGXÓ@YÔYÐsyÐzÕsð  AGö  tGó  bHñ  tGÐnoÐbcÐdh×biÐbiñ  tGñ  bHð  fqð  r{ö  f|ó  J}ñ  f|ð  abð  KLð  M[÷  K\ð  K\ñ  f|ñ  J}ô  b}Ü&0Ð3lÐmsÐltð  uQð  2Ró  'Sð  !SØ",��s˜4•yÑ!¬^¸A¿H¹HÀTÔ-QÜÐ)¨&°tÕ<ºXÜ˜!Ÿ(™(Ÿ-™-¨°C¸µIÕ(=¸dÕ(BÓCÓDˆHßØ"*��s˜4•yÑ!¬>¸!¿(¹(À4Ô+OÜ%Ð(UÐV^Ð_`ÕVaÐUbÐ&cÓdÐdÜœ8×+Ò+°;¸sÀ4½yÕ3HÈÕ3LÐQR×QYÑQYÔZÓ[ˆIØ*ˆF�3�t•9Ñ¬>¸!¿(¹(À4Ô+OÜ—^‘^¤C¬¬X«×(@Ñ(@ÀÓ(PÓ$QÐR[Ô\_Ð`eÓ\fØœ3˜s 3�x›=¨¬s°3°sµ8«}¸UÄ3ÀsÈ3ÅxÃ=ÐQYÔZ]Ð^bÓZcÐdnÔorÐs|Óo}ðˆGãC�ÀGÇNÁNÐTXÐY\ÕT\Ô]`ÔahÐijÓaoÓ]pÐSqÖDrÑCØ× × Ð  §¡Ð0DÔ!EÜ�,˜s 4�y¨¯©¸$Õ?ð_Ü—’˜w¨TÕ2ÜœX›×-Ñ-�Ø×$×$Ð$ÜŸ>™>¬#¨gÐ6JÕ.JÓ*KÈJÔWZÐ[dÓWeÐf�EÛK˜ÈEÏLÉLÐZ^Ð_bÕZbÔcfÔgnÐopÓguÓcvÐYwÖLxÑKÜ—N’N 5¨tÕ4Ø×#×#Ð#ÜŸ>™>¬#¨gÐ6IÕ.IÓ*JÈ:ÔVYÐZcÓVdÐe�EÛK˜ÈEÏLÉLÐZ^Ð_bÕZbÔcfÔgnÐopÓguÓcvÐYwÖLxÑKÜ—N’N 5¨tÕ4Ø×$×$Ñ$Ü #§¡¬s°7Ð;VÕ3VÓ/WÐXbÔcfÐgpÓcqÐr}ô  Bð  CD÷  CTñ  CTó  Uð   V�JÜ—N’N :°DÕ9Ø×*×*Ð*¬t¯zªz¸9ÐE[Õ;[×:fÑ:fÓ:hÓ/iÐju×/vÔ/vØ×,×,Ð,´·²¸YÐG\Õ=\×<gÑ<gÓ<iÓ1jÐkv×1wÔ1wØ×-×-Ð-´$·*²*¸iÐHaÕ>a×=lÑ=lÓ=nÓ2oÐp|×2}Ô2}Ü"Ÿš zÐ3CÐ2DÕ'DÈ4ÕPð ×Ñ˜VÔ$Ø(ˆF�3�t•9Ñ¬¸¿¹ÀÔ)MÜ�+˜f¨4×0Ð0ó_ ùò `ùò
 1ùòX bHùò  J}øôB !ô _Ø"*��s˜4•yÑ!¬>¸!¿(¹(À4Ô+OÜÐBÀ9ÐSWÕXÐY^ð_ûô ô ØŠ?Ø&ˆF�3�t•9ÑÜ˜qŸx™x¨Ô4àøô Ô!˜TØð "úØðús4  Ê,${?Í|ÎB(} Ð.D&} Õ} Õ2B+} Ø"B#} Û} Û# } Ü} Ü! } Ý} Ý!} Þ} Þ A+} à} à} à1} áA} â	A} ãA} ä} ä} ä$} ä:A.} æ(|	æ:} ç|çG7} ï1} ðC|óB|õB#|ø|ø7|ù|ù7|ú |ú7A} ü	
} ü=}ý} ý~ý.~þ~þ~þ~þ~þ~Ú__main__)ro   rm   r#   rr   rz   r‘   rŒ   r.   r   r   Úpathlibr   Úingest_reviewr   r   r@   r°   Ú__name__r   ó    r   Ú<module>r¶      sC   ðÙ RÛ Û Û Û 	Û Û 
Û ß &Ý ç 'ò+ò(pðf ˆZÔ™žÑrµ   