def test_heavy(self): # Sync all S3 objects from beep.utils.memprof import cache_all_kitware_data cache_all_kitware_data() paths = os.listdir(os.path.join(S3_CACHE, "D3Batt_Data_publication")) paths = [path for path in paths if not "Metadata" in path] paths = [ os.path.join(S3_CACHE, "D3Batt_Data_publication", path) for path in paths ] # Run validation on everything v = SimpleValidator() validate_record = v.validate_from_paths(paths, record_results=True, skip_existing=True) df = pd.DataFrame(v.validation_records) df = df.transpose() print(df) print("{} valid, {} invalid".format( len([x for x in df.validated if x]), len([x for x in df.validated if not x]))) invalid_runs = df[np.logical_not(df.validated)] print(invalid_runs) self.assertEqual(len(invalid_runs), 3)
def test_project_name(self): with ScratchDir("."): os.environ["BEEP_PROCESSING_DIR"] = os.getcwd() os.mkdir("data-share") os.mkdir(os.path.join("data-share", "validation")) v = SimpleValidator() paths = [ "FastCharge_000000_CH29.csv", "FastCharge_000025_CH8.csv", "PredictionDiagnostics_000151_test.052", ] paths = [os.path.join(TEST_FILE_DIR, path) for path in paths] validate_record = v.validate_from_paths(paths, record_results=True, skip_existing=False) self.assertEqual( validate_record["FastCharge_000000_CH29.csv"]["method"], "schema-arbin-lfp.yaml", ) self.assertEqual( validate_record["FastCharge_000025_CH8.csv"]["method"], "schema-arbin-lfp.yaml", ) self.assertEqual( validate_record["PredictionDiagnostics_000151_test.052"] ["method"], "schema-maccor-2170.yaml", )
def test_validate_from_paths_maccor(self): paths = [os.path.join(TEST_FILE_DIR, "xTESLADIAG_000019_CH70.070")] # Run validation on everything v = SimpleValidator() validate_record = v.validate_from_paths(paths, record_results=True, skip_existing=False) df = pd.DataFrame(v.validation_records) df = df.transpose() self.assertEqual(df.loc["xTESLADIAG_000019_CH70.070", "method"], "simple_maccor") self.assertEqual(df.loc["xTESLADIAG_000019_CH70.070", "validated"], True)