Base Class#
- class yaflux._base.Base(parameters=None)[source]#
Bases:
objectBase class for analysis pipelines.
This class provides a framework for defining and executing analysis pipelines.
- Parameters:
parameters (Parameters) – The parameters for the analysis.
- available_steps#
List all available steps for the analysis.
- Type:
list[str]
- completed_steps#
List all completed steps for the analysis.
- Type:
list[str]
- Attributes:
available_stepsList all available steps for the analysis.
completed_stepsList all completed steps for the analysis.
resultsGet the current analysis results.
Methods
get_step_info(step_name)Get information about a specific analysis step.
get_step_metadata(step_name)Get the metadata for a specific analysis step.
get_step_results(step_name)Get the results for a specific analysis step.
load(filepath)Load an Analysis object from a file using pickle.
Return the metadata for all completed steps.
save(filepath[, force])Save the Analysis object to a file using pickle.
visualize_dependencies([fontname, fontsize, ...])Create a clear visualization of step dependencies using Graphviz.
- property available_steps: list[str]#
List all available steps for the analysis.
- property completed_steps: list[str]#
List all completed steps for the analysis.
- metadata_report()[source]#
Return the metadata for all completed steps.
The report will be in the order that the steps were completed.
For steps which were run more than once their order will be in the order they were run the first time.
- Return type:
list[dict[str,Any]]
- visualize_dependencies(fontname='Helvetica', fontsize=11, rankdir='LR', complete_linecolor='darkgreen', complete_fillcolor='palegreen', incomplete_linecolor='gray70', incomplete_fillcolor='white', step_linecolor='navy', step_fillcolor='lightblue')#
Create a clear visualization of step dependencies using Graphviz.
- Parameters:
fontname (str, optional) – The font to use for text, by default “Helvetica”
fontsize (int, optional) – The font size to use, by default 11
rankdir (str, optional) – The direction of the graph layout, by default “LR”
complete_linecolor (str, optional) – The color of edges for completed steps, by default “darkgreen”
complete_fillcolor (str, optional) – The fill color for nodes of completed steps, by default “palegreen”
incomplete_linecolor (str, optional) – The color of edges for incomplete steps, by default “gray70”
incomplete_fillcolor (str, optional) – The fill color for nodes of incomplete steps, by default “white”
step_linecolor (str, optional) – The color of edges for step nodes, by default “navy”
step_fillcolor (str, optional) – The fill color for step nodes, by default “lightblue”
- Returns:
The rendered graph object
- Return type:
graphviz.Digraph
Examples
>>> import yaflux as yf >>> >>> class MyAnalysis(yf.Base): >>> @yf.step(creates="a") >>> def step_a(self): >>> return 42 >>> >>> @yf.step(creates="b", requires="a") >>> def step_b(self): >>> return 42 >>> >>> @yf.step(creates="c", requires=["a", "b"]) >>> def step_c(self): >>> return 42 >>> >>> analysis = MyAnalysis() >>> >>> # Visualize the dependencies >>> analysis.visualize_dependencies() >>> >>> # Save the visualization to a file >>> dot = analysis.visualize_dependencies() >>> dot.render('dependencies.pdf')