Popular Post AspirinJunkie Posted March 20 Popular Post Posted March 20 (edited) Adjustment UDF — Least Squares Adjustment for AutoIt You have measurements. They don't perfectly agree. You need the best answer. Least squares adjustment finds the optimal values from redundant, contradictory observations — and tells you exactly how reliable the results are. It's the mathematical foundation behind positioning, navigation, calibration, curve fitting, regression, signal processing, and virtually any domain where measurements meet reality. This UDF brings that capability to AutoIt with a radically simple interface: describe your model as string formulas, add measurements with their uncertainties, and call _adj_solve(). No matrix algebra, no numerical recipes, no external tools — just your problem and your data. Underneath, it's a complete adjustment engine powered by OpenBLAS, with nonlinear iterative solvers, variance component estimation, robust estimators, and full statistical diagnostics — the kind of tooling normally reserved for MATLAB or specialized scientific software. Download: Latest Release on GitHub GitHub: https://github.com/Sylvan86/autoit-adjustment-udf Quick Start #include "Adjustment.au3" ; 5 measurements of a distance — find the best estimate and accuracy Local $mSystem = _adj_createSystem() _adj_addObsFunction($mSystem, "M1", "X", 10.02, 1.0) _adj_addObsFunction($mSystem, "M2", "X", 9.98, 1.0) _adj_addObsFunction($mSystem, "M3", "X", 10.01, 1.0) _adj_addObsFunction($mSystem, "M4", "X", 10.03, 1.0) _adj_addObsFunction($mSystem, "M5", "X", 9.99, 1.0) _adj_setInitialValue($mSystem, "X", 10.0) _adj_solve($mSystem) ConsoleWrite(_adj_displayResults($mSystem)) ; Result: X = 10.006 ± 0.009 This is just the simplest case — a mean value. The real strength lies in simultaneously adjusting different measurements with different formulas. For example, determining a point's position from distance and direction measurements, or fitting a curve to data while enforcing constraints. Feature Overview For experts — the full scope of the UDF: Model Types OLS / WLS / GLS — Overdetermined system (weighted, generalized with full covariance matrix) LSE / WLSE / GLSE — With parameter constraints CLS / WCLS / GCLS — Condition adjustment GLM / WGLM / GGLM — Gauss-Helmert model (most general form) Model type detection is automatic based on the input structure. Solvers and Iteration Methods Iteration method: Gauss-Newton, Levenberg-Marquardt (Nielsen damping) Linear solver: QR decomposition (DGELSY), Singular Value Decomposition (DGELSD) Jacobian matrices: Numerical (Central, Forward, Backward, Ridder, Higham) or analytical Scaling: Jacobi equilibration (automatic column scaling) Statistics and Diagnostics Basic statistics: A posteriori variance factor s0², degrees of freedom, vTPv Accuracy: Cofactor matrix Qxx, standard deviations (parameters, observations) Controllability: Redundancy numbers r_i, cofactor matrices Qvv and Qy Model validation: Global test (Chi²) Outlier diagnostics: Baarda test (w-statistic), Pope test (tau-statistic), p-values, MDB Variance Component Estimation (VCE) Helmert method: Separate variance factors for different observation groups (e.g. distances vs. angles). Iterative until convergence. Robust Estimation (IRLS) L1 (Median) — Breakdown point: 50% Huber (c = 1.345) — Breakdown point: ~5% Hampel (a = 1.7, b = 3.4, c = 8.5) — Breakdown point: ~25% Biweight (Tukey) (c = 4.685) — Breakdown point: 50% BIBER (Schweppe) (c = 3.5) — Breakdown point: leverage-dependent Modified-M (Koch) (c = 1.5) — Breakdown point: leverage-dependent Scale parameters: MAD, s0, a priori, user-defined. Additional Features Symbolic formula input as strings — parameters and observations are detected automatically Compute-on-demand — statistics are only calculated when requested Configurable result display with selectable columns and sections Outlier detection and removal (_adj_getOutliers, _adj_removeObs) Installation Requirements: AutoIt v3.3.16+ (x64) OpenBLAS DLL (libopenblas_x64.dll) Setup: Download: Get the latest release from GitHub Releases Extract: Unpack the files into a directory OpenBLAS: The libopenblas_x64.dll is downloaded automatically on first run, or can be placed manually in the UDF directory Include: $__g_hBLAS_DLL = DllOpen("libopenblas_x64.dll") #include "Adjustment.au3" Documentation The full documentation is available on GitHub: Tutorial — Step-by-step guide, 9 chapters (Beginners) Feature Overview — Full capabilities at a glance (Everyone) API Reference — All 17 public functions (Developers) Configuration — Solver, display, and robust config (Advanced) Result Structure — All keys of the result map (Advanced) Model Types — OLS to GGLM with mathematics (Experts) Solvers — GN, LM, QR, SVD in detail (Experts) Statistics — s0, Qxx, global test, Baarda/Pope (Experts) Robust Estimation — IRLS, 6 estimators, weight functions (Experts) Error Codes — All $ADJ_ERR_* with solutions (Everyone) Tutorial Chapters Getting Started — What is adjustment? First Network — Trilateration Weighting — Accounting for measurement precision Mixed Observations — Combining distances and angles Constraints — Restrictions and fixed parameters Regression — OLS, orthogonal, Deming, York Covariance Matrix — Correlated measurements Understanding Results — Configuring and interpreting output Robust Estimation — Handling outliers Download >>> Download the latest release from GitHub <<< Source code and issue tracker: https://github.com/Sylvan86/autoit-adjustment-udf Edited March 21 by AspirinJunkie Gianni, Andreik, SOLVE-SMART and 4 others 7
AspirinJunkie Posted March 25 Author Posted March 25 (edited) For those of you who (understandably) still find this a bit too abstract, I’ve added another example to the Example folder: InteractiveCircleFit.au3 (it’s in German, but that shouldn’t be too much of a problem) With this script, the user clicks on any points on the canvas, and the script uses those points to fit a circle that best matches them: In my opinion, this example is very useful because it allows you to quickly visualize many aspects of adjustment analysis: - What are observations, and what are parameters? - What are these "residuals"? - What do the standard deviations mean? - What exactly is being "adjusted" here? - What does "robust adjustment" mean? Just play around with it (the new release is on GitHub). Note on authorship: Since I’m not really a visual person and know absolutely nothing about graphics in AutoIt, I relied heavily on Claude for this sample script. I’m very pleased with the result and glad that Claude fully understood how to use my UDF. Edited March 25 by AspirinJunkie funkey and mLipok 2
AspirinJunkie Posted Thursday at 09:30 AM Author Posted Thursday at 09:30 AM Adjustment UDF v26.4 — Release Notes This release ships a complete interactive regression tool as an example, significantly faster robust estimation, and several new diagnostic and statistics features. A number of numerical and code-level bugs have also been fixed. Download: Release v26.4 on GitHub Highlight: Interactive Regression The new example examples/InteractiveRegression.au3 is a complete GUI tool for least-squares curve fitting. It bundles all of the UDF's core capabilities into a single interactive surface — and works as a learning tool: tweak the modes and data, and you can see directly in the plot how error assumptions, weighting, and model choice change the result. Features: Four regression modes: Normal (OLS/WLS), Orthogonal (TLS), Deming, YorkSymbolic formula input with automatic parameter and observation detection (e.g. A * #X + B)Editable tables for data and parameters, with Tab/Enter/arrow-key navigation and Excel-compatible multi-cell pasteLive plot with data points, fitted curve, residual lines, and optional 1σ/2σ confidence band (GDI+)Robust estimation with all six M-estimators of the UDFCSV import (auto-detect separator and decimal mark) and CSV export with formula metadata (round-trip)Prediction with proper σ propagationOutlier highlighting based on normalized residuals"σ · s₀" button for global variance-factor rescaling of σ inputs Performance: Faster Robust Estimation Iteratively Reweighted Least Squares (IRLS) dominates runtime on large problems or when many iterations are needed. Several optimizations cut robust-estimation runtime substantially without affecting accuracy: Warm-start the Gauss-Newton inner loop between IRLS iterationsCap inner GN/LM iterations during re-solvesSkip pre-VCE state reset in single-pass modeDefault IRLS convergence tolerance loosened (1e-3 → 1e-2)Cascade-init (Huber → redescending) is off by default but still available via cascadeInit New Features Statistics Parameter correlation matrix available on demandCondition number of the normal-equations matrix exposed routinely (previously only in the SVD fallback)Sanity check tr(R) = f surfaces silently broken redundancy numbers Diagnostics Iterative data snooping with soft downweighting (instead of hard outlier removal)External reliability (opt-in): minimum detectable bias δ₀ᵢ and parameter effect ∇xᵢ of every undetected outlier Convergence Gradient test ‖g(x)‖ < tol is enforced additionally when restrictions are presentParameter-correction tolerance scales with parameter magnitude (avoids false convergence for very small parameters) Solver / Robust Cascade-init Huber → redescending (MM-estimator) as an optional modeInitial Marquardt damping factor lmTau is now configurable Bug Fixes VCE / Robust Statistics are refreshed with the final weights after VCE convergenceσ̂² is clipped at the MIN_SIGMA2 floor instead of being reset to 1.0Active VCE forces the weighted solve path; clipped σ̂² is now correctly reported to the caller as non-convergenceMAD scale uses the a-priori 1/σᵢ instead of the live whitening vectorrobustParams are auto-filled with defaults when the caller leaves them Null__adj_initWeights used to skip weight init for σ=1 + multi-VCE-group → fixed Statistics / Diagnostics diag(Qvv) and diag(Qŷ) are floored at 0 before sqrt (previously caused NaN on machine-precision negative values)Pope statistic now correctly uses the τ distribution instead of Student-tBaarda/Pope p-values are computed in a numerically stable way (no catastrophic cancellation for large w/τ) Solver LM convergence test on the GLM/CLS path is now residual-based (r2sum) instead of parameter-basedStep-size scaling for numerical differentiation smooth-blends across regimes instead of switching hard API _adj_setInitialValue now creates missing parameters instead of erroring_adj_removeObs resets _prepareRunCount correctly; avoids a crash on the next solve call Code Quality Several undeclared locals in AdjustmentStats / AdjustmentDiagnostics that leaked into the ByRef caller scope have been fixedAu3Check cleanup across all UDF and example files Compatibility Fully backward compatible with v26.3.x. No API changes other than additions. Default behavior is unchanged — the performance-related default tweaks affect robust estimation only and remain conservative (see _adj_robustDefaults). Download >>> Download release v26.4 from GitHub <<< Source code and issue tracker: https://github.com/Sylvan86/autoit-adjustment-udf mLipok 1
mLipok Posted Thursday at 11:16 AM Posted Thursday at 11:16 AM @water could you take a look here. Maybe should be added to https://www.autoitscript.com/wiki/User_Defined_Functions ? water 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
mLipok Posted Thursday at 11:17 AM Posted Thursday at 11:17 AM 1 hour ago, AspirinJunkie said: This release ships a complete interactive regression tool as an example, significantly faster robust estimation, and several new diagnostic and statistics features. A number of numerical and code-level bugs have also been fixed. great job Thanks AspirinJunkie 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
water Posted Friday at 04:41 PM Posted Friday at 04:41 PM On 4/30/2026 at 1:16 PM, mLipok said: @water could you take a look here. Maybe should be added to https://www.autoitscript.com/wiki/User_Defined_Functions ? Done 🙂 AspirinJunkie and mLipok 2 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now