Skip to content

polykin.copolymerization¤

CopoFitResult dataclass ¤

Dataclass for copolymerization fit results.

ATTRIBUTE DESCRIPTION
method

Name of the fit method.

TYPE: str

r1

Reactivity ratio of M1.

TYPE: float

r2

Reactivity ratio of M2

TYPE: float

alpha

Significance level.

TYPE: float

ci_r1

Confidence interval of r1.

TYPE: float

ci_r2

Confidence interval of r2.

TYPE: float

se_r1

Standard error of r1.

TYPE: float

se_r2

Standard error of r2.

TYPE: float

cov

Scaled variance-covariance matrix.

TYPE: Float2x2Matrix

plots

Dictionary of plots.

TYPE: dict[str, tuple[Figure, Axes]]

M1

Name of M1.

TYPE: str

M2

Name of M2.

TYPE: str

Source code in src/polykin/copolymerization/fitting.py
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
@dataclass
class CopoFitResult():
    r"""Dataclass for copolymerization fit results.

    Attributes
    ----------
    method : str
        Name of the fit method.
    r1 : float
        Reactivity ratio of M1.
    r2: float
        Reactivity ratio of M2
    alpha : float
        Significance level.
    ci_r1 : float
        Confidence interval of r1.
    ci_r2: float
        Confidence interval of r2.
    se_r1 : float
        Standard error of r1.
    se_r2 : float
        Standard error of r2.
    cov : Float2x2Matrix
        Scaled variance-covariance matrix.
    plots : dict[str, tuple[Figure, Axes]]
        Dictionary of plots.
    M1 : str
        Name of M1.
    M2 : str
        Name of M2.
    """

    method: str
    r1: float
    r2: float
    alpha: float
    ci_r1: float
    ci_r2: float
    se_r1: float
    se_r2: float
    cov: Optional[Float2x2Matrix]
    plots: dict[str, tuple[Figure, Axes]]
    M1: str = 'M1'
    M2: str = 'M2'

    def __repr__(self):
        s1 = \
            f"method:  {self.method}\n" \
            f"M1:      {self.M1}\n" \
            f"M2:      {self.M2}\n" \
            f"r1:      {self.r1:.2E}\n" \
            f"r2:      {self.r2:.2E}\n"
        if self.se_r1 is not None:
            s2 = \
                f"alpha:   {self.alpha:.2f}\n" \
                f"se_r1:   {self.se_r1:.2E}\n" \
                f"se_r2:   {self.se_r2:.2E}\n" \
                f"ci_r1:   {self.ci_r1:.2E}\n" \
                f"ci_r2:   {self.ci_r2:.2E}\n"
        else:
            s2 = ""
        if self.cov is not None:
            s3 = f"cov:     {pprint_matrix(self.cov, nspaces=9)}\n"
        else:
            s3 = "\n"
        return s1 + s2 + s3