def plot_isotherm(self, T, zs, ws, Pmin=None, Pmax=None, methods=[], pts=50,
                      only_valid=True):  # pragma: no cover
        r'''Method to create a plot of the property vs pressure at a specified
        temperature and composition according to either a specified list of 
        methods, or the  user methods (if set), or all methods. User-selectable
         number of  points, and pressure range. If only_valid is set,
        `test_method_validity` will be used to check if each condition in 
        the specified range is valid, and `test_property_validity` will be used
        to test the answer, and the method is allowed to fail; only the valid 
        points will be plotted. Otherwise, the result will be calculated and 
        displayed as-is. This will not suceed if the method fails.

        Parameters
        ----------
        T : float
            Temperature at which to create the plot, [K]
        zs : list[float]
            Mole fractions of all species in the mixture, [-]
        ws : list[float]
            Weight fractions of all species in the mixture, [-]
        Pmin : float
            Minimum pressure, to begin calculating the property, [Pa]
        Pmax : float
            Maximum pressure, to stop calculating the property, [Pa]
        methods : list, optional
            List of methods to consider
        pts : int, optional
            A list of points to calculate the property at; if Pmin to Pmax
            covers a wide range of method validities, only a few points may end
            up calculated for a given method so this may need to be large
        only_valid : bool
            If True, only plot successful methods and calculated properties,
            and handle errors; if False, attempt calculation without any
            checking and use methods outside their bounds
        '''
        # This function cannot be tested
        if not has_matplotlib:
            raise Exception('Optional dependency matplotlib is required for plotting')
        if Pmin is None:
            if self.Pmin is not None:
                Pmin = self.Pmin
            else:
                raise Exception('Minimum pressure could not be auto-detected; please provide it')
        if Pmax is None:
            if self.Pmax is not None:
                Pmax = self.Pmax
            else:
                raise Exception('Maximum pressure could not be auto-detected; please provide it')

        if not methods:
            if self.user_methods:
                methods = self.user_methods
            else:
                methods = self.all_methods
        Ps = np.linspace(Pmin, Pmax, pts)
        for method in methods:
            if only_valid:
                properties, Ps2 = [], []
                for P in Ps:
                    if self.test_method_validity(T, P, zs, ws, method):
                        try:
                            p = self.calculate(T, P, zs, ws, method)
                            if self.test_property_validity(p):
                                properties.append(p)
                                Ps2.append(P)
                        except:
                            pass
                plt.plot(Ps2, properties, label=method)
            else:
                properties = [self.calculate(T, P, zs, ws, method) for P in Ps]
                plt.plot(Ps, properties, label=method)
        plt.legend(loc='best')
        plt.ylabel(self.name + ', ' + self.units)
        plt.xlabel('Pressure, Pa')
        plt.title(self.name + ' of a mixture of ' + ', '.join(self.CASs) 
                  + ' at mole fractions of ' + ', '.join(str(round(i, 4)) for i in zs) + '.')
        plt.show()
def plot_isotherm(self, T, zs, ws, Pmin=None, Pmax=None, methods=[], pts=50,
                      only_valid=True):  
        r
        
        if not has_matplotlib:
            raise Exception('Optional dependency matplotlib is required for plotting')
        if Pmin is None:
            if self.Pmin is not None:
                Pmin = self.Pmin
            else:
                raise Exception('Minimum pressure could not be auto-detected; please provide it')
        if Pmax is None:
            if self.Pmax is not None:
                Pmax = self.Pmax
            else:
                raise Exception('Maximum pressure could not be auto-detected; please provide it')

        if not methods:
            if self.user_methods:
                methods = self.user_methods
            else:
                methods = self.all_methods
        Ps = np.linspace(Pmin, Pmax, pts)
        for method in methods:
            if only_valid:
                properties, Ps2 = [], []
                for P in Ps:
                    if self.test_method_validity(T, P, zs, ws, method):
                        try:
                            p = self.calculate(T, P, zs, ws, method)
                            if self.test_property_validity(p):
                                properties.append(p)
                                Ps2.append(P)
                        except:
                            pass
                plt.plot(Ps2, properties, label=method)
            else:
                properties = [self.calculate(T, P, zs, ws, method) for P in Ps]
                plt.plot(Ps, properties, label=method)
        plt.legend(loc='best')
        plt.ylabel(self.name + ', ' + self.units)
        plt.xlabel('Pressure, Pa')
        plt.title(self.name + ' of a mixture of ' + ', '.join(self.CASs) 
                  + ' at mole fractions of ' + ', '.join(str(round(i, 4)) for i in zs) + '.')
        plt.show()
def plot_isotherm ( self , T , zs , ws , Pmin = None , Pmax = None , methods = [ ] , pts = 50 , only_valid = True ) : # pragma: no cover # This function cannot be tested if not has_matplotlib : raise Exception ( 'Optional dependency matplotlib is required for plotting' ) if Pmin is None : if self . Pmin is not None : Pmin = self . Pmin else : raise Exception ( 'Minimum pressure could not be auto-detected; please provide it' ) if Pmax is None : if self . Pmax is not None : Pmax = self . Pmax else : raise Exception ( 'Maximum pressure could not be auto-detected; please provide it' ) if not methods : if self . user_methods : methods = self . user_methods else : methods = self . all_methods Ps = np . linspace ( Pmin , Pmax , pts ) for method in methods : if only_valid : properties , Ps2 = [ ] , [ ] for P in Ps : if self . test_method_validity ( T , P , zs , ws , method ) : try : p = self . calculate ( T , P , zs , ws , method ) if self . test_property_validity ( p ) : properties . append ( p ) Ps2 . append ( P ) except : pass plt . plot ( Ps2 , properties , label = method ) else : properties = [ self . calculate ( T , P , zs , ws , method ) for P in Ps ] plt . plot ( Ps , properties , label = method ) plt . legend ( loc = 'best' ) plt . ylabel ( self . name + ', ' + self . units ) plt . xlabel ( 'Pressure, Pa' ) plt . title ( self . name + ' of a mixture of ' + ', ' . join ( self . CASs ) + ' at mole fractions of ' + ', ' . join ( str ( round ( i , 4 ) ) for i in zs ) + '.' ) plt . show ( )
r'''Method to create a plot of the property vs pressure at a specified
        temperature and composition according to either a specified list of 
        methods, or the  user methods (if set), or all methods. User-selectable
         number of  points, and pressure range. If only_valid is set,
        `test_method_validity` will be used to check if each condition in 
        the specified range is valid, and `test_property_validity` will be used
        to test the answer, and the method is allowed to fail; only the valid 
        points will be plotted. Otherwise, the result will be calculated and 
        displayed as-is. This will not suceed if the method fails.

        Parameters
        ----------
        T : float
            Temperature at which to create the plot, [K]
        zs : list[float]
            Mole fractions of all species in the mixture, [-]
        ws : list[float]
            Weight fractions of all species in the mixture, [-]
        Pmin : float
            Minimum pressure, to begin calculating the property, [Pa]
        Pmax : float
            Maximum pressure, to stop calculating the property, [Pa]
        methods : list, optional
            List of methods to consider
        pts : int, optional
            A list of points to calculate the property at; if Pmin to Pmax
            covers a wide range of method validities, only a few points may end
            up calculated for a given method so this may need to be large
        only_valid : bool
            If True, only plot successful methods and calculated properties,
            and handle errors; if False, attempt calculation without any
            checking and use methods outside their bounds
r Method to create a plot of the property vs pressure at a specified temperature and composition according to either a specified list of methods or the user methods ( if set ) or all methods . User - selectable number of points and pressure range . If only_valid is set test_method_validity will be used to check if each condition in the specified range is valid and test_property_validity will be used to test the answer and the method is allowed to fail ; only the valid points will be plotted . Otherwise the result will be calculated and displayed as - is . This will not suceed if the method fails .