To review later: simple parameter calculation #154
Open
opened 2026-08-20 20:57:08 +02:00 by duan_j
·
0 comments
No Branch/Tag Specified
main
gitea-pages
fix/automation_errors
fix/spreadsheetupdate_config
fix/automation_jfjoch_aarescan_failures
feat/busy_state_lock
fix/aaregui-zmq
feat/select_meitians_gridscan_analysis
fix/scan-panel-user-values
fix/errors_from_transmission_update
feat/update_transmission
fix/add_more_debug_to_aarescan
fix/add_automation_logging
fix/floor_chi_for_jfjoch
feat/add_phi_chi_to_jfjoch_metadata
fix/zoom_before_xraycenter
fix/remove_pvs
fix/detector_tilt
fix/change_gap_with_energy
fix/beam_center_structure
fix/improve-overwrite-error-message
feat/1d_beam_center
fix/use_bec_client_detz_values
fix/beamline_debugging_260827
feat/integrate_fluo
style/cosmetics
fix/new_macro_signatures
fix/updated_10s_macros
fix/init_shutdown
feat/setup_around_beam_steering
feat/beam_centre_from_det_2
fix/dont_unmount_on_park_and_dry
feat/beam_centre_from_det
fix/actually_truncate_dtz
fix/param_calculation
fix/baton-message-box
feat/user-gui-optimizations
fix/pxii_commissioning_260820
fix/pitch_scan_message
fix/screening_request
fix/save_coll_positions
improve_wording
fix/save_bs_positions
feat/add_beam_steering_routine
fix/read_state_on_startup
fix/moving_state
perl_d-patch-1
feat/lazy_jfj
fix/remove_disabled_current_log
refactor/remove_direct_pvs
fix/gui_startup
docs/update_cs
docs/redo_docs
fix/add_x06da_bec_macros
ci/lock_in_ci
fix/update_uvicorn_dep
fix/handle_no_ring_current
fix/update_deps
fix/workflow_fetch_auth_2
fix/workflow_fetch_auth
feat/release_workflow
pxiii-live-changes
fix/exception_typo
live_260715
fix/validate_detector_speed
live_260713
live_260710
feat/cached_status
fix/reduce_inner_workers
fix/no_none_operation
fix/suppress_baton_error
fix/remove_logs
gui_default_parameters
fix/reverted_import
end_operation_after_error
live_260709
feat/server_about
live_260708
fix/live_tests
fix/crash_on_no_bec
feat/display_path_env
fix/logging_improvements
refactor/use_aarecommon
chore/better_gitignore
chore/add_uv_dep
feature/beam-marker-daq
new-gui-redesign
ml_zoom
raster_score
operation_standardisation
apache-auth
find_crystal_from_gridscan
x10sa
x10sa-tutorial
TellSampleHandling
CheckedLineEdit
monday_1st_december
progressbar
master-unstable
ReferenceToolSort
ParseSampleParamsFromDB
daq_raster_predicition
reference-tools
zoom_manager
prediction
tellupdater
beamcenter_fit
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.1
v0.23.0
v0.22.1
v0.22.0
v0.21.3
v0.21.2
v0.21.1
v0.21.0
v0.20.0
v0.19.5
v0.19.4
v0.19.3
v0.19.2
v0.19.1
v0.19.0
v0.18.0
v0.17.5
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.0
v0.15.0
v0.14.0
v0.13.5
v0.13.4
v0.13.3
v0.13.2
v0.13.1
v0.13.0
v0.12.5
v0.12.4
v0.12.3
v0.12.2
v0.12.1
v0.12.0
v0.11.0
v0.10.0
v0.9.0
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.1
v0.6.0
v0.5.2
v0.5.1
v0.5.0
v0.4.0
0.3.3
0.3.2
0.3.1
0.3.0
0.2.69
0.2.68
0.2.67
0.2.66
0.2.65
0.2.64
0.2.63
0.2.62
0.2.61
0.2.6
0.2.4
0.2.3
0.2.2
0.2.1
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: mx/AareDAQ#154
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why resolution/distance changes the measurement time
The "Simple" tab (smart_rotation_panel.py:17, class SimpleRotationSettingsPanel) is dose-driven, not time-driven. It has no exposure-time input and no editable detector distance — both are outputs computed from one input, the visible resolution, inside update_calculated_labels() (smart_rotation_panel.py:305-408):
d_vis = visible_res − 0.2 # fudge factor, line 315
d_tar = 1 / (1/d_vis + 0.1) # "Target resolution", line 318
target_dose = 10 · d_tar / 2 # cryo; 0.1·d_tar/2 if T > 250 K (lines 344-347)
dose_rate = flux / (beam_x·beam_y·2000/λ²) / 1e6 # flux HARD-CODED 2.5e11, line 308
total_time = target_dose / dose_rate # line 353 ← resolution → time
image_time = total_time / round(total_angle / image_angle) # line 362
dtz = detector_radius / tan(2·asin(λ/(2·d_tar))) # line 369 → aarecommon calc_dtz_mm
So the target dose budget is linear in the target d-spacing (a scaled Garman limit: 10 MGy at 2 Å). Coarser resolution → bigger allowed dose → longer total time, and simultaneously → larger detector distance via Bragg. Distance and time are siblings of the same variable d_tar, not cause and effect. If the computed frame time drops below the 1.1 ms detector floor, time is pinned and transmission is attenuated instead (lines 363-367).
Since dtz is a read-only label on this tab, "changing detector distance changes the time" happens two ways: editing resolution recomputes both together, and there's a feedback loop — after each raster the server stores the best observed spot resolution (raster/service.py:646), and the panel's 500 ms status tick writes it back into the resolution field and recomputes (smart_rotation_panel.py:236-244). The Rotation/Raster tabs don't do any of this — there dtz↔resolution are two views of one editable quantity and time is plain (total_angle/image_angle)·image_time.
Where it goes: "Run rotation" builds a RotationScanRequest(dtz, exp_time_s, steps, transmission) (lines 410-423) that physically moves the detector (daq.py:1960-1970); every recompute also pushes SimpleScanParameters → Redis auto_params, but automation calls get_collection_params(prefer_smart=False) so database params win and Simple values are only the fallback.
Defects noticed en route (noted, not touched): flux hard-coded at 2.5e11 while the label shows live flux, so the computed time is wrong whenever they differ; line 80 wires visible_res_enter to set_total_angle (Total-angle edits have no direct recompute trigger); the crystal-size-corrected dose rate is display-only while time uses the uncorrected one; self.transmission uninitialized → AttributeError if "Run rotation" is clicked before the first DAQ status; the alert-colored dtz label shows the unclamped value while the clamped dtz_min is what's sent; and number_line_edit.py:102 is a no-op (saved_value = saved_value) that currently protects a user-typed resolution from being stomped by the 2 Hz tick — fixing it naively would break manual entry. Full trace with all line references is in the plan file.