def calculate_integral_over_T(self, T1, T2):
<EOL>if T2 < T1:<EOL><INDENT>flipped = True<EOL>T1, T2 = T2, T1<EOL><DEDENT>else:<EOL><INDENT>flipped = False<EOL><DEDENT>if self.n == <NUM_LIT:1>:<EOL><INDENT>dS = (Zabransky_cubic_integral_over_T(T2, *self.coeff_sets[<NUM_LIT:0>])<EOL>- Zabransky_cubic_integral_over_T(T1, *self.coeff_sets[<NUM_LIT:0>]))<EOL><DEDENT>else:<EOL><INDENT>ind_T1, ind_T2 = self._coeff_ind_from_T(T1), self._coeff_ind_from_T(T2)<EOL>if ind_T1 == ind_T2:<EOL><INDENT>dS = (Zabransky_cubic_integral_over_T(T2, *self.coeff_sets[ind_T2])<EOL>- Zabransky_cubic_integral_over_T(T1, *self.coeff_sets[ind_T1]))<EOL><DEDENT>else:<EOL><INDENT>dS = (Zabransky_cubic_integral_over_T(self.Ts[ind_T1], *self.coeff_sets[ind_T1])<EOL>- Zabransky_cubic_integral_over_T(T1, *self.coeff_sets[ind_T1]))<EOL>for i in range(ind_T1, ind_T2):<EOL><INDENT>diff =(Zabransky_cubic_integral_over_T(self.Ts[i+<NUM_LIT:1>], *self.coeff_sets[i])<EOL>- Zabransky_cubic_integral_over_T(self.Ts[i], *self.coeff_sets[i]))<EOL>dS += diff<EOL><DEDENT>end = (Zabransky_cubic_integral_over_T(T2, *self.coeff_sets[ind_T2])<EOL>- Zabransky_cubic_integral_over_T(self.Ts[ind_T2], *self.coeff_sets[ind_T2]))<EOL>dS += end<EOL><DEDENT><DEDENT>return -dS if flipped else dS<EOL>
r'''Method to compute the entropy integral of heat capacity from 
        `T1` to `T2`. Analytically integrates across the piecewise spline
        as necessary.

        Parameters
        ----------
        T1 : float
            Initial temperature, [K]
        T2 : float
            Final temperature, [K]

        Returns
        -------
        dS : float
            Entropy difference between `T1` and `T2`, [J/mol/K]