Esempio n. 1
0
    def test_da_display(self, file, exp_vol, exp_pot):
        """Test isotherm display."""
        if exp_vol is None:
            return

        filepath = os.path.join(DATA_N77_PATH, file)

        with open(filepath, 'r') as text_file:
            isotherm = pygaps.isotherm_from_json(text_file.read())

        pygaps.da_plot(isotherm, verbose=True)
Esempio n. 2
0
    def test_da_plot(self, file, exp_vol, exp_pot):
        """Test calculation with takeda isotherm."""
        if exp_vol is None:
            return

        filepath = os.path.join(DATA_N77_PATH, file)

        with open(filepath, 'r') as text_file:
            isotherm = pygaps.isotherm_from_json(text_file.read())

        res = pygaps.da_plot(isotherm, limits=[0, 0.01])

        da_vol = res.get("pore_volume")
        da_pot = res.get("adsorption_potential")

        err_relative = 0.05  # 5 percent
        err_absolute = 0.01  # 0.01 cm3/g

        assert isclose(da_vol, exp_vol, err_relative, err_absolute)
        assert isclose(da_pot, exp_pot, err_relative, err_absolute)
Esempio n. 3
0
    def test_da_plot(self, sample):
        """Test calculation with several model isotherms."""
        sample = DATA[sample]
        # exclude datasets where it is not applicable
        if sample.get('da_volume', None):

            filepath = os.path.join(DATA_N77_PATH, sample['file'])
            isotherm = pygaps.isotherm_from_jsonf(filepath)

            res = pygaps.da_plot(isotherm, limits=[0, 0.01])

            da_vol = res.get("pore_volume")
            da_pot = res.get("adsorption_potential")

            err_relative = 0.05  # 5 percent
            err_absolute = 0.01  # 0.01 cm3/g

            assert isclose(da_vol, sample['da_volume'], err_relative,
                           err_absolute)
            assert isclose(da_pot, sample['da_potential'], err_relative,
                           err_absolute)
Esempio n. 4
0
 def test_da_output(self):
     """Test verbosity."""
     sample = DATA['Takeda 5A']
     filepath = os.path.join(DATA_N77_PATH, sample['file'])
     isotherm = pygaps.isotherm_from_jsonf(filepath)
     pygaps.da_plot(isotherm, verbose=True)
Esempio n. 5
0
    def test_dr_checks(self, basic_pointisotherm):
        """Checks for built-in safeguards."""

        # Will raise a "no reference isotherm error"
        with pytest.raises(pygaps.ParameterError):
            pygaps.da_plot(basic_pointisotherm, exp=-2)