Ejemplo n.º 1
0
long fit_window::on_cmd_run_fit(FXObject*, FXSelector, void* ptr) {
  reg_check_point(this);

  struct fit_parameters* fps = fit_parameters_new();

  for (unsigned j = 0; j < m_parameters.size(); j++) {
    if (m_parameters[j].selected) {
      fit_parameters_add (fps, &m_parameters[j].fp);
    }
  }

  if (fps->number > 0) {

    m_fit->run(fps);

    for (unsigned k = 0; k < m_parameters.size(); k++) {
      param_info& p = m_parameters[k];
      FXString s = FXStringFormat("%g", m_fit->get_parameter_value(k));
      p.text_field->setText(s);
      p.is_dirty = true;
    }

    m_canvas->update_limits();
  }

  fit_parameters_free(fps);

  return 1;
}
Ejemplo n.º 2
0
long recipe_window::on_cmd_add_constr(FXObject *, FXSelector, void *)
{
    const fit_param_t *fp = selected_parameter();
    int i = fit_parameters_find(recipe->ms_setup->cparameters, fp);
    if (i < 0) {
        fit_parameters_add(recipe->ms_setup->cparameters, fp);
        cparams_listbox->appendItem(format_fit_parameter(fp));
    }
    return 1;
}
Ejemplo n.º 3
0
void
recipe_window::set_fit_parameter(const fit_param_t *fp, const seed_t *value)
{
    int i = fit_parameters_find(recipe->parameters, fp);
    if (i >= 0) {
        recipe->seeds_list->values[i] = *value;
        fit_list_update_parameter(i, fp, value);
    } else {
        fit_parameters_add(recipe->parameters, fp);
        seed_list_add(recipe->seeds_list, value);
        fit_list_append_parameter(fp, value);
    }
}