From daebaa0efcb4f7f78849341fbc4a24c3077d7c0f Mon Sep 17 00:00:00 2001 From: x12sa Date: Fri, 3 Jul 2026 07:02:07 +0200 Subject: [PATCH] adjustments --- .../flomni/flomni_webpage_generator.py | 54 +++++++++++++++---- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_webpage_generator.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_webpage_generator.py index b00622e..5fb7fe2 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_webpage_generator.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_webpage_generator.py @@ -2616,16 +2616,18 @@ function renderBeamlineStates(bl){{ // Key params to show in expanded job detail, in display order. const TQ_PARAM_DISPLAY = [ - ['tomo_type', 'Type'], - ['tomo_countingtime', 'Exposure (s)'], - ['fovx', 'FOV x (\u00b5m)'], - ['fovy', 'FOV y (\u00b5m)'], - ['tomo_angle_stepsize', 'Angle step (\u00b0)'], - ['tomo_angle_range', 'Angle range (\u00b0)'], - ['tomo_shellstep', 'Shell step (\u00b5m)'], - ['stitch_x', 'Stitch x'], - ['stitch_y', 'Stitch y'], - ['ptycho_reconstruct_foldername','Recon folder'], + ['tomo_type', 'Type'], + ['tomo_countingtime', 'Exposure (s)'], + ['fovx', 'FOV x (\u00b5m)'], + ['fovy', 'FOV y (\u00b5m)'], + ['tomo_angle_stepsize', 'Angle step (\u00b0)'], + ['tomo_angle_range', 'Angle range (\u00b0)'], + ['tomo_shellstep', 'Shell step (\u00b5m)'], + ['stitch_x', 'Stitch x'], + ['stitch_y', 'Stitch y'], + ['frames_per_trigger', 'Frames/trigger'], + ['single_point_instead_of_fermat_scan','Single point'], + ['ptycho_reconstruct_foldername', 'Recon folder'], ]; function fmtTqParam(key, val){{ @@ -2636,6 +2638,11 @@ function fmtTqParam(key, val){{ function renderTomoQueue(jobs){{ const el=document.getElementById('tomo-queue-content'); + // Snapshot which job indices are currently open before replacing innerHTML + const openIndices=new Set(); + el.querySelectorAll('details.tq-job').forEach((det,i)=>{{ + if(det.open) openIndices.add(i); + }}); if(!jobs||jobs.length===0){{ el.innerHTML='
No jobs queued
'; return; @@ -2645,16 +2652,41 @@ function renderTomoQueue(jobs){{ const status=job.status||'pending'; const label=job.label||('Job '+(i+1)); const params=job.params||{{}}; + // Auto-open running jobs on first render; preserve user-opened state after that + const shouldOpen=openIndices.size>0?openIndices.has(i):(status==='running'); let paramRows=''; TQ_PARAM_DISPLAY.forEach(([key,dispLabel])=>{{ if(key in params){{ paramRows+=''+dispLabel+''+esc(fmtTqParam(key,params[key]))+''; }} + // After angle step, inject a computed projection count row. + // Formula must match _tomo_type1_actual_grid() / tomo_parameters() exactly: + // type 1: N = int(range / stepsize), corrected_step = range / N, total = N * 8 + // type 2/3: golden_max_number_of_projections directly + if(key==='tomo_angle_stepsize'){{ + const ttype=params.tomo_type; + let nproj=null; + if(ttype===2||ttype===3){{ + // golden ratio / equally-spaced golden: capped at golden_max_number_of_projections + const gmax=params.golden_max_number_of_projections; + nproj=(gmax!=null&&gmax>0)?gmax:null; + }}else{{ + // type 1: 8 equally-spaced sub-tomograms. + // int(range/stepsize) = N per sub-tomo; total = N * 8 + // (mirrors _tomo_type1_actual_grid: N=int(range/step), total=N*8) + const range=params.tomo_angle_range, step=params.tomo_angle_stepsize; + if(range>0&&step>0){{ + const N=Math.floor(range/step); + nproj=N*8; + }} + }} + if(nproj!=null) paramRows+='Projections'+nproj+''; + }} }}); const addedAt=job.added_at ?'Added '+new Date(job.added_at).toLocaleString([],{{month:'short',day:'numeric',hour:'2-digit',minute:'2-digit'}}) :''; - html+='
' + html+='
' +'' +'#'+(i+1)+'' +''+esc(label)+''