Exemplo n.º 1
0
    def ppStitch(self):
        self.csvList_LW.clear()
        
        for i in range(len(self.simplelist)):
            if self.simplelist[i].name=="Stitch":
                del self.simplelist[i]
                
        for i in range(len(self.simplelist)):
            self.csvList_LW.addItem(self.simplelist[i].name)
                
        self.ppPopulateStitchList()
        csvcombined=self.stitchlist[0]
        
        for i in range(len(self.stitchlist)):
        	try:
        		csvcombined=csvcombined.combine_first(self.stitchlist[i+1])
        	except IndexError:
        		break

        csvcombined.to_csv("%s\stitch.csv" % self.path,index_label=False,sep=',')    
        
        stitchPPinstance= postProcessing.postProcessing("Stitch","%s\stitch.csv" % self.path,
                                                        self.pp_TV,self.ppFileLoaded_L,
                                                        self.plot_L,
                                                        '%s\Calibration_files\stitch.cal' % self.path,
                                                        1,
                                                        self.framerate,self.path)
        self.simplelist.append(stitchPPinstance)
        self.csvList_LW.addItem( self.simplelist[-1].name)
        self.simplelist[-1].show(0)
Exemplo n.º 2
0
    def pp_openCSV(self):
        self.ppnamelist=[]
        self.ppfileobj=[]
        self.calfile=[]
        
        self.ppfileobj=QFileDialog.getOpenFileNames(self,"CSV files", self.path, filter="Text Files (*.csv)")
       
        for i in range(len(self.ppfileobj)):
            self.pppath, self.ppfilename=os.path.split(os.path.abspath(self.ppfileobj[i]))
            slicestr=self.ppfilename[0:6]
            self.cameraid=self.ppfilename[0:2]
            self.ppnamelist.append(slicestr)
            self.csvList_LW.addItem(self.ppnamelist[i])

            for name in glob("%s\Calibration_files\*" % self.path):
                a="%s\Calibration_files\\%s.cal" % (self.path,self.cameraid)
                if name == a:
                    self.calfile.append(name)
        
        self.newlist=[postProcessing.postProcessing(self.ppnamelist[i],self.ppfileobj[i],self.pp_TV,self.ppFileLoaded_L,self.plot_L,self.calfile[i],0,self.framerate,self.path) for i in range(len(self.ppnamelist))]
       
        if len(self.simplelist) == 0:
            self.simplelist=self.newlist
        else:
            self.simplelist=self.simplelist+self.newlist
Exemplo n.º 3
0
    def predictDataWithOnlyPostScript(self, pmmlstoragepointer, filpath,
                                      extenFile):
        import importlib.util
        print('Step 11.1')
        global PMMLMODELSTORAGE
        pointerObj = PMMLMODELSTORAGE[pmmlstoragepointer]
        #####################>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>###############

        codePart2 = pointerObj['postProcessScript']
        fnaMe2 = './trainModel/testPostprocessing.py'
        with open(fnaMe2, 'w') as k:
            k.write(codePart2)
        print('Code File written POST Process')
        spec2 = importlib.util.spec_from_file_location('postProcessing',
                                                       fnaMe2)
        postProcessing = spec2.loader.load_module()

        print('Step 11.2')
        #####################>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>###############
        from postProcessing import postProcessing
        from string import ascii_uppercase
        from random import choice

        print('Step 11.5')

        if extenFile in ['.jpg', '.JPG', '.png', '.PNG']:
            target_path2 = './logs/' + ''.join(
                choice(ascii_uppercase) for i in range(12)) + '/'
            target_path = target_path2 + '/test/'
            self.checkCreatePath(target_path2)
            self.checkCreatePath(target_path)
            print('Step 11.6')
            targetResult = self.predictImagedata(pmmlstoragepointer, filpath)

            print('Step 11.9')

            target_path3 = './logs/' + ''.join(
                choice(ascii_uppercase) for i in range(12)) + '/'
            self.checkCreatePath(target_path3)

            print('Step 11.11')
            outPutAfterPostProcess = postProcessing(targetResult)
            print('Step 11.12')

        elif scriptOutput == 'DATA':
            print('Use case need to be discussed')

        try:
            os.remove(fnaMe2)
        except:
            pass
        return outPutAfterPostProcess
Exemplo n.º 4
0
    def main(self):
        if self.target <= 2:
            target = 10
        else:
            target = self.target
        """
        主函数
        """
        '''
        parser = argparse.ArgumentParser(description="***** this is auto-generate-expression *****")
        parser.add_argument("-n", metavar = "--number", dest = "expnum_arg", help = "Generate a given number of expressions" )
        parser.add_argument("-r", metavar = "--range", dest = "range_arg", help = "Specify the range of operands")
        parser.add_argument("-e", metavar = "--exercise file", dest = "exercise_arg", help = "Given four arithmetic problem files")
        parser.add_argument("-a", metavar = "--answer file", dest = "answer_arg", help = "Given four arithmetic problem answer files")
        args = parser.parse_args()
        '''

        try:
            with open(self.expFile, "w+", encoding="utf-8") as f:
                f.truncate()
                f.close()
            with open(self.answerFile, "w+", encoding="utf-8") as f:
                f.truncate()
                f.close()
            print(("%s" + "Clear existing expressions....done." + "%s") %
                  (white, end))
        except:
            print(("%s" + "No need to clear existing expressions." + "%s") %
                  (white, end))

        #判断生成的表达式的数目
        if self.expNum:
            #表达式的范围
            if self.target:
                config = Config(exp_num=int(self.expNum),
                                num_range=int(target))
            else:
                config = Config(exp_num=int(self.expNum))
            print(("%s" + "Arithmetic expression replacing literal (" +
                   str(self.target) + ") is being generated." + "%s") %
                  (green, end))
            generator = Generator()
            res_list = generator.generate(config)
            generator.normalize_exp(res_list)
            expression_result(res_list)
            print(("%s" + 'Generation is complete.' + "%s") % (green, end))
        #后期处理表达式的值
        #print(args.exercise_arg, args.answer_arg)
        pp = postProcessing(self.expFile, self.answerFile, self.target)
        return pp.run()
Exemplo n.º 5
0
print '\n', \
    'Welcome to:  softGNSS\n\n', \
    'An open source GNSS SDR software project initiated by:\n\n', \
    '              Danish GPS Center/Aalborg University\n\n', \
    'The code was improved by GNSS Laboratory/University of Colorado.\n\n', \
    'The software receiver softGNSS comes with ABSOLUTELY NO WARRANTY;\n', \
    'for details please read license details in the file license.txt. This\n', \
    'is free software, and  you  are  welcome  to  redistribute  it under\n', \
    'the terms described in the license.\n\n', \
    '                   -------------------------------\n\n'
## Initialize constants, settings =========================================
settings = initSettings.Settings()

## Generate plot of raw data and ask if ready to start processing =========
try:
    print 'Probing data "%s"...' % settings.fileName
    # probeData.probeData(settings)
    # probeData.probeData('/Users/yangsu/Downloads/GNSS_signal_records/GPS_and_GIOVE_A-NN-fs16_3676-if4_1304.bin', settings)
finally:
    pass

print '  Raw IF data plotted '
print '  (run setSettings or change settings in "initSettings.m" to reconfigure)'
print ' '
gnssStart = True
# gnssStart = int(raw_input('Enter "1" to initiate GNSS processing or "0" to exit : ').strip())

if gnssStart:
    print ' '
    postProcessing.postProcessing(settings)
Exemplo n.º 6
0
    def calculateHouse(self):
        print('calculating..')

        #getNumerical Data
        try:
            self.getNumerical()
        except KeyError:
            print(
                "Something went wrong with getting the numerical data, modify your data and try again"
            )

        #get the Categorical Data
        try:
            self.getCategorical()
        except KeyError:
            print(
                "Something went wrong with getting the categorical data, modify your data and try again"
            )

        self.df.rename({"stFlrSF": "1stFlrSF"}, axis='columns', inplace=True)
        #write to file
        self.df.to_csv('user_input.csv', sep=',', index=False, header=True)
        #
        #map the user input to a format that our training engine can process in order to predict
        try:
            postProcessing.postProcessing()
        except KeyError:
            print(
                "Something went wrong while converting your user input, modify your data and try again"
            )

        #predicion of output from user input
        sample = pd.read_csv('user_input.csv')
        try:
            (price, imputedSample) = predictionFramework.run(sample)
        except ValueError:
            print(
                "Some field from the alternative is missing, modify your data and try again"
            )
            price = "Not available"

        #compare the input price with the expected price ValueError
        try:
            self.comparePrices(price)
        except ValueError:
            print(
                "It appears you have found an edge of our model. The expected price is too high"
            )

        #search alternatives
        try:
            similar.run('processed_user_input.csv')
        except KeyError:
            print(
                "Sorry, we did not find any good alternatives, modify your data and try again"
            )

        #extract alternatives
        try:
            postProcessing.convertAlternatives()
        except KeyError:
            print(
                "We could not convert the alternatives file we found back to user input.Maybe have a look at the 'test_similarhouses.csv' or modify your data and try again"
            )

        #converting back to human readable code and putting it into the GUI
        try:
            postProcessing.postProcessing2()
        except KeyError:
            print(
                "We could not convert the alternatives file we found back to user input.Maybe have a look at the 'finished_alternative.csv' or modify your data and try again"
            )

        self.setAlternatives()
Exemplo n.º 7
0
    def predictDataWithPostScript(self, pmmlstoragepointer, filpath,
                                  scriptOutput):

        print('Step 1.1')
        global PMMLMODELSTORAGE
        pointerObj = PMMLMODELSTORAGE[pmmlstoragepointer]
        #####################>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>###############
        codePart = pointerObj['preProcessScript']
        print('Step 1.2')
        fnaMe = './trainModel/testPreprocessing.py'
        with open(fnaMe, 'w') as k:
            k.write(codePart)
        print('Code File written Pre Process')
        import importlib.util
        spec = importlib.util.spec_from_file_location('preProcessing', fnaMe)
        preProcessing = spec.loader.load_module()

        print('Step 1.3')

        #####################>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>###############

        codePart2 = pointerObj['postProcessScript']
        fnaMe2 = './trainModel/testPostprocessing.py'
        with open(fnaMe2, 'w') as k:
            k.write(codePart2)
        print('Code File written POST Process')
        spec2 = importlib.util.spec_from_file_location('postProcessing',
                                                       fnaMe2)
        postProcessing = spec2.loader.load_module()

        print('Step 1.4')

        #####################>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>###############
        from preProcessing import preProcessing
        from postProcessing import postProcessing
        from string import ascii_uppercase
        from random import choice

        print('Step 1.5')

        if scriptOutput == 'IMAGE':
            target_path2 = './logs/' + ''.join(
                choice(ascii_uppercase) for i in range(12)) + '/'
            target_path = target_path2 + '/test/'
            self.checkCreatePath(target_path2)
            self.checkCreatePath(target_path)
            print('Step 1.6')
            preProcessing(filpath, target_path)
            print('Step 1.7')
            print(' Image chunk saving done')

            print('Step 1.8')
            listOfFiles = os.listdir(target_path)
            if len(listOfFiles) > 1000000:
                tempRunMemory = self.predictFolderDataInBatch(
                    pmmlstoragepointer, target_path2, len(listOfFiles))
                tempRunMemory['inTask'] = True
                return tempRunMemory
            else:
                targetResult = self.predictFolderdata(pmmlstoragepointer,
                                                      target_path2)

            print('Step 1.9')

            # outputOfPreScript=open(targetResult,'r').read()
            # outputOfPreScript=json.loads(outputOfPreScript)

            print('Step 1.10')

            target_path3 = './logs/' + ''.join(
                choice(ascii_uppercase) for i in range(12)) + '/'
            self.checkCreatePath(target_path3)

            print('Step 1.11')
            outPutAfterPostProcess = postProcessing(filpath, targetResult,
                                                    target_path3)
            print('Step 1.12')

        elif scriptOutput == 'DATA':
            print('Use case need to be discussed')

        try:
            os.remove(fnaMe2)
        except:
            pass
        try:
            os.remove(fnaMe)
        except:
            pass
        return outPutAfterPostProcess