ImageD11.match_friedel_pairs module#
match_friedel_pairs.py#
Standalone pipeline script for Friedel pair matching in scanning_3DXRD datasets.
- Usage – run locally:
python match_friedel_pairs.py -dsfile /path/to/dataset.h5 [-parfile /path/to/params.json] [-pairing_options /path/to/options.json] [-use2Dpeaks True]
- Usage – submit to slurm:
- python match_friedel_pairs.py -dsfile /path/to/dataset.h5 [-parfile /path/to/params.json] [-pairing_options /path/to/options.json] [-use2Dpeaks True]
-usecluster True
- Pairing options JSON keys (all optional – defaults shown):
# tolerances tol_gv : 0.05 tol_eta : 0.2 tol_logI : null (null -> np.inf) weights : {“gx”:1,”gy”:1,”gz”:1,”eta”:1,”I”:1} # pairing strategy pair_type : “all” (“omega” | “eta” | “horizontal” | “all”
or a list, e.g. [“omega”])
filter_mode : “relaxed” n_eta_bins : 360 drop_unpaired : false extended_bin_search: false n_workers : -1 -1 -> all availables timeout : 120 n_steps : 25 # slurm / cluster options slurm_partition : “nice” slurm_mem_G : 64 slurm_time : “02:00:00” slurm_cpus : 16
- class ImageD11.match_friedel_pairs.Options#
Bases:
objectPairing options container with JSON save/load support. All attributes map directly to FriedelPairIndexer constructor arguments or match_friedel_pairs / match_friedel_pairs_by_chunks keyword arguments.
- classmethod load(path)#
- save(path='friedel_pairs_opts.json')#
- to_dict()#
- property tol_logI_value#
Return np.inf when tol_logI is None (JSON cannot store inf).
- ImageD11.match_friedel_pairs.log_to_file(log_path, logger_name='ImageD11')#
Context manager: redirects logging to a file and the terminal. Both at INFO level. Noisy third-party loggers capped at WARNING.
- ImageD11.match_friedel_pairs.main()#
- ImageD11.match_friedel_pairs.match_friedel_pairs_pipeline(dsfile, parfile=None, pairing_options_file=None, use2Dpeaks=True)#
Full Friedel pair matching pipeline.
- Parameters:
dsfile (str -- path to ImageD11 dataset .h5 file)
parfile (str -- path to parameters file (optional,) – falls back to ds.parfile)
pairing_options_file (str -- path to JSON options file (optional))
use2Dpeaks (bool -- if True use 2D peaks, else 4D peaks)
- ImageD11.match_friedel_pairs.prepare_bash_script(dsfile, parfile, pairing_options_file, use2Dpeaks, opts, id11_code_path=None)#
Write a slurm batch script to the slurm/ subfolder. id11_code_path : folder holding the ImageD11 to run (PYTHONPATH of the job).
None -> the one imported here.
- ImageD11.match_friedel_pairs.submit_to_slurm(dsfile, parfile, pairing_options_file, use2Dpeaks, opts, id11_code_path=None)#
Prepare the batch script and submit it with sbatch. Returns job_id : str