coseda.pipeline package

Submodules

coseda.pipeline.frame_intensities module

coseda.pipeline.frame_intensities.calculate_mean_intensities_batch(h5file_path, indices)

Calculate mean intensities for a batch of frames.

coseda.pipeline.frame_intensities.calculate_mean_intensities_dask_batch(input_path, batch_size=100)[source]
coseda.pipeline.frame_intensities.calculate_mean_intensities_dask_file(client, h5file_path, batch_size=100)[source]
coseda.pipeline.frame_intensities.calculate_mean_intensities_dask_file_inprocess(h5file_path, logfile_path)[source]
coseda.pipeline.frame_intensities.calculate_radial_profiles_batch(h5file_path, indices, cx, cy, nbins)

Radial profiles for a batch of frames -> (start_index, block[n, nbins]).

coseda.pipeline.frame_intensities.calculate_radial_profiles_dask_file(client, h5file_path, batch_size=64, max_radius=None)[source]

Compute a radial intensity profile per frame and save frame_radial_intensities.

Uses the per-frame beam center (entry/data/center_x / center_y) when present, otherwise the image center. max_radius (px) caps the number of bins; by default it reaches the farthest corner from any frame’s center.

coseda.pipeline.frame_intensities.calculate_radial_profiles_dask_file_inprocess(h5file_path, logfile_path, batch_size=64, max_radius=None)[source]

In-process entry point mirroring the mean-intensity variant.

coseda.pipeline.processimage module

coseda.pipeline.processimage.process_image(i, image_data, x0, y0, cutoff, cutoff_low, threshold, min_snr, min_pix_count, max_pix_count, local_bg_radius, min_res, max_res)[source]

coseda.pipeline.strip_h5 module

coseda.pipeline.strip_h5.check_disk_space(hdf5_file_path, threshold)[source]

Check free space and estimate fraction of frames kept; returns (ok, message, fraction_kept).

coseda.pipeline.strip_h5.check_if_index_dataset_exists(hdf5_file_path)[source]

Return True if entry/data/index exists in the HDF5 file.

coseda.pipeline.strip_h5.check_if_peaks_and_intensities_datasets_exist(hdf5_file_path)[source]

Return booleans for presence of nPeaks and frame intensity datasets.

coseda.pipeline.strip_h5.check_if_stripped(hdf5_file_path)[source]

Heuristic: compare images vs index length; if they differ, the file was stripped.

coseda.pipeline.strip_h5.create_index_dataset(hdf5_file_path)[source]

Create entry/data/index = arange(len(images)) if it does not exist.

coseda.pipeline.strip_h5.repack_hdf5_with_backup(hdf5_file_path, logfile_path=None)[source]
coseda.pipeline.strip_h5.strip_h5(hdf5_file_path, threshold=1, force=False, logfile_path=None, progress_callback=None, goniometer_transform_order=None)[source]

Strip frames from a single HDF5 based on peak counts, preserving metadata and backups.

coseda.pipeline.strip_h5.strip_h5_batch(input_path, progress_callback=None)[source]

Strip one or more INI-defined datasets. Accepts a list of INI paths (can span multiple directories) or a single path/dir handled by handle_input.

coseda.pipeline.strip_h5.translate_to_stripped_index(hdf5_file_path, unstripped_frame_index)[source]

Module contents

Pipeline helpers for stripping, intensities, and image processing.

coseda.pipeline.calculate_mean_intensities_dask_batch(input_path, batch_size=100)[source]
coseda.pipeline.calculate_mean_intensities_dask_file(client, h5file_path, batch_size=100)[source]
coseda.pipeline.calculate_mean_intensities_dask_file_inprocess(h5file_path, logfile_path)[source]
coseda.pipeline.check_if_stripped(hdf5_file_path)[source]

Heuristic: compare images vs index length; if they differ, the file was stripped.

coseda.pipeline.process_image(i, image_data, x0, y0, cutoff, cutoff_low, threshold, min_snr, min_pix_count, max_pix_count, local_bg_radius, min_res, max_res)[source]
coseda.pipeline.strip_h5(hdf5_file_path, threshold=1, force=False, logfile_path=None, progress_callback=None, goniometer_transform_order=None)[source]

Strip frames from a single HDF5 based on peak counts, preserving metadata and backups.

coseda.pipeline.strip_h5_batch(input_path, progress_callback=None)[source]

Strip one or more INI-defined datasets. Accepts a list of INI paths (can span multiple directories) or a single path/dir handled by handle_input.