Skip to content

Exceptions

err

AutomaticOptimizationWarning

Bases: UserWarning

SystemLimitViolationError

Bases: ValueError

SequenceArgumentError

SequenceArgumentError(message: str, argument: str)

Bases: ValueError

Source code in cmrseq/_exceptions.py
24
25
26
27
28
29
def __init__(self, message: str, argument: str):
    function_name = inspect.stack()[1].function
    tmp = (f"\n\tInfeasible value for argument: '{argument}' "
           f"\n\tin parametric sequence definition: '{function_name}'."
           f"\n\tReason: {message}")
    super().__init__(tmp)

SequenceOptimizationError

SequenceOptimizationError(message: str)

Bases: ValueError

Source code in cmrseq/_exceptions.py
32
33
34
35
36
def __init__(self, message: str):
    function_name = inspect.stack()[1].function
    tmp = (f"\n\tNumerical optimization of sequence timing in {function_name} did not converge"
           f"\n{message}")
    super().__init__(tmp)

SequenceValidationError

Bases: ValueError

BuildingBlockArgumentError

BuildingBlockArgumentError(
    message: str, argument: str, class_name: str
)

Bases: ValueError

Source code in cmrseq/_exceptions.py
42
43
44
45
46
47
def __init__(self, message: str, argument: str, class_name: str):
    function_name = inspect.stack()[1].function
    tmp = (f"\n\tInfeasible value for argument: '{argument}' "
           f"\n\tin building block definition: '{class_name}.{function_name}'"
           f"\n\tReason: {message}")
    super().__init__(tmp)

BuildingBlockValidationError

Bases: ValueError

custom_warning_format

custom_warning_format(
    message,
    category,
    filename,
    lineno,
    file=None,
    line=None,
) -> str
Source code in cmrseq/_exceptions.py
10
11
12
13
14
15
def custom_warning_format(message, category, filename, lineno, file=None, line=None) -> str:
    if category.__name__=="AutomaticOptimizationWarning":
        return (f"CMRSeq - {category.__name__}: {os.path.abspath(filename)}:{lineno}\n"
                f"\t+ Arguments were overritten due to violations of System specifications\n"
                f"\t+ {message}\n")
    return f"{message}\n"