Esempio n. 1
0
    def fit_properties (self):
        dlg = Page(self,
            ('Termination Conditions', 
#                ['Tolerance (xsqr)', 
#                 'Tolerance (param)', 
                 ['#Max Iterations']),
            ('Weighting', 
                ['|Weighting method|No Weighting|Statistical|Logarithmic Fit']),
            ('Results', 
                 ['Worksheet', 
                  'Extra properties']))

        dlg['Extra properties'] = ','.join(self.extra_properties)
        dlg['Worksheet'] = self.resultsws
        dlg['Max Iterations']   = self.maxiter
        dlg['Weighting method'] = self.wmethod

        dlg.run()

        self.extra_properties = [st for st in
                                      [s.strip() for s in dlg['Extra properties'].split(',')]
                                 if st != '']
        self.maxiter = dlg['Max Iterations']
        self.wmethod = dlg['Weighting method']
        self.resultsws = dlg['Worksheet']
Esempio n. 2
0
    def fit_properties(self):
        dlg = Page(
            self,
            (
                'Termination Conditions',
                #                ['Tolerance (xsqr)',
                #                 'Tolerance (param)',
                ['#Max Iterations']),
            ('Weighting',
             ['|Weighting method|No Weighting|Statistical|Logarithmic Fit']),
            ('Results', ['Worksheet', 'Extra properties']))

        dlg['Extra properties'] = ','.join(self.extra_properties)
        dlg['Worksheet'] = self.resultsws
        dlg['Max Iterations'] = self.maxiter
        dlg['Weighting method'] = self.wmethod

        dlg.run()

        self.extra_properties = [
            st
            for st in [s.strip() for s in dlg['Extra properties'].split(',')]
            if st != ''
        ]
        self.maxiter = dlg['Max Iterations']
        self.wmethod = dlg['Weighting method']
        self.resultsws = dlg['Worksheet']
Esempio n. 3
0
 def do(self):
     dir = QFileDialog.getExistingDirectory("/home", project.mainwin, "get existing directory"
                 "Choose a directory")
     worksheet_names = ['e1(f)', 'e2(f)', 'e1(T)', 'e2(T)', 'e2deriv(f)', 'e2deriv(T)']
     p = Page(None,
              ('Create worksheets',
                 ['?'+n for n in worksheet_names]))
     for n in worksheet_names:
         p[n] = True
     p.run()
     
     process_windeta_dir(str(dir), [n for n in worksheet_names if p[n] is True])
Esempio n. 4
0
    def do(self):
        dir = QFileDialog.getExistingDirectory(
            "/home", project.mainwin, "get existing directory"
            "Choose a directory")
        worksheet_names = [
            'e1(f)', 'e2(f)', 'e1(T)', 'e2(T)', 'e2deriv(f)', 'e2deriv(T)'
        ]
        p = Page(None,
                 ('Create worksheets', ['?' + n for n in worksheet_names]))
        for n in worksheet_names:
            p[n] = True
        p.run()

        process_windeta_dir(str(dir),
                            [n for n in worksheet_names if p[n] is True])
Esempio n. 5
0
def process_windeta_dir(dir, worksheet_names):
    project.lock_undo()
    files = [dir + '/' + fil for fil in os.listdir(dir) if os.path.splitext(fil)[1] in ('.txt', '.TXT')]
    wsheets = []

    project.mainwin.statusBar().message ("Reading ASCII files")
    project.mainwin.progressbar.show()
    project.main_dict['app'].processEvents()
    project.mainwin.progressbar.setTotalSteps(len(files))

    for prog, f in enumerate(files):
        w = project.new_worksheet()
        w.import_ascii(f)
        name = windeta_wstemp(w, 1)
        if name is None:
            name = windeta_wstemp(w, 2)
            if name is None:
                p = Page(None, ('Could not determine temperature\n for ascii file '+f, ['Temperature']))
                p.run()
                try:
                    name = float(p['Temperature'])
                except ValueError:
                    continue
        name = temp_to_wsname(name)
        while name in [s.name for s in wsheets]:
            name += 'a'
        w.name = name
        wsheets.append(w)
        if prog % 5 == 0:
            project.mainwin.progressbar.setProgress(prog+1)
    e1_f = project.new_worksheet('_e1_f')
    e2_f = project.new_worksheet('_e2_f')
    e1_f.freq = e2_f.freq = None

    new_wsheets = [(windeta_wstemp(w), w) for w in wsheets]
    new_wsheets.sort()
    wsheets = [w[1] for w in new_wsheets]

    project.mainwin.statusBar().message ("Creating e1_f and e2_f")
    project.mainwin.progressbar.setTotalSteps(len(files))

    for prog, w in enumerate(wsheets):
        if len(w[0]) > len(e1_f.freq):
            e1_f.freq = w[0]
            e2_f.freq = w[0]
        e1_f[w.name] = w[1]
        e2_f[w.name] = w[2]
        project.remove(w)
        if prog % 5 == 0:
            project.mainwin.progressbar.setProgress(prog+1)

    if 'e1(T)' in worksheet_names or 'e2(T)' in worksheet_names:
        make_isochronal(e1_f, e2_f)
    	if 'e1(T)' in worksheet_names: project.w._e1_T.name = 'e1_T'
    	else: project.remove(project.w._e1_T)
    	if 'e2(T)' in worksheet_names: project.w._e2_T.name = 'e2_T'
    	else: project.remove(project.w._e2_T)
    if 'e2deriv(f)' in worksheet_names:
        make_e2deriv(e1_f)

    if 'e1(f)' in worksheet_names: project.w._e1_f.name = 'e1_f'
    else: project.remove(project.w._e1_f)
    if 'e2(f)' in worksheet_names: project.w._e2_f.name = 'e2_f'
    else: project.remove(project.w._e2_f)

    project.unlock_undo()
    project.mainwin.progressbar.hide()
Esempio n. 6
0
def process_windeta_dir(dir, worksheet_names):
    project.lock_undo()
    files = [
        dir + '/' + fil for fil in os.listdir(dir)
        if os.path.splitext(fil)[1] in ('.txt', '.TXT')
    ]
    wsheets = []

    project.mainwin.statusBar().message("Reading ASCII files")
    project.mainwin.progressbar.show()
    project.main_dict['app'].processEvents()
    project.mainwin.progressbar.setTotalSteps(len(files))

    for prog, f in enumerate(files):
        w = project.new_worksheet()
        w.import_ascii(f)
        name = windeta_wstemp(w, 1)
        if name is None:
            name = windeta_wstemp(w, 2)
            if name is None:
                p = Page(None,
                         ('Could not determine temperature\n for ascii file ' +
                          f, ['Temperature']))
                p.run()
                try:
                    name = float(p['Temperature'])
                except ValueError:
                    continue
        name = temp_to_wsname(name)
        while name in [s.name for s in wsheets]:
            name += 'a'
        w.name = name
        wsheets.append(w)
        if prog % 5 == 0:
            project.mainwin.progressbar.setProgress(prog + 1)
    e1_f = project.new_worksheet('_e1_f')
    e2_f = project.new_worksheet('_e2_f')
    e1_f.freq = e2_f.freq = None

    new_wsheets = [(windeta_wstemp(w), w) for w in wsheets]
    new_wsheets.sort()
    wsheets = [w[1] for w in new_wsheets]

    project.mainwin.statusBar().message("Creating e1_f and e2_f")
    project.mainwin.progressbar.setTotalSteps(len(files))

    for prog, w in enumerate(wsheets):
        if len(w[0]) > len(e1_f.freq):
            e1_f.freq = w[0]
            e2_f.freq = w[0]
        e1_f[w.name] = w[1]
        e2_f[w.name] = w[2]
        project.remove(w)
        if prog % 5 == 0:
            project.mainwin.progressbar.setProgress(prog + 1)

    if 'e1(T)' in worksheet_names or 'e2(T)' in worksheet_names:
        make_isochronal(e1_f, e2_f)
        if 'e1(T)' in worksheet_names: project.w._e1_T.name = 'e1_T'
        else: project.remove(project.w._e1_T)
        if 'e2(T)' in worksheet_names: project.w._e2_T.name = 'e2_T'
        else: project.remove(project.w._e2_T)
    if 'e2deriv(f)' in worksheet_names:
        make_e2deriv(e1_f)

    if 'e1(f)' in worksheet_names: project.w._e1_f.name = 'e1_f'
    else: project.remove(project.w._e1_f)
    if 'e2(f)' in worksheet_names: project.w._e2_f.name = 'e2_f'
    else: project.remove(project.w._e2_f)

    project.unlock_undo()
    project.mainwin.progressbar.hide()