def on_okButton(self, event):
        """
        grab user input values, format them, and run huji_magic.py with the appropriate flags
        """
        os.chdir(self.WD)
        options = {}
        HUJI_file = self.bSizer0.return_value()
        if not HUJI_file:
            pw.simple_warning("You must select a HUJI format file")
            return False
        options['magfile'] = HUJI_file
        dat_file = self.bSizer0A.return_value()
        if os.path.isfile(dat_file): options['datafile'] = dat_file
        else: dat_file=""
        magicoutfile=os.path.split(HUJI_file)[1]+".magic"
        outfile=os.path.join(self.WD, magicoutfile)
        options['meas_file'] = outfile
        magicoutfile=os.path.split(HUJI_file)[1]+"_specimens.txt"
        spec_outfile=os.path.join(self.WD, magicoutfile)
        options['spec_file'] = spec_outfile
        magicoutfile=os.path.split(HUJI_file)[1]+"_samples.txt"
        samp_outfile=os.path.join(self.WD, magicoutfile)
        options['samp_file'] = samp_outfile
        magicoutfile=os.path.split(HUJI_file)[1]+"_sites.txt"
        site_outfile=os.path.join(self.WD, magicoutfile)
        options['site_file'] = site_outfile
        magicoutfile=os.path.split(HUJI_file)[1]+"_locations.txt"
        loc_outfile=os.path.join(self.WD, magicoutfile)
        options['loc_file'] = loc_outfile
        user = self.bSizer1.return_value()
        options['user'] = user
        if user:
            user = '-usr ' + user
        experiment_type = self.bSizer2.return_value()
        options['codelist'] = experiment_type
        if not experiment_type:
            pw.simple_warning("You must select an experiment type")
            return False
        cooling_rate = self.cooling_rate.GetValue() or 0
        if cooling_rate:
            experiment_type = experiment_type + " " + cooling_rate
        lab_field = self.bSizer3.return_value()
        if not lab_field:
            lab_field = "0 0 0"
        lab_field_list = lab_field.split()
        options['labfield'] = lab_field_list[0]
        options['phi'] = lab_field_list[1]
        options['theta'] = lab_field_list[2]
        lab_field = '-dc ' + lab_field
        spc = self.bSizer4.return_value()
        options['specnum'] = spc or 0
        if not spc:
            spc = '-spc 0'
        else:
            spc = '-spc ' + spc
        ncn = self.bSizer5.return_value()
        options['samp_con'] = ncn
        loc_name = self.bSizer6.return_value()
        options['location'] = loc_name
        if loc_name:
            loc_name = '-loc ' + loc_name
        #peak_AF = self.bSizer7.return_value()
        #options['peakfield'] = peak_AF

        replicate = self.bSizer8.return_value()
        if replicate:
            options['noave'] = 0
            replicate = ''
        else:
            options['noave'] = 1
            replicate = '-A'

        COMMAND = "huji_magic_new.py -f {} -fd {} -F {} -Fsp {} -Fsa {} -Fsi {} -Flo {} {} -LP {} {} -ncn {} {} {} {}".format(HUJI_file, dat_file, outfile, spec_outfile, samp_outfile, site_outfile, loc_outfile, user, experiment_type, loc_name, ncn, lab_field, spc, replicate)
        program_ran, error_message = convert.huji(**options)
        if program_ran:
            pw.close_window(self, COMMAND, outfile)
        else:
            pw.simple_warning(error_message)
grab user input values, format them, and run huji_magic.py with the appropriate flags