cosedaUI.mainwindow_sections package

Submodules

cosedaUI.mainwindow_sections.cluster module

class cosedaUI.mainwindow_sections.cluster.ClusterMixin[source]

Bases: object

on_kill_all_clusters()[source]

Kill all Dask clusters on this machine and inform the user.

on_kill_current_cluster()[source]

Kill the current Dask cluster and inform the user.

on_open_dashboard()[source]

Opens the Dask dashboard URL for the current cluster in the default browser.

on_set_cluster_address()[source]

Prompt for and set the Dask scheduler address override.

cosedaUI.mainwindow_sections.imports module

class cosedaUI.mainwindow_sections.imports.ImportMixin[source]

Bases: object

open_import_emd_window()[source]
open_import_h5_window()[source]
open_import_mrc_window()[source]
open_import_tiff_window()[source]

cosedaUI.mainwindow_sections.indexing module

class cosedaUI.mainwindow_sections.indexing.IndexingMixin[source]

Bases: object

on_indexing_run_stream_changed(stream_path)[source]

Called by the Index & Integrate window whenever the selected run changes. Updates the available stream path and resets cached overlays.

Parameters:

stream_path (str | None)

on_toggle_indexing_results(checked)[source]

Handle enabling/disabling the indexing overlay.

Parameters:

checked (bool)

show_latest_indexed_frame()[source]

Jump to the most recently indexed frame based on the current stream.

show_next_indexed_frame()[source]

Jump to the next indexed frame relative to the current chunk.

show_previous_indexed_frame()[source]

Jump to the previous indexed frame relative to the current chunk.

cosedaUI.mainwindow_sections.viewer module

class cosedaUI.mainwindow_sections.viewer.ViewerMixin[source]

Bases: object

adjust_brightness(image, brightness_factor)[source]
adjust_brightness_value()[source]
adjust_contrast(image, contrast_factor)[source]
adjust_contrast_value()[source]
adjust_gamma(image, gamma=1.0)[source]
adjust_gamma_value()[source]
change_frame(value)[source]

Slot to handle changes in the frame_slider’s value.

Parameters:

value (int) – The new value from the slider representing the frame index.

change_frame_from_entry()[source]
clear_vdf_overlay()[source]

Remove the virtual dark-field detector overlay from the main preview.

draw_peak_preview(image, peaks)[source]
ensure_atlas_for_current_file()[source]

Create the default saved atlas when all inputs exist and no atlas is saved.

export_current_frame()[source]

Use helper to export the raw HDF5 frame as a TIFF.

export_current_frame_as_shown()[source]

Use helper to export the displayed (adjusted) image.

find_strongest_frame()[source]

Scan nPeaks lazily so the UI stays responsive even for large files.

go_to_strongest_frame()[source]
handle_image_update(message)[source]
keyPressEvent(event)[source]

Handle left/right arrow keys to navigate frames.

load_image_from_hdf5()[source]
next_frame()[source]
on_frame_order_changed(index)[source]
on_show_strong_peaks_toggled(state)[source]
on_slider_release()[source]
on_slider_start()[source]
open_aurora_plot()[source]
open_map()[source]
previous_frame()[source]
resizeEvent(event)[source]

On window resize, immediately refresh the image to fit the new width and adjust the container height to maintain the original aspect ratio.

set_vdf_overlay(center, width, enabled=True)[source]

Set the virtual dark-field overlay shown on the main diffraction preview.

show_pixel_index(event)[source]
update_image()[source]
update_map_thumbnail()[source]

Show a saved atlas (entry/atlas/<zdim>) as a thumbnail in the Map preview box.

Renders with the current colormap and fits it within the workflow column so it never widens that column. Keeps the Atlas group available when the file has enough data to open the atlas viewer, even before a saved atlas exists.

cosedaUI.mainwindow_sections.workflow module

class cosedaUI.mainwindow_sections.workflow.WorkflowMixin[source]

Bases: object

display_log_file()[source]
open_check_metadata_window()[source]

Opens the metadata dialog showing acquisition details.

open_export_window()[source]

Open the Export window which lists available CrystFEL HKL files and converts them to SHELX HKLF4, and can also write RES/P4P from CrystFEL cell files.

open_index_integrate_window()[source]
open_index_window()[source]
open_merge_window()[source]
open_strip_files_window()[source]
open_unit_cell_hist_window(auto_refresh=False)[source]

Open the unit cell histogram viewer for the current stream.

Parameters:

auto_refresh (bool)

open_workspace_unit_cell_fit_window()[source]

Open the workspace-wide unit-cell Gaussian fit tool.

report_issue()[source]

cosedaUI.mainwindow_sections.workspace module

class cosedaUI.mainwindow_sections.workspace.WorkspaceMixin[source]

Bases: object

add_generated_ini_paths(paths, show_warnings=True)

Add importer-generated INI files to the workspace.

Returns a dict with added/skipped/invalid path lists so import dialogs can report concise status without duplicating workspace mutation logic.

add_ini_files()

Open a dialog to add INI files to the workspace list.

add_ini_paths(paths)

Add provided INI file paths to the workspace list (no file dialog).

apply_center_finder_settings(settings)[source]
apply_peakfinder_settings(settings)[source]

Slot function to apply peak finder settings emitted from PeakFinderSettingsWindow.

calculate_radial_profiles()[source]

Compute radial intensity profiles for this file or all workspace files.

ensure_index_dataset(hdf5_path)[source]

Ensure that an ‘index’ dataset exists in the ‘entry/data’ group. If not, and if the length of the ‘images’ dataset matches one of the stage position datasets, create the ‘index’ dataset as a sequence [0, 1, …, num_frames-1].

Parameters:

hdf5_path (str) – The path to the HDF5 file.

highlight_selected_file()[source]
load_last_directory()

Restore last directory and last workspace (file or INI list) from config.

load_last_workspace_state()

Restore workspace state from configuration (named file or INI list).

new_workspace()

Clear the current workspace list and reset state.

on_indexintegrate_requested_select_ini(ini_path)[source]

Slot: the Index & Integrate window asked us to select a given INI path. We set the QListWidget selection accordingly; this triggers on_ini_select().

Parameters:

ini_path (str)

on_ini_select()[source]
open_centerfinder_settings_window()[source]

Opens the Center Finder Settings window.

open_centerrefinement_settings_window()[source]

Opens the Center Refinement Settings window.

open_file(ini_file_path=None, preserve_frame=False)[source]
open_peakfinder_settings_window()[source]
open_workspace()

Load a saved workspace file (.cosedawsp) and populate the INI list.

reload_current_file()[source]

Reload the currently loaded INI/HDF5 while keeping the current frame.

reload_file_preserve_frame()[source]

Reload the current INI/HDF5 but keep the same frame index.

remove_ini_files()

Remove selected INI files from the workspace list.

save_workspace()

Save the current workspace INI paths to a .cosedawsp file.

save_workspace_state()

Save workspace paths (or workspace file) to the config file.

start_coordinate_selection()[source]
stop_live_preview()[source]
update_frame_from_map_click(frame_index)[source]

Slot to update the frame index when a point is clicked in the map.

update_workflow_buttons()[source]

Module contents

Mixins that split the main window logic into smaller sections.

class cosedaUI.mainwindow_sections.ClusterMixin[source]

Bases: object

on_kill_all_clusters()[source]

Kill all Dask clusters on this machine and inform the user.

on_kill_current_cluster()[source]

Kill the current Dask cluster and inform the user.

on_open_dashboard()[source]

Opens the Dask dashboard URL for the current cluster in the default browser.

on_set_cluster_address()[source]

Prompt for and set the Dask scheduler address override.

class cosedaUI.mainwindow_sections.ImportMixin[source]

Bases: object

open_import_emd_window()[source]
open_import_h5_window()[source]
open_import_mrc_window()[source]
open_import_tiff_window()[source]
class cosedaUI.mainwindow_sections.IndexingMixin[source]

Bases: object

on_indexing_run_stream_changed(stream_path)[source]

Called by the Index & Integrate window whenever the selected run changes. Updates the available stream path and resets cached overlays.

Parameters:

stream_path (str | None)

on_toggle_indexing_results(checked)[source]

Handle enabling/disabling the indexing overlay.

Parameters:

checked (bool)

show_latest_indexed_frame()[source]

Jump to the most recently indexed frame based on the current stream.

show_next_indexed_frame()[source]

Jump to the next indexed frame relative to the current chunk.

show_previous_indexed_frame()[source]

Jump to the previous indexed frame relative to the current chunk.

class cosedaUI.mainwindow_sections.ViewerMixin[source]

Bases: object

adjust_brightness(image, brightness_factor)[source]
adjust_brightness_value()[source]
adjust_contrast(image, contrast_factor)[source]
adjust_contrast_value()[source]
adjust_gamma(image, gamma=1.0)[source]
adjust_gamma_value()[source]
change_frame(value)[source]

Slot to handle changes in the frame_slider’s value.

Parameters:

value (int) – The new value from the slider representing the frame index.

change_frame_from_entry()[source]
clear_vdf_overlay()[source]

Remove the virtual dark-field detector overlay from the main preview.

draw_peak_preview(image, peaks)[source]
ensure_atlas_for_current_file()[source]

Create the default saved atlas when all inputs exist and no atlas is saved.

export_current_frame()[source]

Use helper to export the raw HDF5 frame as a TIFF.

export_current_frame_as_shown()[source]

Use helper to export the displayed (adjusted) image.

find_strongest_frame()[source]

Scan nPeaks lazily so the UI stays responsive even for large files.

go_to_strongest_frame()[source]
handle_image_update(message)[source]
keyPressEvent(event)[source]

Handle left/right arrow keys to navigate frames.

load_image_from_hdf5()[source]
next_frame()[source]
on_frame_order_changed(index)[source]
on_show_strong_peaks_toggled(state)[source]
on_slider_release()[source]
on_slider_start()[source]
open_aurora_plot()[source]
open_map()[source]
previous_frame()[source]
resizeEvent(event)[source]

On window resize, immediately refresh the image to fit the new width and adjust the container height to maintain the original aspect ratio.

set_vdf_overlay(center, width, enabled=True)[source]

Set the virtual dark-field overlay shown on the main diffraction preview.

show_pixel_index(event)[source]
update_image()[source]
update_map_thumbnail()[source]

Show a saved atlas (entry/atlas/<zdim>) as a thumbnail in the Map preview box.

Renders with the current colormap and fits it within the workflow column so it never widens that column. Keeps the Atlas group available when the file has enough data to open the atlas viewer, even before a saved atlas exists.

class cosedaUI.mainwindow_sections.WorkflowMixin[source]

Bases: object

display_log_file()[source]
open_check_metadata_window()[source]

Opens the metadata dialog showing acquisition details.

open_export_window()[source]

Open the Export window which lists available CrystFEL HKL files and converts them to SHELX HKLF4, and can also write RES/P4P from CrystFEL cell files.

open_index_integrate_window()[source]
open_index_window()[source]
open_merge_window()[source]
open_strip_files_window()[source]
open_unit_cell_hist_window(auto_refresh=False)[source]

Open the unit cell histogram viewer for the current stream.

Parameters:

auto_refresh (bool)

open_workspace_unit_cell_fit_window()[source]

Open the workspace-wide unit-cell Gaussian fit tool.

report_issue()[source]
class cosedaUI.mainwindow_sections.WorkspaceMixin[source]

Bases: object

add_generated_ini_paths(paths, show_warnings=True)

Add importer-generated INI files to the workspace.

Returns a dict with added/skipped/invalid path lists so import dialogs can report concise status without duplicating workspace mutation logic.

add_ini_files()

Open a dialog to add INI files to the workspace list.

add_ini_paths(paths)

Add provided INI file paths to the workspace list (no file dialog).

apply_center_finder_settings(settings)[source]
apply_peakfinder_settings(settings)[source]

Slot function to apply peak finder settings emitted from PeakFinderSettingsWindow.

calculate_radial_profiles()[source]

Compute radial intensity profiles for this file or all workspace files.

ensure_index_dataset(hdf5_path)[source]

Ensure that an ‘index’ dataset exists in the ‘entry/data’ group. If not, and if the length of the ‘images’ dataset matches one of the stage position datasets, create the ‘index’ dataset as a sequence [0, 1, …, num_frames-1].

Parameters:

hdf5_path (str) – The path to the HDF5 file.

highlight_selected_file()[source]
load_last_directory()

Restore last directory and last workspace (file or INI list) from config.

load_last_workspace_state()

Restore workspace state from configuration (named file or INI list).

new_workspace()

Clear the current workspace list and reset state.

on_indexintegrate_requested_select_ini(ini_path)[source]

Slot: the Index & Integrate window asked us to select a given INI path. We set the QListWidget selection accordingly; this triggers on_ini_select().

Parameters:

ini_path (str)

on_ini_select()[source]
open_centerfinder_settings_window()[source]

Opens the Center Finder Settings window.

open_centerrefinement_settings_window()[source]

Opens the Center Refinement Settings window.

open_file(ini_file_path=None, preserve_frame=False)[source]
open_peakfinder_settings_window()[source]
open_workspace()

Load a saved workspace file (.cosedawsp) and populate the INI list.

reload_current_file()[source]

Reload the currently loaded INI/HDF5 while keeping the current frame.

reload_file_preserve_frame()[source]

Reload the current INI/HDF5 but keep the same frame index.

remove_ini_files()

Remove selected INI files from the workspace list.

save_workspace()

Save the current workspace INI paths to a .cosedawsp file.

save_workspace_state()

Save workspace paths (or workspace file) to the config file.

start_coordinate_selection()[source]
stop_live_preview()[source]
update_frame_from_map_click(frame_index)[source]

Slot to update the frame index when a point is clicked in the map.

update_workflow_buttons()[source]