High Speed Auswertung und Database code
This commit is contained in:
28
projects/HighSpeedExperiment_2024/auswertung/checkDB.m
Normal file
28
projects/HighSpeedExperiment_2024/auswertung/checkDB.m
Normal file
@@ -0,0 +1,28 @@
|
||||
function checkDB(db_path)
|
||||
|
||||
db = DBHandler("pathToDB",db_path);
|
||||
|
||||
num_runs = db.fetch('SELECT COUNT(*) AS total_runs FROM Runs');
|
||||
|
||||
num_configs = db.fetch('SELECT COUNT(*) AS total_configurations FROM Configurations');
|
||||
|
||||
num_meas = db.fetch('SELECT COUNT(*) AS total_measurements FROM Measurements');
|
||||
|
||||
assert((num_runs{1,1}==num_configs{1,1})&&(num_configs{1,1}==num_meas{1,1}),'Different num of entries per table')
|
||||
|
||||
% should not be possible, but check if anyconfig or meas is without
|
||||
% parent Run entry
|
||||
unmatchedConfigs = db.fetch('SELECT COUNT(*) AS unmatched_configs FROM Configurations WHERE run_id NOT IN (SELECT run_id FROM Runs)');
|
||||
unmatchedMeasurements = db.fetch('SELECT COUNT(*) AS unmatched_measurements FROM Measurements WHERE run_id NOT IN (SELECT run_id FROM Runs)');
|
||||
|
||||
if unmatchedConfigs{1,1}~=0 || unmatchedMeasurements{1,1}~=0
|
||||
fprintf('Unmatched Configurations: %d\n', unmatchedConfigs{1,1});
|
||||
fprintf('Unmatched Measurements: %d\n', unmatchedMeasurements{1,1});
|
||||
end
|
||||
|
||||
%Check for any duplicate paths
|
||||
db.fetch("SELECT rx_raw_path, COUNT(*) AS occurrences FROM Runs GROUP BY rx_raw_path HAVING COUNT(*) > 1");
|
||||
db.fetch("SELECT rx_sync_path, COUNT(*) AS occurrences FROM Runs GROUP BY rx_sync_path HAVING COUNT(*) > 1");
|
||||
db.fetch("SELECT filename, COUNT(*) AS occurrences FROM Runs GROUP BY filename HAVING COUNT(*) > 1");
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user