nabu.stitching.utils.post_processing module

class nabu.stitching.utils.post_processing.StitchingPostProcAggregation(stitching_config: SingleAxisStitchingConfiguration, futures: tuple | None = None, existing_objs_ids: tuple | None = None, progress_bars: dict | None = None)[source]

Bases: object

for remote stitching each process will stitch a part of the volume or projections. Then once all are finished we want to aggregate them all to a final volume or NXtomo.

This is the goal of this class. Please be careful with API. This is already inheriting from a tomwer class

Parameters:
  • stitching_config – configuration of the stitching configuration

  • futures – futures that just run

  • existing_objs – futures that just run

  • progress_bars – tqdm progress bars for each jobs

property futures
property progress_bars: dict
retrieve_tomo_objects() tuple[source]

Return tomo objects to be stitched together. Either from future or from existing_objs

dump_stitching_config_as_nx_process(file_path: str, data_path: str, overwrite: bool, process_name: str)[source]
property stitching_config: SingleAxisStitchingConfiguration
process() None[source]

main function

follow_progress() AbstractContextManager[source]
class nabu.stitching.utils.post_processing.SlurmStitchingFollowerContext(output_files_to_progress_bars: dict)[source]

Bases: AbstractContextManager

Util class to provide user feedback from stitching done on slurm

class nabu.stitching.utils.post_processing.SlurmStitchingFollowerThread(file_to_progress_bar: dict, delay_time: float = 0.5)[source]

Bases: Thread

Thread to check progression of stitching slurm job(s) Read slurm jobs .out file each ‘delay time’ and look for a tqdm line at the end. If it exists then deduce progress from it.

file_to_progress_bar provide for each slurm .out file the progress bar to update

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is a list or tuple of arguments for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

property file_to_progress_bar: dict
run() None[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

join(timeout: float | None = None) None[source]

Wait until the thread terminates.

This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception or until the optional timeout occurs.

When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call is_alive() after join() to decide whether a timeout happened – if the thread is still alive, the join() call timed out.

When the timeout argument is not present or None, the operation will block until the thread terminates.

A thread can be join()ed many times.

join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.

static cast_progress_line_from_log(line: str) float | None[source]

Try to retrieve from a line from log the advancement (in percentage)