コード例 #1
0
    def test_ph_multiples(self):
        """
        Test ability of ph_calc_phwater to process multiple pH measurements
        in a single block.
        """
        bout = ph.ph_battery(self.braw)
        tout = ph.ph_thermistor(self.traw)
        a434 = ph.ph_434_intensity(self.light)  # no unit tests, just checking to see if they work
        print a434
        a578 = ph.ph_578_intensity(self.light)
        print a578

        # reset calibration values to an array, replicating how ION will pass
        # the data when processing blocks of values.
        ea434 = np.ones(15) * self.ea434
        eb434 = np.ones(15) * self.eb434
        ea578 = np.ones(15) * self.ea578
        eb578 = np.ones(15) * self.eb578
        ind_slp = np.ones(15) * self.ind_slp
        ind_off = np.ones(15) * self.ind_off

        # test the function
        pout = ph.ph_calc_phwater(
            self.ref, self.light, tout, ea434, eb434, ea578, eb578, ind_slp, ind_off, self.salinity
        )

        # test above output where records were processed one at a time
        np.testing.assert_array_almost_equal(bout, self.vbatt, 4)
        np.testing.assert_array_almost_equal(tout, self.therm, 4)
        np.testing.assert_array_almost_equal(pout, self.pH, 4)
コード例 #2
0
    def test_ph_multiples(self):
        """
        Test ability of ph_calc_phwater to process multiple pH measurements
        in a single block.
        """
        bout = ph.ph_battery(self.braw)
        tout = ph.ph_thermistor(self.traw)
        a434 = ph.ph_434_intensity(
            self.light)  # no unit tests, just checking to see if they work
        print a434
        a578 = ph.ph_578_intensity(self.light)
        print a578

        # reset calibration values to an array, replicating how ION will pass
        # the data when processing blocks of values.
        ea434 = np.ones(15) * self.ea434
        eb434 = np.ones(15) * self.eb434
        ea578 = np.ones(15) * self.ea578
        eb578 = np.ones(15) * self.eb578
        ind_slp = np.ones(15) * self.ind_slp
        ind_off = np.ones(15) * self.ind_off

        # test the function
        pout = ph.ph_calc_phwater(self.ref, self.light, tout, ea434, eb434,
                                  ea578, eb578, ind_slp, ind_off,
                                  self.salinity)

        # test above output where records were processed one at a time
        np.testing.assert_array_almost_equal(bout, self.vbatt, 4)
        np.testing.assert_array_almost_equal(tout, self.therm, 4)
        np.testing.assert_array_almost_equal(pout, self.pH, 4)
コード例 #3
0
    def test_ph_singles(self):
        """
        Test ability of ph_calc_phwater to process a single pH measurement, one
        measurement at a time.
        """
        # determine the number of records and create the output arrays
        nRec = self.ref.shape[0]
        bout = np.zeros(nRec, dtype=np.float)
        tout = np.zeros(nRec, dtype=np.float)
        a434 = np.zeros((nRec, 23), dtype=np.float)
        a578 = np.zeros((nRec, 23), dtype=np.float)
        pout = np.zeros(nRec, dtype=np.float)

        # index through the records, calculating pH one record at a time
        for iRec in range(nRec):
            # compute the battery voltage, final temperature in deg_C and pH,
            # record by record.
            bout[iRec] = ph.ph_battery(self.braw[iRec])
            a434[iRec, :] = ph.ph_434_intensity(self.light[iRec, :])
            a578[iRec, :] = ph.ph_578_intensity(self.light[iRec, :])
            tout[iRec] = ph.ph_thermistor(self.traw[iRec])
            pout[iRec] = ph.ph_calc_phwater(self.ref[iRec, :],
                                            self.light[iRec, :], tout[iRec],
                                            self.ea434, self.eb434, self.ea578,
                                            self.eb578, self.ind_slp,
                                            self.ind_off, self.salinity[iRec])

        # test above output where records were processed one at a time
        np.testing.assert_array_almost_equal(bout, self.vbatt, 4)
        np.testing.assert_array_almost_equal(tout, self.therm, 4)
        np.testing.assert_array_almost_equal(pout, self.pH, 4)
コード例 #4
0
    def test_ph_singles(self):
        """
        Test ability of ph_calc_phwater to process a single pH measurement, one
        measurement at a time.
        """
        # determine the number of records and create the output arrays
        nRec = self.ref.shape[0]
        bout = np.zeros(nRec, dtype=np.float)
        tout = np.zeros(nRec, dtype=np.float)
        a434 = np.zeros((nRec, 23), dtype=np.float)
        a578 = np.zeros((nRec, 23), dtype=np.float)
        pout = np.zeros(nRec, dtype=np.float)

        # index through the records, calculating pH one record at a time
        for iRec in range(nRec):
            # compute the battery voltage, final temperature in deg_C and pH,
            # record by record.
            bout[iRec] = ph.ph_battery(self.braw[iRec])
            a434[iRec, :] = ph.ph_434_intensity(self.light[iRec, :])
            a578[iRec, :] = ph.ph_578_intensity(self.light[iRec, :])
            tout[iRec] = ph.ph_thermistor(self.traw[iRec])
            pout[iRec] = ph.ph_calc_phwater(
                self.ref[iRec, :],
                self.light[iRec, :],
                tout[iRec],
                self.ea434,
                self.eb434,
                self.ea578,
                self.eb578,
                self.ind_slp,
                self.ind_off,
                self.salinity[iRec],
            )

        # test above output where records were processed one at a time
        np.testing.assert_array_almost_equal(bout, self.vbatt, 4)
        np.testing.assert_array_almost_equal(tout, self.therm, 4)
        np.testing.assert_array_almost_equal(pout, self.pH, 4)