garnet.utilities package#

Submodules#

garnet.utilities.autoreduce module#

class AutoReduce(filename)[source]#

Bases: object

Methods

find_autoreduce_config()

Locate the most recently modified autoreduce yaml config, if any.

plot_instrument()

Bin the detector-space (gamma, nu) view into a 2D histogram (mean intensity per bin, mirroring NeuXtalViz's ub_tools.py calculate_instrument_view), and render it as an interactive Plotly heatmap for the monitor page.

slice_workflow()

Compute default UB-driven HKL-projection slices, MDNorm-normalize against the configured vanadium solid-angle/flux, accumulate on-disk with any prior run of the same title, and plot/upload.

compress

elastic

publish_plots

MONITOR_OVERSAMPLE = 1.0[source]#
compress(ws)[source]#
elastic(time_offset=17000)[source]#
find_autoreduce_config()[source]#

Locate the most recently modified autoreduce yaml config, if any.

Requires UBFile, VanadiumFile, and FluxFile keys; missing file or keys means the slice preview workflow is skipped entirely.

plot_instrument()[source]#

Bin the detector-space (gamma, nu) view into a 2D histogram (mean intensity per bin, mirroring NeuXtalViz’s ub_tools.py calculate_instrument_view), and render it as an interactive Plotly heatmap for the monitor page.

publish_plots()[source]#
slice_workflow()[source]#

Compute default UB-driven HKL-projection slices, MDNorm-normalize against the configured vanadium solid-angle/flux, accumulate on-disk with any prior run of the same title, and plot/upload.

garnet.utilities.calculate module#

class CalculateUB(a, b, c, alpha, beta, gamma)[source]#

Bases: object

Optimizer of crystal orientation from peaks and known lattice parameters.

Attributes:
a, b, cfloat

Lattice constants in ansgroms.

alpha, beta, gammafloat

Lattice angles in degrees.

Methods

UB_matrix(U, B)

Calculate \(UB\)-matrix.

cost(param, B, kf_ki_dir, wavelength)

Cost function for indexing given a proposed orientation.

indexer(UB, kf_ki_dir, wavelength[, tol, alpha])

Laue indexer for a given \(UB\) matrix.

metric_G_star_tensor()

Calculate the reciprocal metric tensor \(G^*\).

metric_G_tensor()

Calculate the metric tensor \(G\).

minimize(kf_ki_dir, wavelength[, n_proc])

Fit the orientation and other parameters.

objective(x)

Objective function.

orientation_U(u0, u1, u2)

The sample orientation matrix \(U\).

reciprocal_lattice_B()

The reciprocal lattice \(B\)-matrix.

refine(kf_ki_dir, wavelength[, cell, error])

Refine the orientation and lattice parameters under constraints.

residual(x, kf_ki_dir, hkl, wavelength, fun)

Optimization residual function.

cartesian_matrix_metric_tensor

cubic

get_lattice_constants

get_orientation_parameters

hexagonal

index

monoclinic

orthorhombic

rhombohedral

set_lattice_constants

set_orientation_parameters

softplus

tetragonal

triclinic

UB_matrix(U, B)[source]#

Calculate \(UB\)-matrix.

Parameters:
U2d-array

3x3 orientation matrix.

B2d-array

3x3 reciprocal lattice vectors Cartesian matrix.

Returns:
UB2d-array

3x3 oriented reciprocal lattice.

cartesian_matrix_metric_tensor(a, b, c, alpha, beta, gamma)[source]#
cost(param, B, kf_ki_dir, wavelength)[source]#

Cost function for indexing given a proposed orientation.

Parameters:
paramtuple, float

Orientation parameters.

Barray, float

Reciprocal lattice B-matrix.

kf_ki_dirarray, float
wavelengthlist, float

Wavelength band (min, max).

Returns:
errorfloat

Total indexing cost.

cubic(x)[source]#
get_lattice_constants()[source]#
get_orientation_parameters()[source]#
hexagonal(x)[source]#
index(kf_ki_dir, wavelength)[source]#
indexer(UB, kf_ki_dir, wavelength, tol=0.1, alpha=0.1)[source]#

Laue indexer for a given \(UB\) matrix.

Parameters:
UB2d-array

3x3 sample oriented lattice matrix.

kf_ki_dirlist

Difference between scattering and incident beam directions.

wavelengthlist

Wavelength of each reflection.

tolfloat, optional

Indexing tolerance. Default is 0.15.

Returns:
errfloat

Indexing cost.

numint

Number of peaks index.

hkllist

Miller indices. Un-indexed are labeled [0,0,0].

lamdalist

Resolved wavelength. Unindexed are labeled inf.

metric_G_star_tensor()[source]#

Calculate the reciprocal metric tensor \(G^*\).

Returns:
Gstar2d-array

3x3 matrix of reciprocal lattice info for Cartesian transforms.

metric_G_tensor()[source]#

Calculate the metric tensor \(G\).

Returns:
G2d-array

3x3 matrix of lattice parameter info for Cartesian transforms.

minimize(kf_ki_dir, wavelength, n_proc=-1)[source]#

Fit the orientation and other parameters.

Parameters:
n_procint, optional

Number of processes to use. The default is -1.

Returns:
numint

Number of peaks index.

hkllist

Miller indices. Un-indexed are labeled [0,0,0].

lamdalist

Resolved wavelength. Un-indexed are labeled inf.

monoclinic(x)[source]#
objective(x)[source]#

Objective function.

Parameters:
xarray

Refineable parameters.

Returns:
neg_indint

Negative number of peaks indexed.

orientation_U(u0, u1, u2)[source]#

The sample orientation matrix \(U\).

Parameters:
u0, u1, u2float

Rotation paramters.

Returns:
U2d-array

3x3 sample orientation matrix.

orthorhombic(x)[source]#
reciprocal_lattice_B()[source]#

The reciprocal lattice \(B\)-matrix.

Returns:
B2d-array

3x3 matrix of reciprocal lattice in Cartesian coordinates.

refine(kf_ki_dir, wavelength, cell='Triclinic', error=0.15)[source]#

Refine the orientation and lattice parameters under constraints.

residual(x, kf_ki_dir, hkl, wavelength, fun)[source]#

Optimization residual function.

Parameters:
xlist

Parameters.

hkllist

Miller indices.

Qlist

Q-sample vectors.

funfunction

Lattice constraint function.

Returns:
residuallist

Least squares residuals.

rhombohedral(x)[source]#
set_lattice_constants(a, b, c, alpha, beta, gamma)[source]#
set_orientation_parameters(x)[source]#
softplus(z)[source]#
tetragonal(x)[source]#
triclinic(x)[source]#

garnet.utilities.calibration module#

class Calibration(config)[source]#

Bases: object

Methods

calculate_goniometer_angles

calculate_goniometer_matrix

calculate_orientation_matrix

calculate_orientation_vector

calculate_tilt_matrices

calculate_tilt_matrix

calibrate_goniometer

calibrate_instrument

cell_symmetry_matrices

fix_offsets

generate_diagnostic

gravity_angle

initialize_peaks

load_instrument

load_peaks

optimize_goniometer

refine_goniometer

refine_offsets

reindex_peaks

residual

run

calculate_goniometer_angles(R)[source]#
calculate_goniometer_matrix(omega, chi, phi)[source]#
calculate_orientation_matrix(u0, u1, u2)[source]#
calculate_orientation_vector(U)[source]#
calculate_tilt_matrices(alpha, beta, gamma)[source]#
calculate_tilt_matrix(alpha, beta, gamma)[source]#
calibrate_goniometer(iteration)[source]#
calibrate_instrument(iteration)[source]#
cell_symmetry_matrices()[source]#
fix_offsets(x)[source]#
generate_diagnostic(iteration, label=None, show_calibrated=None)[source]#
gravity_angle()[source]#
initialize_peaks()[source]#
load_instrument()[source]#
load_peaks()[source]#
optimize_goniometer()[source]#
refine_goniometer()[source]#
refine_offsets(x)[source]#
reindex_peaks()[source]#
residual(x, peak_dict, func, gamma)[source]#
run()[source]#

garnet.utilities.combine module#

combine(filename)[source]#
find_partial_files(instance)[source]#
parse_args(argv=None)[source]#

garnet.utilities.confirm module#

confirm_autoreduce(filename)[source]#

Confirm autoreduction status based on reduction logs.

Parameters:
filenamestr

Full data path containing facility, instrument, and IPTS fields.

Notes

Confirmation logic:

  • Unknown → No .log files detected

  • Yes → Logs exist and no failures detected

  • Partially → Some runs failed

  • No → All runs failed

garnet.utilities.crystal module#

class CrystalStructure(filename)[source]#

Bases: object

Methods

add_material_info

get_chemical_formula_z_parameter

get_lattice_constants

get_scatterers

get_space_group

get_unit_cell_volume

add_material_info(filename)[source]#
get_chemical_formula_z_parameter()[source]#
get_lattice_constants()[source]#
get_scatterers()[source]#
get_space_group()[source]#
get_unit_cell_volume()[source]#
class SampleParameters(radii, u_vector=[0, 0, 1], v_vector=[1, 0, 0])[source]#

Bases: object

Methods

add_sample_info

add_sample_info(filename)[source]#

garnet.utilities.ipts module#

garnet.utilities.macromolecular module#

class Macromolecular(peaks='peaks')[source]#

Bases: object

Methods

write_mtz

write_mtz(filename, space_group='P 1')[source]#

garnet.utilities.peaks module#

class Peaks(config)[source]#

Bases: object

Methods

calculate_limits

finalize_and_save

load_convert_runs

load_instrument

run

calculate_limits()[source]#
finalize_and_save(tol=0.2, n_proc=None)[source]#
load_convert_runs(ipts, run_nos, tol=0.25, n_proc=16)[source]#
load_instrument()[source]#
run(n_proc=10)[source]#

garnet.utilities.peakview module#

garnet.utilities.refinement module#

class NuclearStructureRefinement(cell, space_group, sites, filename, parameters=None, twin_laws=None)[source]#

Bases: object

Methods

add_twin_parameters(params)

Twin domain volume fractions (twin_frac_0..twin_frac_{n-1}, domain 0 the identity), reparametrized as n-1 free, independently bounded [0, 1] "stick-breaking" parameters twin_s_i: frac_0 = s_0, frac_1 = (1-s_0)*s_1, ..., and the last fraction is the leftover product prod(1-s_i).

beam_weights(sample_points, G, ds, bx, by, sigma)

Calculate Gaussian beam weights for sample points.

calculate_structure_amplitudes(params[, hkl])

Compute complex structure amplitudes Fs (per unique hkl) for given params.

calculate_structure_factors(params)

F2_calc per observation, incoherently summed over twin domains weighted by their refined volume fraction: each domain sees the same structural model but a transformed hkl (T @ hkl), since domains are distinct crystallites (no amplitude interference between them).

extinction_correction(param, F2)

Calculate structure factor-dependent extinction correction.

objective_correction(params)

Objective for absorption/extinction refinement.

objective_structure(params)

Objective for structure + scale refinement.

plot_hkl_families([filename])

Create multi-page PDF with one page per hkl family.

plot_sample_shape()

Plot the refined ellipsoidal sample shape with beam directions.

plot_wobble_correction(off[, filename])

Plot wobble correction scale factors vs rotation angle.

refine([report, cutoff, n_iter, abs_corr, ...])

Iterative refinement protocol: 7 stages per iteration.

save_corrected_peaks()

Apply absorption corrections to all peaks and save to new file.

twin_fractions(params)

Volume fraction of each twin domain (self.twin_laws, domain 0 always the identity), read off the twin_frac_i parameters add_twin_parameters derives from the free twin_s_i stick-breaking parameters.

wobble_correction(off)

Scale model for off-centering/wobble correction.

absorption_correction

add_absorption_extinction_parameters

add_beam_parameters

add_detector_run_scale_parameters

calculate_scale_factor

calculate_statistics

chemical_formula_z_parameter

cost

detector_bank_scale_factors

extinction_xp

extinction_xs

extinction_xx

extract_info

extract_parameters

generate_parameters

generate_symmetry_transforms

initialize_correction

initialize_crystal_structure

initialize_material

initialize_unit_cell_atoms

load_hkls

normalization_correction

plot_absorption_correction

plot_result

report

run_angle_scale_factors

save_detector_scales

spherical_absorption

spherical_absorption_correction

spherical_extinction

update_sample

absorption_correction(coeffs)[source]#
add_absorption_extinction_parameters(params)[source]#
add_beam_parameters(params)[source]#
add_detector_run_scale_parameters(params)[source]#
add_twin_parameters(params)[source]#

Twin domain volume fractions (twin_frac_0..twin_frac_{n-1}, domain 0 the identity), reparametrized as n-1 free, independently bounded [0, 1] “stick-breaking” parameters twin_s_i: frac_0 = s_0, frac_1 = (1-s_0)*s_1, …, and the last fraction is the leftover product prod(1-s_i). This keeps every fraction in [0, 1] and summing to 1 for any values the optimizer picks, unlike a naive expr='1-f_1-...-f_{n-1}' for the last fraction, which lmfit would not keep bounded.

n=1 (the default, no twin laws beyond the implicit identity) adds a single fixed twin_frac_0 = 1 and no free parameters.

beam_weights(sample_points, G, ds, bx, by, sigma)[source]#

Calculate Gaussian beam weights for sample points.

Parameters:
sample_pointsndarray, shape (N, 3)

Monte Carlo sample points in sample frame

Gndarray, shape (P, 3, 3)

Goniometer matrices for each peak

dsndarray, shape (P, 3)

Sample center offset in sample frame for each peak

bx, byfloat

Beam center position in lab frame

sigmafloat

Gaussian beam width

Returns:
bwndarray, shape (N, P)

Beam weights for each sample point and peak

calculate_scale_factor(F2s)[source]#
calculate_statistics(cutoff)[source]#
calculate_structure_amplitudes(params, hkl=None)[source]#

Compute complex structure amplitudes Fs (per unique hkl) for given params. hkl defaults to self.equiv (the observed unique HKLs) but may be a transformed array, e.g. a twin domain’s T @ hkl.

This is identical to the inner part of calculate_structure_factors but returns the complex amplitudes (not squared magnitudes).

calculate_structure_factors(params)[source]#

F2_calc per observation, incoherently summed over twin domains weighted by their refined volume fraction: each domain sees the same structural model but a transformed hkl (T @ hkl), since domains are distinct crystallites (no amplitude interference between them).

chemical_formula_z_parameter()[source]#
cost(params, F2s, I_obs, sig)[source]#
detector_bank_scale_factors(params)[source]#
extinction_correction(param, F2)[source]#

Calculate structure factor-dependent extinction correction.

Model

Nature

Parameter

Type I, Gaussian

Secondary

Mosaic [unitless]

Type I, Lorentzian

Secondary

Mosaic [unitless]

Type II

Primary

Block size² [um²]

SHELX

Phenomenological

Crystal size [cm]

[1] P. J. Becker and P. Coppens, Acta Cryst A 30, 2 (1974). [2] P. J. Becker and P. Coppens, Acta Cryst A 30, 2 (1974). [3] A. C. Larson, Crystallographic Computing (1970).

Parameters:
paramfloat

Exinction parameter.

F2array

Structure factors (fm^2).

Returns:
yarray

Extinction (unitless).

extinction_xp(r2, F2, lamda, V)[source]#
extinction_xs(g, F2, two_theta, lamda, Tbar, V)[source]#
extinction_xx(x, F2, two_theta, lamda, V)[source]#
extract_info()[source]#
extract_parameters(params, Uiso=0)[source]#
generate_parameters()[source]#
generate_symmetry_transforms()[source]#
initialize_correction(model='type II')[source]#
initialize_crystal_structure(sites)[source]#
initialize_material()[source]#
initialize_unit_cell_atoms(tol=1e-06, rcond=None, enforce_identity=True)[source]#
load_hkls(filename)[source]#
normalization_correction(params)[source]#
objective_correction(params)[source]#

Objective for absorption/extinction refinement.

Structure and scale are held fixed; F2s are precomputed for the current structural model.

objective_structure(params)[source]#

Objective for structure + scale refinement.

This stage varies positional, occupancy and displacement parameters together with the overall scale, while using the current absorption/extinction parameters as fixed values.

plot_absorption_correction(filename=None)[source]#
plot_hkl_families(filename=None)[source]#

Create multi-page PDF with one page per hkl family.

plot_result()[source]#
plot_sample_shape()[source]#

Plot the refined ellipsoidal sample shape with beam directions.

plot_wobble_correction(off, filename=None)[source]#

Plot wobble correction scale factors vs rotation angle.

Shows observed data points and model curves for different wavelengths.

refine(report=True, cutoff=10, n_iter=3, abs_corr=False, off_corr=False, det_corr=False, run_corr=False, norm_corr=False, ext_model='shelx')[source]#

Iterative refinement protocol: 7 stages per iteration.

Per iteration:
  1. Structure + scale (fixed corrections).

  2. Absorption only.

  3. Extinction only.

  4. Wobble only.

  5. Detector scales (optional).

  6. Run/orientation scales (optional).

  7. Normalization scales (optional).

report(result, det_corr, run_corr)[source]#
run_angle_scale_factors(params)[source]#
save_corrected_peaks()[source]#

Apply absorption corrections to all peaks and save to new file.

save_detector_scales(params)[source]#
spherical_absorption()[source]#
spherical_absorption_correction(muR, two_theta)[source]#
spherical_extinction()[source]#
twin_fractions(params)[source]#

Volume fraction of each twin domain (self.twin_laws, domain 0 always the identity), read off the twin_frac_i parameters add_twin_parameters derives from the free twin_s_i stick-breaking parameters. Sums to 1 by construction.

update_sample(parameters)[source]#
wobble_correction(off)[source]#

Scale model for off-centering/wobble correction.

Based on WobbleCorrection model: accounts for beam displacement and sample misalignment effects on intensity measurements.

Parameters:
offarray-like

[b, c, rx, rz] where: - b: spread (wavelength-dependent scaling) - c: center displacement - rx: in-plane displacement - rz: beam displacement

Returns:
array

Scale factors for each reflection

garnet.utilities.reflections module#

class AbsorptionCorrection(peaks, chemical_formula, z_parameter, u_vector=[0, 0, 1], v_vector=[1, 0, 0], params=None, filename=None)[source]#

Bases: object

Methods

apply_correction()

Correct every peak's intensity for absorption.

calculate_correction

save_ellipsoid_stl

set_material

set_orientation

set_shape

verify_chemical_formula

write_absortion_parameters

apply_correction()[source]#

Correct every peak’s intensity for absorption.

calculate_correction()[source]#
save_ellipsoid_stl(params, filename='/tmp/ellipsoid.stl')[source]#
set_material()[source]#
set_orientation()[source]#
set_shape()[source]#
verify_chemical_formula(formula)[source]#
write_absortion_parameters()[source]#
class Peaks(peaks, filename, scale=None, point_group=None, HKLTransform=None)[source]#

Bases: object

Methods

remove_forbidden_reflections(cell, ...[, ...])

Flag anomalously strong forbidden/weak reflections using the (cell, space_group, sites) structural model -- the same triple NuclearStructureRefinement/StructureAnalysis already carry as the reduction plan's Material block (space group + atom sites), which is the source of truth here.

remove_forbidden_reflections_from_cif(...[, ...])

Convenience fallback for remove_forbidden_reflections when a CIF file is available instead of an explicit (cell, space_group, sites) triple.

remove_low_volume_fraction([cutoff])

Flag peaks whose fitted-ellipsoid volume fraction on the detector (peaks_vol_frac) falls below cutoff.

remove_volume_outliers([lo, hi])

Flag peaks whose 3D Gaussian profile-fit intensity (I_3d) disagrees with the peak's assigned intensity (peak.getIntensity()).

transform_hkl([peaks, tol])

Apply self.HKLTransform to correct an indexing/setting error discovered after integration, without re-integrating.

write_cif_report([peaks, mu, transmission, ...])

Write a minimal CIF-format summary for post-reduction checking: unit-cell constants with esd's, the measured wavelength/theta/ d-spacing range, crystal size, a transmission range, and the merging statistics (Rint) from the last calculate_statistics call.

calculate_statistics

get_cell

load_peaks

load_spectrum

median_absolute_devation

merge_intensities

peak_info

plot_signal_noise

plot_volume_fraction

refine_UB

refine_ellipsoids

remove_non_indexed

remove_non_integrated

remove_off_centered

renumber_peaks

rescale_intensities

reset_satellite

resort_hkl

save_peaks

update_monitor

calculate_statistics(name, filename)[source]#
get_cell()[source]#
load_peaks()[source]#
load_spectrum(filename, instrument)[source]#
median_absolute_devation(arr)[source]#
merge_intensities(name=None)[source]#
peak_info()[source]#
plot_signal_noise(peaks=None)[source]#
plot_volume_fraction(peaks=None)[source]#
refine_UB(peaks)[source]#
refine_ellipsoids(peaks)[source]#
remove_forbidden_reflections(cell, space_group, sites, sigma=4.5, weak_frac=0.05, peaks=None)[source]#

Flag anomalously strong forbidden/weak reflections using the (cell, space_group, sites) structural model – the same triple NuclearStructureRefinement/StructureAnalysis already carry as the reduction plan’s Material block (space group + atom sites), which is the source of truth here. See remove_forbidden_reflections_from_cif for the fallback when a user supplies a CIF file instead.

sites entries are (atom, x, y, z, occ) – the plan’s Material.Sites format has no Uiso – or (atom, x, y, z, occ, Uiso); a missing Uiso defaults to 0, matching NuclearStructureRefinement’s own convention.

remove_forbidden_reflections_from_cif(cif_filename, sigma=4.5, weak_frac=0.05, peaks=None)[source]#

Convenience fallback for remove_forbidden_reflections when a CIF file is available instead of an explicit (cell, space_group, sites) triple.

remove_low_volume_fraction(cutoff=0.5)[source]#

Flag peaks whose fitted-ellipsoid volume fraction on the detector (peaks_vol_frac) falls below cutoff. A low vol_frac means intensity/sigma were extrapolated from a small observed fraction of the peak (edge/gap clipping), which is amplified by 1/vol_frac and therefore unreliable.

remove_non_indexed(tol=0.1)[source]#
remove_non_integrated()[source]#
remove_off_centered()[source]#
remove_volume_outliers(lo=0.1, hi=10.0)[source]#

Flag peaks whose 3D Gaussian profile-fit intensity (I_3d) disagrees with the peak’s assigned intensity (peak.getIntensity()). Peaks whose I_3d / getIntensity() ratio falls outside [lo, hi] are considered outliers and flagged for removal.

renumber_peaks(peaks, k=60, decimals=6, linkage='average')[source]#
rescale_intensities()[source]#
reset_satellite(peaks=None)[source]#
resort_hkl(peaks, filename)[source]#
save_peaks(name=None, fit_dict=None, mu=0.0, transmission=None, instrument=None, correction_type=None, control_software=None, crystal_size=None)[source]#
transform_hkl(peaks=None, tol=0.15)[source]#

Apply self.HKLTransform to correct an indexing/setting error discovered after integration, without re-integrating. A no-op when the transform is the identity (the default).

update_monitor()[source]#
write_cif_report(peaks=None, mu=0.0, transmission=None, correction_type=None, instrument=None, facility=None, control_software=None, crystal_size=None, filename=None)[source]#

Write a minimal CIF-format summary for post-reduction checking: unit-cell constants with esd’s, the measured wavelength/theta/ d-spacing range, crystal size, a transmission range, and the merging statistics (Rint) from the last calculate_statistics call.

transmission, when given, is the actual per-peak absorption factor already computed for the correction that was applied (e.g. AbsorptionCorrection.T) and is reported as-is. Leave at None to instead approximate it from mu (the linear absorption coefficient in cm^-1, evaluated at a single reference wavelength) and each peak’s absorption-weighted path length (Tbar); mu=0 (default) reports T = 1, i.e. no absorption correction applied.

crystal_size is the (thickness, width, height) full-axis lengths of the sample ellipsoid in mm, e.g. self.params from AbsorptionCorrection or self.parameters from NuclearStructureRefinement; leave at None to report those fields as unknown.

error_volume(a, b, c, alpha, beta, gamma, e_a, e_b, e_c, e_alpha, e_beta, e_gamma)[source]#

Propagate cell-edge and cell-angle esd’s to a cell-volume esd by central finite differences, since OrientedLattice has no direct volume-esd accessor.

format_value_esd(value, esd, max_precision=4)[source]#

Format value with its esd in the compact CIF convention, e.g. 9.5432(7). Falls back to a plain fixed-precision number when no usable esd is available.

main()[source]#

garnet.utilities.sliceview module#

garnet.utilities.structure module#

class StructureAnalysis(config, filename, plan=None)[source]#

Bases: object

Methods

apply_correction

load_peaks

refimenent

save_mtz

save_peaks

apply_correction()[source]#
load_peaks()[source]#
refimenent(n_iter=10)[source]#
save_mtz()[source]#
save_peaks()[source]#

garnet.utilities.vanadium module#

class Vanadium(config)[source]#

Bases: object

Methods

calculate_pixel_solid_angle()

Accurate per-pixel geometric solid angle (pixel_area * cos(gamma) / L2^2).

generate_background_count_rate()

Per-bank background count rate from the standalone background run, normalized by solid angle only (stays per-steradian).

generate_count_rate()

Per-bank signal count rate R_b(lambda) ~= Phi(lambda) * epsilon_b(lambda), in counts / (charge * Angstrom * barn): background-subtracted, absorption-corrected, normalized by solid angle and vanadium cross section (unlike generate_background_count_rate, which stays per-steradian).

apply_absorption_correction

apply_calibration

apply_masks

finalize_and_save

generate_plots

load_instrument

load_runs

process_data

run

set_sample_geometry

subtract_background

apply_absorption_correction()[source]#
apply_calibration()[source]#
apply_masks()[source]#
calculate_pixel_solid_angle()[source]#

Accurate per-pixel geometric solid angle (pixel_area * cos(gamma) / L2^2). Computed directly on “vanadium” (not self.instrument, which can resolve to a different, undated IDF) so the grouping can’t disagree with the grouping already applied to the data.

finalize_and_save()[source]#
generate_background_count_rate()[source]#

Per-bank background count rate from the standalone background run, normalized by solid angle only (stays per-steradian). calculate_pixel_solid_angle must have already run (generate_count_rate does this).

generate_count_rate()[source]#

Per-bank signal count rate R_b(lambda) ~= Phi(lambda) * epsilon_b(lambda), in counts / (charge * Angstrom * barn): background-subtracted, absorption-corrected, normalized by solid angle and vanadium cross section (unlike generate_background_count_rate, which stays per-steradian).

set_sample_geometry must have been called first (self.N_illum, self.sigma_s).

generate_plots()[source]#
load_instrument()[source]#
load_runs(workspace, ipts, run_nos, time_stop=None)[source]#
process_data()[source]#
run()[source]#
set_sample_geometry(x=0)[source]#
subtract_background()[source]#

Module contents#