Exemple #1
0
    def __init__(self, rootNode, options, configFileName):
        self.options = options
        self.cameraReactivated = False
        self.generalFolderName = self.options['filtering_parameters'][
            'common_directory_prefix'] + self.options['general_parameters'][
                'solver_kind']
        if not os.path.isdir(self.generalFolderName):
            os.mkdir(self.generalFolderName)

        # archive and save previous data
        observationInfix = self.options['system_parameters'][
            'observation_points_file_name']
        observationInfix = observationInfix[observationInfix.rfind('/') +
                                            1:observationInfix.rfind('.')]
        self.folderName = options['filtering_parameters'][
            'filter_kind'] + "_" + observationInfix + options[
                'filtering_parameters']['output_directory_suffix']
        self.fullFolderName = self.generalFolderName + '/' + self.folderName
        folderCreator = FolderHandler()
        folderCreator.createFolder(self.generalFolderName,
                                   self.folderName,
                                   archiveResults=1)

        # create file with parameters and additional information
        self.options['visual_parameters'] = {}
        self.stateFileName = 'state_' + self.options['filtering_parameters'][
            'output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'state_file_name'] = self.stateFileName
        self.varianceFileName = 'variance_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'variance_file_name'] = self.varianceFileName
        self.covarianceFileName = 'covariance_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'covariance_file_name'] = self.covarianceFileName
        self.innovationFileName = 'innovation_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'innovation_file_name'] = self.innovationFileName

        self.informationFileName = self.fullFolderName + '/daconfig.yml'

        with open(self.informationFileName, 'w') as stream:
            try:
                yaml.dump(self.options, stream, default_flow_style=None)

            except yaml.YAMLError as exc:
                print(exc)
                return

        # add timer to evaluate performance
        self.createGraph(rootNode)
        if self.options['time_parameters']['time_profiling']:
            self.createTimeProfiler()
        return None
    def __init__(self, rootNode, options, configFileName):
        self.options = options
        self.cameraReactivated = False
        self.generalFolderName = '.'

        observationInfix = self.options['system_parameters'][
            'observation_points_file_name']
        observationInfix = observationInfix[observationInfix.rfind('/') +
                                            1:observationInfix.rfind('.')]
        self.folderName = 'roukf_testing'
        folderCreator = FolderHandler()
        folderCreator.createFolder(self.generalFolderName,
                                   self.folderName,
                                   archiveResults=0)

        ### create file with parameters and additional information
        self.options['visual_parameters'] = {}
        self.stateFileName = 'state_' + self.options['filtering_parameters'][
            'output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'state_file_name'] = self.stateFileName
        self.varianceFileName = 'variance_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'variance_file_name'] = self.varianceFileName
        self.covarianceFileName = 'covariance_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'covariance_file_name'] = self.covarianceFileName
        self.innovationFileName = 'innovation_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'innovation_file_name'] = self.innovationFileName

        self.informationFileName = self.folderName + '/daconfig.yml'

        with open(self.informationFileName, 'w') as stream:
            try:
                yaml.dump(self.options, stream, default_flow_style=None)

            except yaml.YAMLError as exc:
                print(exc)
                return

        self.createGraph(rootNode)
        if self.options['time_parameters']['time_profiling']:
            self.createTimeProfiler()
        return None
    def __init__(self, *args, **kwargs):
        # These are needed (and the normal way to override from a python class)
        Sofa.Core.Controller.__init__(self, *args, **kwargs)

        self.rootNode = kwargs["node"]
        self.options = kwargs["opt"]
        self.cameraReactivated = False

        ### archive and save previous data
        self.generalFolderName = '.'
        self.folderName = 'roukf_testing'
        if not os.path.isdir(self.folderName):
            os.mkdir(self.folderName)
        folderCreator = FolderHandler()
        folderCreator.createFolder(self.generalFolderName,
                                   self.folderName,
                                   archiveResults=0)

        ### create file with parameters and additional information
        self.options['visual_parameters'] = {}
        self.stateFileName = 'state_' + self.options['filtering_parameters'][
            'output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'state_file_name'] = self.stateFileName
        self.varianceFileName = 'variance_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'variance_file_name'] = self.varianceFileName
        self.covarianceFileName = 'covariance_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'covariance_file_name'] = self.covarianceFileName
        self.innovationFileName = 'innovation_' + self.options[
            'filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters'][
            'innovation_file_name'] = self.innovationFileName

        self.informationFileName = self.folderName + '/daconfig.yml'

        with open(self.informationFileName, 'w') as stream:
            try:
                yaml.dump(self.options, stream, default_flow_style=None)

            except yaml.YAMLError as exc:
                print(exc)
                return

        self.createGraph(self.rootNode)
    def __init__(self, *args, **kwargs):
        # These are needed (and the normal way to override from a python class)
        Sofa.Core.Controller.__init__(self, *args, **kwargs)

        self.rootNode = kwargs["node"]
        self.options = kwargs["opt"]
        self.cameraReactivated = False
        self.generalFolderName = self.options['filtering_parameters']['common_directory_prefix'] + self.options['general_parameters']['solver_kind']
        if not os.path.isdir(self.generalFolderName):
            os.mkdir(self.generalFolderName)

        # archive and save previous data
        observationInfix = self.options['system_parameters']['observation_points_file_name']
        observationInfix = observationInfix[observationInfix.rfind('/') + 1 : observationInfix.rfind('.')]
        self.folderName = self.options['filtering_parameters']['filter_kind'] + "_" + observationInfix + self.options['filtering_parameters']['output_directory_suffix']
        self.fullFolderName = self.generalFolderName + '/' + self.folderName
        folderCreator = FolderHandler()
        folderCreator.createFolder(self.generalFolderName, self.folderName, archiveResults=1)

        # create file with parameters and additional information
        self.options['visual_parameters'] = {}
        self.stateFileName = 'state_' + self.options['filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters']['state_file_name'] = self.stateFileName
        self.varianceFileName = 'variance_' + self.options['filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters']['variance_file_name'] = self.varianceFileName
        self.covarianceFileName = 'covariance_' + self.options['filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters']['covariance_file_name'] = self.covarianceFileName
        self.innovationFileName = 'innovation_' + self.options['filtering_parameters']['output_files_suffix'] + '.txt'
        self.options['visual_parameters']['innovation_file_name'] = self.innovationFileName
        
        self.informationFileName = self.fullFolderName + '/daconfig.yml'

        with open(self.informationFileName, 'w') as stream:
            try:
                yaml.dump(self.options, stream, default_flow_style=None)

            except yaml.YAMLError as exc:
                print(exc)
                return

        self.createGraph(self.rootNode)