File comparison¶
- TRSFX.compare.corr_heatmap(df, output=None, title=None, vmin=0.2, vmax=1.0, cmap='RdYlBu_r', figsize=(10, 8), mask=True, **kwargs)¶
Plot and save a correlation matrix as a heatmap.
- Parameters:
df (
DataFrame) – Square correlation matrix with matching row/column labelsoutput (
str|Path|None) – Output file path. Defaults to ./correlation_heatmap.pngvmin (
float) – Minimum value for color scalevmax (
float) – Maximum value for color scalecmap (
str) – Matplotlib/seaborn colormap namefigsize (
Tuple[int,int]) – Figure dimensions as (width, height) in inchesmask (
bool) – If True, mask values outside [vmin, vmax] rangekwargs – Additional arguments passed to sns.heatmap
- Returns:
Matplotlib figure object
- Return type:
- TRSFX.compare.map_correlation(mtz_files, labels=None, time_step=None, time_ranges=False, f=None, phi=None, d_min=None)¶
Compute pairwise map-map correlation matrix from MTZ files.
- Parameters:
mtz_files (
Sequence[str|Path]) – Sequence of paths to MTZ files containing map coefficientslabels (
Optional[Sequence[str]]) – Labels for each file. If None, uses filenames as labelsf (
str|None) – F column name. If None, auto-detected from first filephi (
str|None) – Phase column name. If None, auto-detected from first filed_min (
float|None) – Resolution cutoff in Angstroms. If None, uses all reflections
- Returns:
Square correlation matrix with labels as row/column indices
- Return type:
- TRSFX.compare.trace(pattern, output_csv, start_idx=0, end_idx=None, log_space=False, plot=False)¶
Globs HDF5 files matching a pattern, computes frame-to-frame correlations for each, and streams results to a CSV.
- Parameters:
pattern (
str) – Glob pattern (e.g., “data/.h5” or “/path/to/*/*.h5”)start_idx (
int) – Start frame index for correlation calculationend_idx (
int) – End frame index for correlation calculationlog_space (
bool) – If True, compute correlation on log10(data)plot (
bool) – If True, generate plots (saved next to -o output as .png)
- Return type: