Upload files to "/"

This commit is contained in:
2026-09-24 01:31:32 +00:00
parent d608ec3d31
commit 752fb79048
3 changed files with 405 additions and 52 deletions
+50 -11
View File
@@ -23,6 +23,9 @@ FM4I.6](https://doi.org/10.1364/FIO.2012.FM4I.6)) — see
## Features
- **Two operation modes.** *Fitting* imports a measured scan and compares the
simulation with it. *Simulation* calculates and displays the signals with no
data at all, over a z range you specify.
- **Load raw scan files** with configurable 1-indexed column mapping, so data
from different acquisition setups can be read without editing the file. A
header row is skipped. Leaving the delimiter blank splits on whitespace,
@@ -90,30 +93,58 @@ python zscan_gui.py
## Usage
1. **Browse** to a scan file and set the column numbers for position, CA, OA and
1. **Choose the Operation Mode** — *Fitting* (the default) or *Simulation*.
The steps below describe Fitting; for Simulation see
[Simulation mode](#simulation-mode).
2. **Browse** to a scan file and set the column numbers for position, CA, OA and
the reference channel. Columns are 1-indexed, matching how they are usually
numbered in acquisition software.
2. **Import.** The Referenced / Normalized tab shows the raw and corrected
3. **Import.** The Referenced / Normalized tab shows the raw and corrected
traces with the baseline fit drawn over them, so you can confirm the columns
and flags are right before simulating. Changing a column or a processing flag
re-reads the file and redraws immediately.
3. **Enter the measurement parameters** — pulse energy, wavelength, beam waist,
4. **Enter the measurement parameters** — pulse energy, wavelength, beam waist,
pulse width, sample thickness and refractive index, aperture transmittance.
4. **Run Simulation** to overlay the simulated curves on the data.
5. **Refine Fit** — tick the coefficients to vary and let the optimizer adjust
5. **Run Simulation** to overlay the simulated curves on the data.
6. **Refine Fit** — tick the coefficients to vary and let the optimizer adjust
them. It runs in the background with a live iteration count.
6. **Export** to write the fit data, log and images next to the input file.
7. **Export** to write the fit data, log and images next to the input file.
### Simulation mode
Selecting **Simulation** calculates the signals without any measurement. Every
input that describes a data file is switched off — the Data File, Data Columns
and Processing Flags boxes, along with **Import**, **Refine Fit**, **Max
iterations** and the Referenced / Normalized tab — and **Run Simulation**
becomes available with nothing imported.
The scan's extent is not measured but stated: **z range (sim.)** sets the
half-width in Rayleigh ranges *z₀* either side of focus (default 15). The
Fit Results panels show the simulated curves alone, padded by 5% above and
below, and the log reports the simulated peak-to-valley values in place of the
data-versus-fit comparison and chi-squares.
**Show CA (else OA/CA)** stays available, since it selects which curve the
right-hand panel draws and both are simulated. Ticking it repeats the run so
the plot follows immediately.
Anything already imported is kept while you work in Simulation, so switching
back to Fitting does not mean importing again. Switching either way clears the
results on screen, which belonged to the other mode.
### Exported files
Written alongside the input file, with an optional extra label in the name:
Written alongside the input file, with an optional extra label in the name. In
Simulation mode there is no input file to name them from, so **Export** asks
where to write; the CSV then holds the simulated curves and no reference figure
is produced:
| File | Contents |
|---|---|
| `<name>_fit.<ext>` | CSV of position, data and fit for the OA, CA and CA/OA curves |
| `<name>_fit.<ext>` | CSV of position, data and fit for the OA, CA and CA/OA curves; in Simulation, position and the simulated OA, CA and CA/OA |
| `<name>_fit_log.txt` | Every parameter, fit-quality metric and output path |
| `<name>_fit.jpg` / `.svg` | Fit figure, raster and vector |
| `<name>_fit_ref.jpg` / `.svg` | Referenced/normalized figure |
| `<name>_fit_ref.jpg` / `.svg` | Referenced/normalized figure (Fitting only) |
## Project structure
@@ -141,6 +172,13 @@ The program is split so the physics can be used without the interface:
## Parameters
### Operation mode
| Option | Effect |
|--------------|-----------------------------------------------------------------|
| `Fitting` | Default. Imports a scan and compares the simulation with it. |
| `Simulation` | No data: the calculated signals are shown alone, over `z range (sim.)`. The data-file inputs, Import, Refine Fit, Max iterations and the Referenced / Normalized tab are disabled. |
### Data columns (1-indexed)
| Variable | Default | Column contents |
@@ -218,14 +256,15 @@ uncertainty
| Parameter | Default | Meaning |
|-------------|---------|-----------------------------------------------------|
| `z_points` | `75` | Number of z-scan points (must be even) |
| `z_points` | `76` | Number of z-scan points (must be even) |
| `r_points` | `500` | Radial points at the sample |
| `r_max` | `3` | Radial integration limit, in beam radii *w* |
| `t_points` | `50` | Temporal points |
| `t_max` | `3` | Temporal integration limit, in pulse widths *τ* |
| `ra_points` | `50` | Radial points at the closed aperture |
| `endpts_%` | `10` | Percentage of edge points to use for normalization |
| `max_iter` | `100` | Maximum iterations for the parameter refinement |
| `z range (sim.)` | `15` | Half-width of the simulated scan, in Rayleigh ranges *z₀*. Simulation mode only |
| `max_iter` | `100` | Maximum iterations for the parameter refinement (Fitting only) |
Memory use scales as `r_points x ra_points x t_points x z_points`, so raising
the grid resolution raises RAM sharply; the interface shows the estimate as you