Example #1
0
 /**
  * Declare the active parameters for the function
  */
 void Voigt::declareParameters()
 {
   declareParameter(LORENTZ_AMP, 0.0, "Value of the Lorentzian amplitude");
   declareParameter(LORENTZ_POS, 0.0, "Position of the Lorentzian peak");
   declareParameter(LORENTZ_FWHM, 0.0, "Value of the full-width half-maximum for the Lorentzian");
   declareParameter(GAUSSIAN_FWHM, 0.0, "Value of the full-width half-maximum for the Gaussian");
 }
 void GaussianComptonProfile::declareParameters()
 {
   // DO NOT REORDER WITHOUT CHANGING THE GETPARAMETER calls
   //
   declareParameter(WIDTH_PARAM, 1.0, "Gaussian width parameter");
   declareParameter(AMP_PARAM, 1.0, "Gaussian intensity parameter");
 }
Example #3
0
void CgDeclParms(               // DEFINE ARGS FOR CURRENT FN IN CORRECT ORDER
    FN_CTL *fctl,               // - current function control pointer
    SCOPE scope )               // - argument scope
{
    SYMBOL curr;
    SYMBOL stop;
    SYMBOL *psym;               // - addr[ parameter symbol ]
    TYPE fn_type;
    auto VSTK_CTL sym_stack;
    SYMBOL ret_sym;
    NAME ret_name;

    fn_type = FunctionDeclarationType( fctl->func->sym_type );
    VstkOpen( &sym_stack, sizeof( SYMBOL ), 16 );
    stop = ScopeOrderedStart( scope );
    ret_name = CppSpecialName( SPECIAL_RETURN_VALUE );
    ret_sym = NULL;
    curr = NULL;
    for(;;) {
        curr = ScopeOrderedNext( stop, curr );
        if( curr == NULL ) break;
        if( ( curr->name != NULL ) && ( ret_name == curr->name->name ) ) {
            ret_sym = curr;
        } else {
            psym = VstkPush( &sym_stack );
            *psym = curr;
        }
    }
    IbpDefineParms();
    declareParameter( fctl->this_sym );
    declareParameter( fctl->cdtor_sym );
    declareParameter( ret_sym );
    switch( PcCallImpl( fn_type ) ) {
      case CALL_IMPL_REV_CPP :
      case CALL_IMPL_REV_C :
        for(;;) {
            psym = VstkPop( &sym_stack );
            if( psym == NULL ) break;
            declareParameter( *psym );
        }
        break;
      case CALL_IMPL_CPP :
      case CALL_IMPL_C :
      case CALL_IMPL_ELL_CPP :
      case CALL_IMPL_ELL_C :
      { unsigned index;             // - parameter index
        unsigned max_parms;         // - # parameters
        SYMBOL *psym1;              // - addr[ parameter symbol ]
        max_parms = VstkDimension( &sym_stack );
        for( index = 0; index < max_parms; ++index ) {
            psym1 = VstkIndex( &sym_stack, index );
            declareParameter( *psym1 );
        }
      } break;
    }
    VstkClose( &sym_stack );
    CGLastParm();
}
 BaseMultiPos::
 BaseMultiPos(std::string const & name)
   : Skill(name),
     ee_task_(0),
     ee_pos_(Vector::Zero(3)),
     threshold_(-1),
     vel_threshold_(-1),
     cur_row_(0),
     forward_(true)
   {
     declareSlot("eepos", &ee_task_);
     declareParameter("eepos", &ee_pos_);
     declareParameter("threshold", &threshold_);
     declareParameter("vel_threshold", &vel_threshold_);
 }
void FunctionChangesNParams::iterationFinished() {
  auto np = nParams();
  if (m_canChange && np < m_maxNParams) {
    declareParameter("A" + std::to_string(np), 0.0);
    throw Mantid::Kernel::Exception::FitSizeWarning(np, nParams());
  }
  m_canChange = false;
}
ParameterReflection::ParameterReflection(std::string const& type_name,
    std::string const& instance_name) :
    typeName(type_name),
    instanceName(instance_name),
    useDefaultBindings(true)
{
    declareParameter("useDefaultBindings", &useDefaultBindings);
}
Example #7
0
/**
 * Reset fitting parameters after changes to some attributes.
 */
void BSpline::resetParameters() {
    if (nParams() > 0) {
        clearAllParameters();
    }
    size_t np = gsl_bspline_ncoeffs(m_bsplineWorkspace.get());
    for (size_t i = 0; i < np; ++i) {
        std::string pname = "A" + boost::lexical_cast<std::string>(i);
        declareParameter(pname);
    }
}
Example #8
0
void IkedaCarpenterPV::init() {
  declareParameter("I", 0.0, "The integrated intensity of the peak. I.e. "
                             "approximately equal to HWHM times height of "
                             "peak");
  declareParameter("Alpha0", 1.6, "Used to model fast decay constant");
  declareParameter("Alpha1", 1.5, "Used to model fast decay constant");
  declareParameter("Beta0", 31.9, "Inverse of slow decay constant");
  declareParameter("Kappa", 46.0, "Controls contribution of slow decay term");
  declareParameter("SigmaSquared", 1.0,
                   "standard deviation squared (Voigt Guassian broadening)");
  declareParameter("Gamma", 1.0, "Voigt Lorentzian broadening");
  declareParameter("X0", 0.0, "Peak position");
}
 ClassicTaskPostureController::
 ClassicTaskPostureController(std::string const & name)
   : Controller(name)
 {
   declareParameter("jpos", &jpos_);
   declareParameter("jvel", &jvel_);
   declareParameter("gamma", &gamma_);
   declareParameter("fstar", &fstar_);
   declareParameter("lambda", &lambda_);
   declareParameter("jbar", &jbar_);
   declareParameter("nullspace", &nullspace_);
 }
Example #10
0
 GestureSkill::
 GestureSkill(std::string const & name)
   : Skill(name),
     state_(STATE_OP_),
     eepos_task_(0),
     eeori_task_(0),
     posture_task_(0),
     joint_task_(0),
     eepos_goal_(0),
     eeori_goal_x_(0),
     eeori_goal_y_(0),
     eeori_goal_z_(0),
     posture_goal_(0),
     joint_goal_(0),
     eepos_(Vector::Zero(3)),
     eeori_x_(Vector::Zero(3)),
     eeori_y_(Vector::Zero(3)),
     eeori_z_(Vector::Zero(3)),
     posture_(Vector::Zero(7)),
     joint_pos_(Vector::Zero(7)),
     threshold_(-1),
     cur_row_(0),
     hold_count_(Vector::Zero(1)),
     count_(0),
     vel_threshold_(-1)
   {
   declareSlot("eepos", &eepos_task_);
   declareSlot("eeori", &eeori_task_);
   declareSlot("posture", &posture_task_);
   declareSlot("joint", &joint_task_);
   declareParameter("eepos", &eepos_);
   declareParameter("eeori_x", &eeori_x_);
   declareParameter("eeori_y", &eeori_y_);
   declareParameter("eeori_z", &eeori_z_);
   declareParameter("posture", &posture_);
   declareParameter("joint_positions", &joint_pos_);
   declareParameter("threshold", &threshold_);
   declareParameter("hold_count", &hold_count_);
   declareParameter("vel_threshold", &vel_threshold_);
 }
Example #11
0
    /** Set an attribute for the function
     *
     * @param attName :: The name of the attribute to set
     * @param att :: The attribute to set
     */
    void CubicSpline::setAttribute(const std::string& attName, const API::IFunction::Attribute& att)
    {

      if (attName == "n")
      {
        //get the new and old number of data points
        int n = att.asInt();
        int oldN = getAttribute("n").asInt();

        //check that the number of data points is in a valid range
        if (n > oldN)
        {
          //get the name of the last x data point
          std::string oldXName = "x" + boost::lexical_cast<std::string>(oldN - 1);
          double oldX = getAttribute(oldXName).asDouble();

          //reallocate gsl object to new size
          reallocGSLObjects(n);

          //create blank a number of new blank parameters and attributes
          for (int i = oldN; i < n; ++i)
          {
            std::string num = boost::lexical_cast<std::string>(i);

            std::string newXName = "x" + num;
            std::string newYName = "y" + num;

            declareAttribute(newXName, Attribute(oldX + static_cast<double>(i - oldN + 1)));
            declareParameter(newYName, 0);
          }

          //flag that the spline + derivatives will now need to be recalculated
          m_recalculateSpline = true;
        }
        else if (n < oldN)
        {
          throw std::invalid_argument("Cubic Spline: Can't decrease the number of attributes");
        }
      }

      storeAttributeValue(attName, att);
    }
Example #12
0
PlanElement::PlanElement(std::string const& typeName, std::string const& instanceName) :
    ParameterReflection(typeName, instanceName),
    enableState(EnableState::ENABLED)
{
    declareParameter("enableState", &enableState);
}
/**
 * Initializes function parameters
 */
void PoldiSpectrumDomainFunction::init() {
    declareParameter("Area", 1.0);
    declareParameter("Fwhm", 1.0);
    declareParameter("Centre", 0.0);
}
Example #14
0
  void LeBailFunction::init()
  {
    declareParameter("Dtt1", 1.0);
    declareParameter("Dtt2", 1.0);
    declareParameter("Dtt1t", 1.0);
    declareParameter("Dtt2t", 1.0);
    declareParameter("Zero", 0.0);
    declareParameter("Zerot", 0.0);

    declareParameter("Width", 1.0);
    declareParameter("Tcross", 1.0);
    declareParameter("Alph0",1.6);
    declareParameter("Alph1",1.5);
    declareParameter("Beta0",1.6);
    declareParameter("Beta1",1.5);
    declareParameter("Alph0t",1.6);
    declareParameter("Alph1t",1.5);
    declareParameter("Beta0t",1.6);
    declareParameter("Beta1t",1.5);

    declareParameter("Sig0", 1.0);
    declareParameter("Sig1", 1.0);
    declareParameter("Sig2", 1.0);

    declareParameter("Gam0", 0.0);
    declareParameter("Gam1", 0.0);
    declareParameter("Gam2", 0.0);

    declareParameter("LatticeConstant", 10.0);

    return;
  }
Example #15
0
/// Create parameters
void Laguerre::init()
{
  declareParameter("Alpha",0.0,"The alpha parameter of the generalized Laguerre polynomial.");
}
/// Constructor
CrystalFieldPeaksBase::CrystalFieldPeaksBase()
    : API::IFunctionGeneral(), API::ParamFunction(), m_defaultDomainSize(0) {

  declareAttribute("Ion", Attribute("Ce"));
  declareAttribute("Symmetry", Attribute("Ci"));
  declareAttribute("ToleranceEnergy", Attribute(1.0e-10));
  declareAttribute("ToleranceIntensity", Attribute(1.0e-1));
  declareAttribute("MaxPeakCount", Attribute(0));

  declareParameter("BmolX", 0.0, "The x-component of the molecular field.");
  declareParameter("BmolY", 0.0, "The y-component of the molecular field.");
  declareParameter("BmolZ", 0.0, "The z-component of the molecular field.");

  declareParameter("BextX", 0.0, "The x-component of the external field.");
  declareParameter("BextY", 0.0, "The y-component of the external field.");
  declareParameter("BextZ", 0.0, "The z-component of the external field.");

  declareParameter("B20", 0.0, "Real part of the B20 field parameter.");
  declareParameter("B21", 0.0, "Real part of the B21 field parameter.");
  declareParameter("B22", 0.0, "Real part of the B22 field parameter.");
  declareParameter("B40", 0.0, "Real part of the B40 field parameter.");
  declareParameter("B41", 0.0, "Real part of the B41 field parameter.");
  declareParameter("B42", 0.0, "Real part of the B42 field parameter.");
  declareParameter("B43", 0.0, "Real part of the B43 field parameter.");
  declareParameter("B44", 0.0, "Real part of the B44 field parameter.");
  declareParameter("B60", 0.0, "Real part of the B60 field parameter.");
  declareParameter("B61", 0.0, "Real part of the B61 field parameter.");
  declareParameter("B62", 0.0, "Real part of the B62 field parameter.");
  declareParameter("B63", 0.0, "Real part of the B63 field parameter.");
  declareParameter("B64", 0.0, "Real part of the B64 field parameter.");
  declareParameter("B65", 0.0, "Real part of the B65 field parameter.");
  declareParameter("B66", 0.0, "Real part of the B66 field parameter.");

  declareParameter("IB21", 0.0, "Imaginary part of the B21 field parameter.");
  declareParameter("IB22", 0.0, "Imaginary part of the B22 field parameter.");
  declareParameter("IB41", 0.0, "Imaginary part of the B41 field parameter.");
  declareParameter("IB42", 0.0, "Imaginary part of the B42 field parameter.");
  declareParameter("IB43", 0.0, "Imaginary part of the B43 field parameter.");
  declareParameter("IB44", 0.0, "Imaginary part of the B44 field parameter.");
  declareParameter("IB61", 0.0, "Imaginary part of the B61 field parameter.");
  declareParameter("IB62", 0.0, "Imaginary part of the B62 field parameter.");
  declareParameter("IB63", 0.0, "Imaginary part of the B63 field parameter.");
  declareParameter("IB64", 0.0, "Imaginary part of the B64 field parameter.");
  declareParameter("IB65", 0.0, "Imaginary part of the B65 field parameter.");
  declareParameter("IB66", 0.0, "Imaginary part of the B66 field parameter.");

  setSymmetryC1(*this);
}
Example #17
0
/// This method clears all parameters and declares parameters according to the
/// supplied crystal system.
void PawleyParameterFunction::createLatticeSystemParameters(
    PointGroup::LatticeSystem latticeSystem) {

  clearAllParameters();
  switch (latticeSystem) {
  case PointGroup::LatticeSystem::Cubic:
    declareParameter("a", 1.0);
    addLengthConstraint("a");
    break;

  case PointGroup::LatticeSystem::Hexagonal:
  case PointGroup::LatticeSystem::Tetragonal:
    declareParameter("a", 1.0);
    declareParameter("c", 1.0);
    addLengthConstraint("a");
    addLengthConstraint("c");
    break;

  case PointGroup::LatticeSystem::Orthorhombic:
    declareParameter("a", 1.0);
    declareParameter("b", 1.0);
    declareParameter("c", 1.0);
    addLengthConstraint("a");
    addLengthConstraint("b");
    addLengthConstraint("c");
    break;

  case PointGroup::LatticeSystem::Monoclinic:
    declareParameter("a", 1.0);
    declareParameter("b", 1.0);
    declareParameter("c", 1.0);
    addLengthConstraint("a");
    addLengthConstraint("b");
    addLengthConstraint("c");

    declareParameter("Beta", 90.0);
    addAngleConstraint("Beta");
    break;

  case PointGroup::LatticeSystem::Rhombohedral:
    declareParameter("a", 1.0);
    declareParameter("Alpha", 90.0);
    addLengthConstraint("a");
    addAngleConstraint("Alpha");
    break;

  default:
    // triclinic
    declareParameter("a", 1.0);
    declareParameter("b", 1.0);
    declareParameter("c", 1.0);
    addLengthConstraint("a");
    addLengthConstraint("b");
    addLengthConstraint("c");

    declareParameter("Alpha", 90.0);
    declareParameter("Beta", 90.0);
    declareParameter("Gamma", 90.0);
    addAngleConstraint("Alpha");
    addAngleConstraint("Beta");
    addAngleConstraint("Gamma");
    break;
  }

  declareParameter("ZeroShift", 0.0);
}
/// Declares the function's single parameter A1.
void PoldiSpectrumLinearBackground::init() { declareParameter("A1"); }