diff --git a/tests/test_herg_qc.py b/tests/test_herg_qc.py index 4dc87ce..fc1f81d 100644 --- a/tests/test_herg_qc.py +++ b/tests/test_herg_qc.py @@ -118,69 +118,169 @@ def test_qc1(self): f"QC1: {rseal}, {cm}, {rseries}", ) - # Test on data - failed_wells_before = [ - 'A10', 'A12', 'A13', 'A16', 'A19', 'A20', 'A24', 'B05', 'B07', 'B11', - 'B12', 'B13', 'B15', 'B19', 'B21', 'B23', 'C02', 'C04', 'C07', 'C09', - 'C11', 'C12', 'C14', 'C18', 'C19', 'C20', 'C23', 'D02', 'D03', 'D05', - 'D09', 'D10', 'D14', 'D15', 'D16', 'D19', 'D21', 'E04', 'E06', 'E07', - 'E10', 'E11', 'E14', 'E15', 'E16', 'E17', 'E19', 'E22', 'E23', 'F01', - 'F03', 'F04', 'F05', 'F07', 'F09', 'F12', 'F13', 'F14', 'F15', 'F18', - 'F19', 'F20', 'F21', 'F24', 'G06', 'G09', 'G12', 'G13', 'G14', 'G16', - 'G17', 'G20', 'G21', 'G23', 'G24', 'H01', 'H02', 'H03', 'H06', 'H07', - 'H08', 'H10', 'H11', 'H13', 'H14', 'H15', 'H16', 'H19', 'H21', 'H23', - 'H24', 'I01', 'I04', 'I05', 'I06', 'I07', 'I08', 'I10', 'I11', 'I12', - 'I16', 'I17', 'I21', 'J07', 'J10', 'J16', 'J17', 'J19', 'J21', 'J24', - 'K02', 'K03', 'K06', 'K07', 'K11', 'K12', 'K16', 'K17', 'K20', 'K22', - 'K24', 'L01', 'L02', 'L04', 'L05', 'L08', 'L10', 'L11', 'L13', 'L16', - 'L17', 'L18', 'L24', 'M01', 'M04', 'M06', 'M09', 'M12', 'M14', 'M15', - 'M16', 'M19', 'M20', 'M21', 'N03', 'N04', 'N06', 'N08', 'N11', 'N13', - 'N14', 'N16', 'N18', 'N21', 'N24', 'O01', 'O02', 'O03', 'O05', 'O07', - 'O10', 'O11', 'O17', 'O19', 'O22', 'O24', 'P01', 'P03', 'P06', 'P07', - 'P08', 'P09', 'P12', 'P13', 'P14', 'P15', 'P16', 'P17', 'P18', 'P21', - 'P22', 'P24' + # Test on data - values before + failed_wells_rseal_before = [ + 'A10', 'A12', 'A13', 'A16', 'A19', 'A20', 'B05', 'B07', 'B11', 'B12', + 'B13', 'B15', 'B19', 'B21', 'B23', 'C02', 'C04', 'C07', 'C09', 'C11', + 'C12', 'C14', 'C18', 'C19', 'C20', 'D02', 'D03', 'D05', 'D09', 'D10', + 'D14', 'D15', 'D19', 'D21', 'E04', 'E07', 'E10', 'E11', 'E14', 'E15', + 'E16', 'E17', 'E22', 'E23', 'F01', 'F03', 'F04', 'F05', 'F07', 'F09', + 'F12', 'F13', 'F14', 'F15', 'F18', 'F19', 'F20', 'F21', 'F24', 'G06', + 'G09', 'G12', 'G13', 'G14', 'G16', 'G20', 'G23', 'G24', 'H01', 'H02', + 'H03', 'H06', 'H07', 'H08', 'H10', 'H11', 'H13', 'H14', 'H15', 'H16', + 'H19', 'H21', 'H23', 'H24', 'I01', 'I04', 'I05', 'I07', 'I08', 'I10', + 'I11', 'I12', 'I16', 'I17', 'I21', 'J07', 'J10', 'J16', 'J17', 'J19', + 'J21', 'J24', 'K02', 'K03', 'K06', 'K07', 'K11', 'K12', 'K16', 'K17', + 'K20', 'K22', 'K24', 'L01', 'L02', 'L04', 'L05', 'L08', 'L10', 'L11', + 'L13', 'L16', 'L17', 'L18', 'L24', 'M01', 'M04', 'M06', 'M09', 'M12', + 'M16', 'M19', 'M21', 'N03', 'N04', 'N06', 'N08', 'N11', 'N13', 'N14', + 'N16', 'N18', 'N21', 'N24', 'O01', 'O02', 'O03', 'O05', 'O07', 'O10', + 'O11', 'O17', 'O19', 'O22', 'O24', 'P01', 'P03', 'P06', 'P07', 'P08', + 'P09', 'P12', 'P13', 'P14', 'P15', 'P17', 'P18', 'P21', 'P22', 'P24' + ] + + failed_wells_cm_before = [ + 'A12', 'A13', 'A16', 'A19', 'B07', 'B11', 'B13', 'B15', 'B21', 'B23', + 'C02', 'C04', 'C07', 'C11', 'C12', 'C14', 'C18', 'C20', 'D03', 'D10', + 'D14', 'E04', 'E07', 'E10', 'E15', 'E16', 'E17', 'E22', 'E23', 'F01', + 'F03', 'F04', 'F07', 'F12', 'F14', 'F15', 'F18', 'F19', 'F20', 'F21', + 'F24', 'G09', 'G12', 'G13', 'G16', 'G20', 'G23', 'G24', 'H01', 'H03', + 'H06', 'H07', 'H10', 'H15', 'H19', 'H21', 'H23', 'H24', 'I04', 'I05', + 'I07', 'I10', 'I12', 'I16', 'I17', 'I21', 'J07', 'J16', 'J19', 'J21', + 'K02', 'K16', 'K22', 'L01', 'L02', 'L04', 'L05', 'L08', 'L10', 'L11', + 'L13', 'L17', 'L18', 'M01', 'M04', 'M12', 'M19', 'M21', 'N06', 'N08', + 'N11', 'N14', 'N18', 'N21', 'N24', 'O01', 'O03', 'O07', 'O10', 'O17', + 'O19', 'O22', 'O24', 'P01', 'P06', 'P07', 'P08', 'P12', 'P13', 'P14', + 'P15', 'P16', 'P18', 'P21', 'P22' + ] + + failed_wells_rseries_before = [ + 'A12', 'A13', 'A16', 'A19', 'A24', 'B07', 'B11', 'B13', 'B15', 'B21', + 'B23', 'C02', 'C04', 'C07', 'C11', 'C12', 'C14', 'C18', 'C20', 'C23', + 'D03', 'D09', 'D10', 'D14', 'D15', 'D16', 'E04', 'E06', 'E07', 'E10', + 'E15', 'E16', 'E17', 'E19', 'E22', 'E23', 'F01', 'F03', 'F04', 'F07', + 'F12', 'F14', 'F15', 'F18', 'F19', 'F20', 'F21', 'F24', 'G09', 'G12', + 'G13', 'G16', 'G17', 'G20', 'G21', 'G23', 'G24', 'H01', 'H03', 'H07', + 'H10', 'H15', 'H19', 'H21', 'H23', 'H24', 'I04', 'I05', 'I06', 'I07', + 'I10', 'I12', 'I16', 'I17', 'I21', 'J07', 'J16', 'J19', 'J21', 'K02', + 'K16', 'K22', 'L01', 'L02', 'L04', 'L05', 'L08', 'L10', 'L11', 'L13', + 'L17', 'L18', 'M01', 'M04', 'M12', 'M14', 'M15', 'M19', 'M20', 'M21', + 'N06', 'N08', 'N11', 'N14', 'N18', 'N21', 'N24', 'O01', 'O03', 'O07', + 'O10', 'O17', 'O19', 'O22', 'O24', 'P01', 'P06', 'P07', 'P08', 'P12', + 'P13', 'P14', 'P15', 'P16', 'P18', 'P21', 'P22' ] for well in self.all_wells: qc_vals_before = np.array(self.qc_vals_before[well])[0, :] - ex_pass_before = well not in failed_wells_before + result = hergqc.qc1(*qc_vals_before) + + pass_rseal_before, rseal_before = result[0] + ex_pass_rseal_before = well not in failed_wells_rseal_before + self.assertEqual( + pass_rseal_before, + ex_pass_rseal_before, + f"QC1: {well} (rseal before) {rseal_before}", + ) + + pass_cm_before, cm_before = result[1] + ex_pass_cm_before = well not in failed_wells_cm_before + self.assertEqual( + pass_cm_before, + ex_pass_cm_before, + f"QC1: {well} (cm before) {cm_before}", + ) + + pass_rseries_before, rseries_before = result[2] + ex_pass_rseries_before = well not in failed_wells_rseries_before self.assertEqual( - all_passed(hergqc.qc1(*qc_vals_before)), - ex_pass_before, - f"QC1: {well} (before) {qc_vals_before}", + pass_rseries_before, + ex_pass_rseries_before, + f"QC1: {well} (rseries before) {rseries_before}", ) - failed_wells_after = [ - 'A06', 'A08', 'A10', 'A12', 'A13', 'A16', 'A19', 'A20', 'A24', 'B02', - 'B05', 'B07', 'B11', 'B12', 'B13', 'B15', 'B19', 'B21', 'B23', 'C01', - 'C02', 'C04', 'C07', 'C09', 'C11', 'C12', 'C14', 'C18', 'C20', 'C22', - 'C23', 'D03', 'D05', 'D09', 'D10', 'D14', 'D15', 'D19', 'D21', 'E01', - 'E03', 'E04', 'E06', 'E07', 'E09', 'E10', 'E11', 'E14', 'E15', 'E16', - 'E17', 'E19', 'E20', 'E22', 'E23', 'E24', 'F01', 'F03', 'F04', 'F07', - 'F09', 'F12', 'F13', 'F14', 'F15', 'F16', 'F18', 'F19', 'F20', 'F21', - 'F24', 'G06', 'G08', 'G09', 'G12', 'G13', 'G14', 'G15', 'G16', 'G17', - 'G20', 'G21', 'G23', 'G24', 'H01', 'H02', 'H03', 'H04', 'H06', 'H07', - 'H08', 'H09', 'H10', 'H11', 'H13', 'H14', 'H15', 'H16', 'H17', 'H18', - 'H19', 'H20', 'H21', 'H23', 'H24', 'I01', 'I04', 'I05', 'I06', 'I07', - 'I08', 'I10', 'I12', 'I16', 'I17', 'I20', 'I21', 'J03', 'J07', 'J10', - 'J14', 'J16', 'J17', 'J19', 'J21', 'J23', 'J24', 'K02', 'K03', 'K06', - 'K07', 'K14', 'K16', 'K20', 'K22', 'K23', 'K24', 'L01', 'L02', 'L03', - 'L04', 'L05', 'L08', 'L10', 'L11', 'L12', 'L13', 'L16', 'L17', 'L18', - 'L24', 'M01', 'M02', 'M04', 'M05', 'M06', 'M08', 'M09', 'M12', 'M13', - 'M14', 'M15', 'M19', 'M20', 'M21', 'N04', 'N06', 'N08', 'N11', 'N13', - 'N14', 'N16', 'N18', 'N19', 'N21', 'N24', 'O01', 'O02', 'O03', 'O05', - 'O07', 'O08', 'O10', 'O11', 'O14', 'O15', 'O17', 'O19', 'O22', 'O24', - 'P01', 'P03', 'P06', 'P07', 'P08', 'P09', 'P11', 'P12', 'P13', 'P14', - 'P15', 'P16', 'P17', 'P18', 'P19', 'P21', 'P22' + # Test on data - values after + failed_wells_rseal_after = [ + 'A10', 'A12', 'A13', 'A16', 'A19', 'A20', 'A24', 'B02', 'B05', 'B07', + 'B11', 'B12', 'B13', 'B15', 'B21', 'B23', 'C02', 'C04', 'C07', 'C09', + 'C11', 'C12', 'C14', 'C18', 'C20', 'C22', 'D03', 'D05', 'D10', 'D14', + 'D19', 'D21', 'E04', 'E07', 'E10', 'E11', 'E14', 'E15', 'E16', 'E17', + 'E22', 'E23', 'F01', 'F03', 'F04', 'F07', 'F09', 'F12', 'F13', 'F14', + 'F15', 'F18', 'F19', 'F20', 'F21', 'F24', 'G06', 'G08', 'G09', 'G12', + 'G13', 'G15', 'G16', 'G20', 'G23', 'G24', 'H01', 'H03', 'H06', 'H07', + 'H08', 'H09', 'H10', 'H11', 'H14', 'H15', 'H16', 'H17', 'H18', 'H19', + 'H21', 'H23', 'H24', 'I04', 'I05', 'I06', 'I07', 'I08', 'I10', 'I12', + 'I16', 'I17', 'I21', 'J07', 'J10', 'J16', 'J17', 'J19', 'J21', 'J23', + 'J24', 'K02', 'K03', 'K07', 'K14', 'K16', 'K20', 'K22', 'K23', 'K24', + 'L01', 'L02', 'L04', 'L05', 'L08', 'L10', 'L11', 'L13', 'L17', 'L18', + 'L24', 'M01', 'M04', 'M06', 'M09', 'M12', 'M19', 'M21', 'N04', 'N06', + 'N08', 'N11', 'N13', 'N14', 'N16', 'N18', 'N21', 'N24', 'O01', 'O02', + 'O03', 'O07', 'O08', 'O10', 'O11', 'O17', 'O19', 'O22', 'O24', 'P01', + 'P06', 'P07', 'P08', 'P09', 'P12', 'P13', 'P14', 'P15', 'P17', 'P18', + 'P21', 'P22' + ] + + failed_wells_cm_after = [ + 'A12', 'A13', 'A19', 'A20', 'B07', 'B11', 'B13', 'B15', 'B19', 'B21', + 'B23', 'C02', 'C04', 'C11', 'C12', 'C14', 'C18', 'C20', 'D10', 'D14', + 'E03', 'E09', 'E10', 'E15', 'E16', 'E17', 'E19', 'E22', 'E23', 'F01', + 'F03', 'F04', 'F07', 'F12', 'F14', 'F15', 'F18', 'F19', 'F20', 'F21', + 'F24', 'G06', 'G09', 'G12', 'G13', 'G16', 'G20', 'G23', 'G24', 'H01', + 'H03', 'H07', 'H09', 'H10', 'H15', 'H19', 'H21', 'H23', 'H24', 'I04', + 'I05', 'I07', 'I10', 'I12', 'I16', 'I17', 'I21', 'J07', 'J16', 'J19', + 'J21', 'K02', 'K16', 'K22', 'K23', 'L01', 'L02', 'L04', 'L05', 'L08', + 'L10', 'L11', 'L13', 'L16', 'L17', 'L18', 'M01', 'M04', 'M12', 'M15', + 'M19', 'M21', 'N06', 'N08', 'N11', 'N14', 'N18', 'N19', 'N21', 'N24', + 'O01', 'O03', 'O07', 'O10', 'O15', 'O17', 'O19', 'O22', 'O24', 'P01', + 'P06', 'P08', 'P12', 'P13', 'P14', 'P15', 'P16', 'P17', 'P18', 'P21', + 'P22' + ] + + failed_wells_rseries_after = [ + 'A06', 'A08', 'A12', 'A13', 'A19', 'A20', 'A24', 'B07', 'B11', 'B13', + 'B15', 'B19', 'B21', 'B23', 'C01', 'C02', 'C04', 'C09', 'C11', 'C12', + 'C14', 'C18', 'C20', 'C22', 'C23', 'D09', 'D10', 'D14', 'D15', 'D19', + 'E01', 'E03', 'E04', 'E06', 'E09', 'E10', 'E15', 'E16', 'E17', 'E19', + 'E20', 'E22', 'E23', 'E24', 'F01', 'F03', 'F04', 'F07', 'F12', 'F14', + 'F15', 'F16', 'F18', 'F19', 'F20', 'F21', 'F24', 'G06', 'G09', 'G12', + 'G13', 'G14', 'G16', 'G17', 'G20', 'G21', 'G23', 'G24', 'H01', 'H02', + 'H03', 'H04', 'H07', 'H09', 'H10', 'H13', 'H14', 'H15', 'H19', 'H20', + 'H21', 'H23', 'H24', 'I01', 'I04', 'I05', 'I07', 'I10', 'I12', 'I16', + 'I17', 'I20', 'I21', 'J03', 'J07', 'J14', 'J16', 'J19', 'J21', 'K02', + 'K06', 'K16', 'K22', 'K23', 'K24', 'L01', 'L02', 'L03', 'L04', 'L05', + 'L08', 'L10', 'L11', 'L12', 'L13', 'L16', 'L17', 'L18', 'M01', 'M02', + 'M04', 'M05', 'M08', 'M09', 'M12', 'M13', 'M14', 'M15', 'M19', 'M20', + 'M21', 'N06', 'N08', 'N11', 'N14', 'N18', 'N19', 'N21', 'N24', 'O01', + 'O03', 'O05', 'O07', 'O10', 'O11', 'O14', 'O15', 'O17', 'O19', 'O22', + 'O24', 'P01', 'P03', 'P06', 'P08', 'P11', 'P12', 'P13', 'P14', 'P15', + 'P16', 'P17', 'P18', 'P19', 'P21', 'P22' ] for well in self.all_wells: qc_vals_after = np.array(self.qc_vals_after[well])[0, :] - ex_pass_after = well not in failed_wells_after + result = hergqc.qc1(*qc_vals_after) + + pass_rseal_after, rseal_after = result[0] + ex_pass_rseal_after = well not in failed_wells_rseal_after + self.assertEqual( + pass_rseal_after, + ex_pass_rseal_after, + f"QC1: {well} (rseal after) {rseal_after}", + ) + + pass_cm_after, cm_after = result[1] + ex_pass_cm_after = well not in failed_wells_cm_after + self.assertEqual( + pass_cm_after, + ex_pass_cm_after, + f"QC1: {well} (cm after) {cm_after}", + ) + + pass_rseries_after, rseries_after = result[2] + ex_pass_rseries_after = well not in failed_wells_rseries_after self.assertEqual( - all_passed(hergqc.qc1(*qc_vals_after)), - ex_pass_after, - f"QC1: {well} (after) {qc_vals_after}", + pass_rseries_after, + ex_pass_rseries_after, + f"QC1: {well} (rseries after) {rseries_after}", ) def test_qc2(self):