vdmtools.utils.TitleBuilder

class vdmtools.utils.TitleBuilder(_scan_name: str = '', _info: str = '', _axis: str = '', _correction: str = '', _detector: str = '', _fit: str = '')

Builds the title of a plot.

The title is built by concatenating the values of the private attributes (i.e. attributes that start with an underscore) that are not empty.

Example

>>> builder = TitleBuilder() # Create a new TitleBuilder instance
>>> builder = builder.set_fit("SG") # Set the fit attribute
>>> builder = builder.set_info("8381") # Set the info attribute
>>> builder = builder.set_detector("PLT") # Set the detector attribute
>>> builder = builder.set_correction("Background_BeamBeam_DynamicBeta") # Set the correction attribute
>>> builder.build() # Build the title string
'8381, BG_BB_DB, PLT, SG'

Methods

build()

Builds the title string with the current values of the attributes.

set_axis(axis)

Sets the axis attribute.

set_correction(correction)

Sets the correction attribute.

set_detector(detector)

Sets the detector attribute.

set_fit(fit)

Sets the fit attribute.

set_info(info)

Sets the info attribute.

set_scan_name(scan_name)

Sets the scan_name attribute.

build() str

Builds the title string with the current values of the attributes.

Returns:

The title string.

Return type:

str

set_axis(axis: str) TitleBuilder

Sets the axis attribute.

Parameters:

axis (str) – The axis attribute.

Returns:

The altered TitleBuilder instance.

Return type:

TitleBuilder

set_correction(correction: str) TitleBuilder

Sets the correction attribute.

Parameters:

correction (str) – The correction attribute.

Returns:

The altered TitleBuilder instance.

Return type:

TitleBuilder

set_detector(detector: str) TitleBuilder

Sets the detector attribute.

Parameters:

detector (str) – The detector attribute.

Returns:

The altered TitleBuilder instance.

Return type:

TitleBuilder

set_fit(fit: str) TitleBuilder

Sets the fit attribute.

Parameters:

fit (str) – The fit attribute.

Returns:

The altered TitleBuilder instance.

Return type:

TitleBuilder

set_info(info: str) TitleBuilder

Sets the info attribute.

Parameters:

info (str) – The info attribute.

Returns:

The altered TitleBuilder instance.

Return type:

TitleBuilder

set_scan_name(scan_name: str) TitleBuilder

Sets the scan_name attribute.

Parameters:

scan_name (str) – The scan_name attribute.

Returns:

The altered TitleBuilder instance.

Return type:

TitleBuilder