Ejemplo n.º 1
0
    def _testDetectEstimAllModels(self):
        from pyhrf.ui.jde import DEFAULT_CFG_FILE
        cfg_file = op.join(self.tmp_dir, DEFAULT_CFG_FILE)

        errors = []
        for modelLabel in availableModels.keys():
            logger.info('Trying model : %s', modelLabel)
            cmd = 'pyhrf_jde_buildcfg -l %s -n 3' % modelLabel
            if os.system(cmd) != 0:
                errors.append('"' + cmd + '" did not execute correctly')
                continue
            if not os.path.exists(cfg_file):
                errors.append('Model %s - from cmd "%s" -> default cfg file'
                              'was not created' % (modelLabel, cmd))
                continue

            self.setDummyInputData(cfg_file)
            self.makeQuietOutputs(cfg_file)
            cmd = 'pyhrf_jde_estim -s -c %s' % cfg_file
            if os.system(cmd) != 0:
                errors.append('Model %s - "%s" did not execute correctly' %
                              (modelLabel, cmd))
            os.remove(cfg_file)
            logger.info('Model %s OK', modelLabel)

        if errors != []:
            logger.info('Model %s NOT ok', modelLabel)
            e = Exception(string.join([''] + errors, '\n'))
            raise e
Ejemplo n.º 2
0
    def _testDetectEstimAllModels(self):
        from pyhrf.ui.jde import DEFAULT_CFG_FILE
        cfg_file = op.join(self.tmp_dir, DEFAULT_CFG_FILE)

        errors = []
        for modelLabel in availableModels.keys():
            logger.info('Trying model : %s', modelLabel)
            cmd = 'pyhrf_jde_buildcfg -l %s -n 3' % modelLabel
            if os.system(cmd) != 0:
                errors.append('"' + cmd + '" did not execute correctly')
                continue
            if not os.path.exists(cfg_file):
                errors.append('Model %s - from cmd "%s" -> default cfg file'
                              'was not created' % (modelLabel, cmd))
                continue

            self.setDummyInputData(cfg_file)
            self.makeQuietOutputs(cfg_file)
            cmd = 'pyhrf_jde_estim -s -c %s' % cfg_file
            if os.system(cmd) != 0:
                errors.append('Model %s - "%s" did not execute correctly'
                              % (modelLabel, cmd))
            os.remove(cfg_file)
            logger.info('Model %s OK', modelLabel)

        if errors != []:
            logger.info('Model %s NOT ok', modelLabel)
            e = Exception(string.join([''] + errors, '\n'))
            raise e
Ejemplo n.º 3
0
    def _testDetectEstimAllModels(self):
        from pyhrf.ui.jde import DEFAULT_CFG_FILE

        # print 'testing all models ...'
        cfg_file = op.join(self.tmp_dir, DEFAULT_CFG_FILE)

        errors = []
        for modelLabel in availableModels.keys():
            pyhrf.verbose(1, "Trying model :", modelLabel)
            cmd = "pyhrf_jde_buildcfg -l %s -n 3" % modelLabel
            if os.system(cmd) != 0:
                errors.append('"' + cmd + '" did not execute correctly')
                continue
            if not os.path.exists(cfg_file):
                errors.append('Model %s - from cmd "%s" -> default cfg file' "was not created" % (modelLabel, cmd))
                continue

            self.setDummyInputData(cfg_file)
            # if pyhrf.__usemode__ == 'enduser':
            #     self.makeQuickJDE(cfg_file)
            self.makeQuietOutputs(cfg_file)
            cmd = "pyhrf_jde_estim -s -c %s" % cfg_file
            if os.system(cmd) != 0:
                errors.append('Model %s - "%s" did not execute correctly' % (modelLabel, cmd))
            # if not os.path.exists(DEFAULT_DUMP_FILE):
            #     os.remove(cfg_file)
            #     errors.append('Model %s - from cmd %s -> %s was not created'\
            #                   %(modelLabel, cmd, DEFAULT_DUMP_FILE))
            #     continue
            # else:
            #     r = self.checkAnalyserResults(DEFAULT_DUMP_FILE)
            #     if r is not None:
            #         err = 'Model %s - from "%s" \n'\
            #               ' -> error within treatment:\n%s'\
            #               %(modelLabel, cmd, r)
            #         errors.append(modelLabel+' ->\n'+r)
            #         os.remove(DEFAULT_DUMP_FILE)
            #         os.remove(cfg_file)
            #         continue
            # os.remove(DEFAULT_DUMP_FILE)
            os.remove(cfg_file)
            pyhrf.verbose(1, "Model %s OK" % modelLabel)

        if errors != []:
            pyhrf.verbose(1, "Model %s NOT ok" % modelLabel)
            e = Exception(string.join([""] + errors, "\n"))
            raise e