pnps.scan#
Delay-scan driver: a plain loop with per-point writes and resume.
The simplest thing that scales: one process scans (a shard of) the delay axis and writes
each point into its own HDF5 file immediately after computing it. Interrupted scans
resume by skipping already-written points. One bridge to solprop
(pnps.bridge.build_bridge()) is built per process and reused for every delay
point, so the problem is translated and the backend allocated once. For several nodes,
run one process per shard (shard=(i, n) computes delay indices i::n) and merge
with pnps.io_h5.merge_shards(). run_separation_scan() is the same loop for
the transient-grating separation (pnps.separation).
Functions
|
Run a delay scan and write |
|
Run a transient-grating separation over a delay axis. |
- pnps.scan.run_scan(cfg, taus, scan_name, zsave, h_target, out_dir='.', shard=None, indices=None, skip_existing=True, backend='auto')[source]#
Run a delay scan and write
<scan_name>_collected.h5.- Parameters:
- cfgConfig
The simulation configuration.
- tausnumpy.ndarray
The full delay axis in s (identical across shards).
- scan_namestr
Base name of the output file.
- zsavenumpy.ndarray
Save positions in m, see
pnps.simulate.simulate_delay_point().- h_targetfloat
Largest step of the replayed schedule in m — calibrate with
pnps.calibratebefore a production scan.- out_dirstr or pathlib.Path
Directory for the output file.
- shardtuple of (int, int) or None
(i, n): compute only delay indicesi::nand write to<scan_name>_collected.shard<i>.h5. None computes everything into the collected file directly.- indicessequence of int or None
Compute only these delay indices, leaving the rest of the file zero. The delay axis is still written in full, so the result is a partial scan on the production sampling rather than a different scan — which is what a validation subset has to be if it is to be compared against a reference cell for cell. Cannot be combined with
shard.- skip_existingbool
Skip delay points whose slice in the target file is already non-zero (resume after interruption).
- backendstr
The solprop backend registry name (
"auto", which is"native";"native";"numpy_ref"). The backends agree to a stated floating-point bound rather than bit-for-bit, so a scan should not mix them; the recorded metadata names the one used.
- Returns:
- pathlib.Path
The file written by this process.
- pnps.scan.run_separation_scan(cfg, taus, scan_name, zsave, h_target, out_dir='.', shard=None, indices=None, skip_existing=True, backend='auto')[source]#
Run a transient-grating separation over a delay axis.
Writes
<scan_name>_collected.h5(or one shard of it) in the layout ofrun_scan(), itsIω_*traces holding the transient-grating field alone (pnps.separation) and/grid/field_partsaying so. Beside them it records the whole nonlinear field’s and the remainder’s window traces (pnps.separation.part_trace_names()) and/grid/energy_prefactor, which turns a trace summed over frequency into joules. The bridge reduces on the host whatever the configuration asks for; each process propagates the three delay-free subsets once and four subsets per delay. A file that is not a separation is never written into.- Parameters:
- cfgConfig
The simulation configuration: the
"tg"layout, withexact_windows.- tausnumpy.ndarray
The full delay axis in s (identical across shards).
- scan_namestr
Base name of the output file; give it a name of its own, apart from the scan of the same configuration.
- zsavenumpy.ndarray
Save positions in m, see
pnps.simulate.simulate_delay_point().- h_targetfloat
Largest step of the replayed schedule in m.
- out_dirstr or pathlib.Path
Directory for the output file.
- shardtuple of (int, int) or None
(i, n): compute only delay indicesi::n, asrun_scan().- indicessequence of int or None
Compute only these delay indices, as
run_scan().- skip_existingbool
Skip delay points already written (resume).
- backendstr
The solprop backend registry name.
- Returns:
- pathlib.Path
The file written by this process.
- Raises:
- ScanError
For a bad shard or indices, or a target file that is not a separation.
- ConfigError
If the configuration has no exact windows or not the
"tg"layout.