<commit_before>import os
import glob
import matplotlib.pyplot as pyplot
from mpl_toolkits.mplot3d import Axes3D     # Necessary for 3D plots
import util.database_helpers as dh
import util.associate
import batch_analysis.experiment
import systems.visual_odometry.libviso2.libviso2 as libviso2
import systems.slam.orbslam2 as orbslam2
import benchmarks.rpe.relative_pose_error as rpe
import benchmarks.trajectory_drift.trajectory_drift as traj_drift


class VisualSlamExperiment(batch_analysis.experiment.Experiment):

    def __init__(self, *args, dataset_map=None, uncategorized_datasets=None, **kwargs):
        super().__init__(*args, **kwargs)
        self._dataset_map = dataset_map if dataset_map is not None else {}
        self._uncategorized_datasets = uncategorized_datasets if uncategorized_datasets is not None else set()

    def import_trainers(self, db_client):
        """
        Import trainers for this experiment.
        Trainers are city simulators of different kinds & qualities
        :param db_client:
        :return:
        """
        return set()

    def import_trainees(self, db_client):
        """
        Import trainees for this experiment.
        This will be the learned VO system from feras
        :param db_client:
        :return:
        """
        return set()

    def import_image_sources(self, db_client, job_system):
        """
        Import image sources for evaluation in this experiment
        :param db_client:
        :param job_system: The job system
        :return:
        """
        for path in glob.iglob(os.path.expanduser('~/Renders/Visual Realism/Experiment 1/**/**/metadata.json')):
            map_key = path.replace('.', '-')
            if map_key not in self._dataset_map:
                if job_system.queue_import_dataset('dataset.generated.import_generated_dataset', path, self.identifier):
                    self._dataset_map[map_key] = False
                    if '$set' not in self._updates:
                        self._updates['$set'] = {}
                    self._updates['$set']['dataset_map.{0}'.format(map_key)] = False

        # TODO: Categorize the uncategorized datasets, and return at least some of them

        return set()

    def import_systems(self, db_client):
        """
        Import the systems under test for this experiment.
        They are: libviso2
        The trained systems we want to use will be added automatically when they are trained.
        TODO: Add ORBSLAM2 as well.<commit_msg>Correct the maximum run time for importing datasets<commit_after>import os
import glob
import matplotlib.pyplot as pyplot
from mpl_toolkits.mplot3d import Axes3D     # Necessary for 3D plots
import util.database_helpers as dh
import util.associate
import batch_analysis.experiment
import systems.visual_odometry.libviso2.libviso2 as libviso2
import systems.slam.orbslam2 as orbslam2
import benchmarks.rpe.relative_pose_error as rpe
import benchmarks.trajectory_drift.trajectory_drift as traj_drift


class VisualSlamExperiment(batch_analysis.experiment.Experiment):

    def __init__(self, *args, dataset_map=None, uncategorized_datasets=None, **kwargs):
        super().__init__(*args, **kwargs)
        self._dataset_map = dataset_map if dataset_map is not None else {}
        self._uncategorized_datasets = uncategorized_datasets if uncategorized_datasets is not None else set()

    def import_trainers(self, db_client):
        """
        Import trainers for this experiment.
        Trainers are city simulators of different kinds & qualities
        :param db_client:
        :return:
        """
        return set()

    def import_trainees(self, db_client):
        """
        Import trainees for this experiment.
        This will be the learned VO system from feras
        :param db_client:
        :return:
        """
        return set()

    def import_image_sources(self, db_client, job_system):
        """
        Import image sources for evaluation in this experiment
        :param db_client:
        :param job_system: The job system
        :return:
        """
        for path in glob.iglob(os.path.expanduser('~/Renders/Visual Realism/Experiment 1/**/**/metadata.json')):
            map_key = path.replace('.', '-')
            if map_key not in self._dataset_map:
                if job_system.queue_import_dataset('dataset.generated.import_generated_dataset', path, self.identifier,
                                                   expected_duration='4:00:00'):
                    self._dataset_map[map_key] = False
                    if '$set' not in self._updates:
                        self._updates['$set'] = {}
                    self._updates['$set']['dataset_map.{0}'.format(map_key)] = False

        # TODO: Categorize the uncategorized datasets, and return at least some of them

        return set()

    def import_systems(self, db_client):
        """
        Import the systems under test for this experiment.
        They are: libviso2
        The trained systems we want to use will be added automatically when they are trained.
        TODO: Add ORBSLAM2 as well.
{'fraction_non_alphanumeric': 0.08004685669660289, 'fraction_numerical': 0.005661850839515814, 'mean_word_length': 2.628186968838527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3011594', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1409, 'n_words': 417}