Beispiel #1
0
    eta = float(json_variables['eta'])  # volume fraction
    sigma_r = float(json_variables['sigma_r'])  # interface roughness
    folder = json_variables['_base_directory']  # output folder dir
    N_poly_integral = 9  # number of steps in polydispersity integral

    ## read checkboxes and related input
    # the Json input for checkboxes only exists if boxes are checked
    # therefore, I use try-except to import
    try:
        dummy = json_variables['exclude_overlap']
        exclude_overlap = True
    except:
        exclude_overlap = False

    ## setup  messaging in GUI
    message = genapp(json_variables)

    ## read model parameters
    Number_of_models = 5
    model, a, b, c, p, x, y, z = [], [], [], [], [], [], [], []
    for i in range(Number_of_models):
        number = i + 1
        model_name = 'model%d' % number
        a_name = 'a%d' % number
        b_name = 'b%d' % number
        c_name = 'c%d' % number
        p_name = 'p%d' % number
        x_name = 'x%d' % number
        y_name = 'y%d' % number
        z_name = 'z%d' % number
        model.append(json_variables[model_name])
Beispiel #2
0
                tmp = '%s_pos_%d' % (model, i + 1)
                pos = json_variables[tmp]
                FIT += 1
            except:
                pass
        except:
            pass

        # write model non-specific Json input to inputfile
        f.write('%f %f %d\n' % (mean, sigma, FIT))

    ## close input file
    f.close()

    ## messaging
    d = genapp(json_variables)

    ## run bayesfit
    d.udpmessage({"_textarea": "run bayesfit\n"})

    def execute(command, f):
        popen = subprocess.Popen(command, stdout=subprocess.PIPE, bufsize=1)
        lines_iterator = iter(popen.stdout.readline, b"")
        while popen.poll() is None:
            for line in lines_iterator:
                nline = line.rstrip()
                nline_latin = nline.decode('latin')
                out_line = '%s\n' % nline_latin
                #print(nline.decode("latin"), end = "\r\n",flush =True) # yield line
                d.udpmessage({"_textarea": out_line})
                f.write(out_line)